diff --git a/configure.py b/configure.py index 6648838bf..9132fefa0 100755 --- a/configure.py +++ b/configure.py @@ -1575,14 +1575,14 @@ config.libs = [ ActorRel(NonMatching, "d_a_bigelf"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_bk"), ActorRel(NonMatching, "d_a_bl"), - ActorRel(NonMatching, "d_a_bmd"), + ActorRel(MatchingFor("GZLJ01", "GZLE01"), "d_a_bmd"), ActorRel(NonMatching, "d_a_bmdfoot"), - ActorRel(NonMatching, "d_a_bmdhand"), + ActorRel(MatchingFor("D44J01"), "d_a_bmdhand"), ActorRel(NonMatching, "d_a_bo"), ActorRel(Matching, "d_a_boss_item"), ActorRel(NonMatching, "d_a_bpw"), ActorRel(NonMatching, "d_a_bst"), - ActorRel(NonMatching, "d_a_btd"), + ActorRel(MatchingFor("GZLJ01", "GZLE01"), "d_a_btd"), ActorRel(NonMatching, "d_a_bwd"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_bwdg"), ActorRel(Matching, "d_a_bwds"), diff --git a/include/d/actor/d_a_bmd.h b/include/d/actor/d_a_bmd.h index bc0539f6c..a52a1a079 100644 --- a/include/d/actor/d_a_bmd.h +++ b/include/d/actor/d_a_bmd.h @@ -11,15 +11,15 @@ struct bmd_class { /* 0x000 */ fopEn_enemy_c actor; /* 0x2AC */ request_of_phase_process_class mPhs; - /* 0x2B4 */ mDoExt_McaMorf* mpMorf; + /* 0x2B4 */ mDoExt_McaMorf* mpBodyMorf; /* 0x2B8 */ mDoExt_brkAnm* mpBrkAnm; /* 0x2BC */ mDoExt_btkAnm* mpBtkAnm; - /* 0x2C0 */ mDoExt_McaMorf* m2C0; - /* 0x2C4 */ mDoExt_McaMorf* m2C4; - /* 0x2C8 */ mDoExt_McaMorf* m2C8; - /* 0x2CC */ J3DModel* m2CC; - /* 0x2D0 */ J3DModel* m2D0; - /* 0x2D4 */ mDoExt_brkAnm* m2D4; + /* 0x2C0 */ mDoExt_McaMorf* mpHeadMorf; + /* 0x2C4 */ mDoExt_McaMorf* mpHeadDeadMorf; + /* 0x2C8 */ mDoExt_McaMorf* mpMakarMorf; + /* 0x2CC */ J3DModel* mpMakarFaceModel; + /* 0x2D0 */ J3DModel* mpR00_EFModel; + /* 0x2D4 */ mDoExt_brkAnm* mpR00_EFBrk; /* 0x2D8 */ f32 m2D8; /* 0x2DC */ s8 m2DC; /* 0x2DD */ u8 m2DD[0x2E0 - 0x2DD]; @@ -76,12 +76,12 @@ struct bmd_class { /* 0xA88 */ s16 mA88[2]; /* 0xA8C */ s16 mA8C; /* 0xA8E */ u8 mA8E[0xA90 - 0xA8E]; - /* 0xA90 */ dPa_smokeEcallBack mA90[7]; + /* 0xA90 */ dPa_smokeEcallBack mSmokeCb[7]; /* 0xB70 */ u8 mB70; /* 0xB71 */ s8 mB71; - #if VERSION > VERSION_DEMO +#if VERSION > VERSION_DEMO /* 0xB72 */ s16 mB72; - #endif +#endif /* 0xB74 */ s16 mB74; /* 0xB76 */ s16 mB76; /* 0xB78 */ s16 mB78; diff --git a/include/d/actor/d_a_bmdfoot.h b/include/d/actor/d_a_bmdfoot.h index aabc0eb64..bf3bbdb46 100644 --- a/include/d/actor/d_a_bmdfoot.h +++ b/include/d/actor/d_a_bmdfoot.h @@ -5,12 +5,10 @@ #include "d/d_particle.h" #include "f_op/f_op_actor.h" -class bmdfoot_class { -public: - /* 0x000 */ fopAc_ac_c actor; - /* 0x290 */ u8 m290[0x2AC - 0x290]; - /* 0x2AC */ request_of_phase_process_class m2AC; - /* 0x2B4 */ mDoExt_McaMorf* m2B4; +struct bmdfoot_class { + /* 0x000 */ fopEn_enemy_c actor; + /* 0x2AC */ request_of_phase_process_class mPhase; + /* 0x2B4 */ mDoExt_McaMorf* mpBodyVineMorf; /* 0x2B8 */ s16 m2B8; /* 0x2BA */ s16 m2BA; /* 0x2BC */ s16 m2BC; @@ -25,15 +23,15 @@ public: /* 0x3F4 */ u8 m3F4; /* 0x3F5 */ u8 m3F5[0x3F8 - 0x3F5]; /* 0x3F8 */ cXyz m3F8[3]; - /* 0x41C */ dPa_followEcallBack m41C[3]; - /* 0x458 */ dPa_smokeEcallBack m458[2]; + /* 0x41C */ dPa_followEcallBack mAsiWaitFollowCB[3]; + /* 0x458 */ dPa_smokeEcallBack mLAttackSmoke00CB[2]; /* 0x498 */ cXyz m498[2]; - /* 0x4B0 */ dPa_smokeEcallBack m4B0; - /* 0x4D0 */ dCcD_Stts m4D0; - /* 0x50C */ dCcD_Sph m50C[5]; + /* 0x4B0 */ dPa_smokeEcallBack mLAttackSmoke01CB; + /* 0x4D0 */ dCcD_Stts mStts; + /* 0x50C */ dCcD_Sph mSph[5]; /* 0xAE8 */ cXyz mAE8; - /* 0xAF4 */ mDoExt_McaMorf* mAF4; - /* 0xAF8 */ dKy_tevstr_c mAF8; + /* 0xAF4 */ mDoExt_McaMorf* mpFloorVineMorf; + /* 0xAF8 */ dKy_tevstr_c mTevstr; /* 0xBA8 */ u8 mBA8; /* 0xBA9 */ u8 mBA9[0xBAC - 0xBA9]; /* 0xBAC */ cXyz mBAC; diff --git a/include/d/actor/d_a_bmdhand.h b/include/d/actor/d_a_bmdhand.h index e0b93bd11..738e4734f 100644 --- a/include/d/actor/d_a_bmdhand.h +++ b/include/d/actor/d_a_bmdhand.h @@ -13,8 +13,8 @@ struct hand_s { struct bmdhand_class { /* 0x000 */ fopEn_enemy_c actor; - /* 0x2AC */ request_of_phase_process_class m2AC; - /* 0x2B4 */ mDoExt_McaMorf* m2B4; + /* 0x2AC */ request_of_phase_process_class mPhase; + /* 0x2B4 */ mDoExt_McaMorf* mpMorf; /* 0x2B8 */ s16 m2B8; /* 0x2BA */ s16 m2BA; /* 0x2BC */ s16 m2BC; @@ -39,8 +39,8 @@ struct bmdhand_class { /* 0x31C */ f32 m31C; /* 0x320 */ f32 m320; /* 0x324 */ hand_s m324[20]; - /* 0x554 */ mDoExt_3DlineMat1_c m554; - /* 0x590 */ dCcD_Stts m590; + /* 0x554 */ mDoExt_3DlineMat1_c mLineMat; + /* 0x590 */ dCcD_Stts mStts; /* 0x5CC */ dCcD_Sph m5CC; /* 0x6F8 */ dCcD_Sph m6F8; /* 0x824 */ u8 m824; diff --git a/include/d/actor/d_a_bpw.h b/include/d/actor/d_a_bpw.h index 238a05460..0ea9d5e1a 100644 --- a/include/d/actor/d_a_bpw.h +++ b/include/d/actor/d_a_bpw.h @@ -7,49 +7,16 @@ #include "d/d_particle.h" struct bpw_class { - enum Actor_Type_e { - Actor_Type_BODY_e = 0, - Actor_Type_KANTERA_e = 1, - Actor_Type_DAMAGE_BALL_e = 2, - Actor_Type_TORITUKI_e = 3, - }; - - enum Damage_Action_e { - Damage_Action_LINE_e = 0, - Damage_Action_DAMAGE_BALL_e = 1, - }; - - enum Action_e { - Action_MOVE_DOUSA_e = 0, - Action_ATTACK_KOUGEKI_e = 1, - Action_BODY_DOWN_KARADA_TAORE_e = 2, - Action_DAMAGE_e = 3, - Action_SEPARATION_BUNRI_DOUSA_e = 4, - Action_START_DEMO_e = 20, - }; - - enum Action_State_Type_e { - Action_State_DAMAGE_CARRIED_e = 0x54, - Action_State_DAMAGE_THROWN_e = 0x55, - Action_State_DAMAGE_HIT_e = 0x65, - Action_State_SEPARATE_BUNRI_DOUSA_INIT_e = 0x6E, - Action_State_SEPARATE_BUNRI_DOUSA_EXECUTE_e = 0x6F, - Action_State_SEPARATE_BUNRI_DOUSA_END_INIT_e = 0x72, - Action_State_SEPARATE_BUNRI_DOUSA_END_GATHER_e = 0x73, - Action_State_SEPARATE_BUNRI_DOUSA_END_GROW_e = 0x74, - Action_State_SEPARATE_BUNRI_DOUSA_END_FINISH_e = 0x75, - }; - /* 0x000 */ fopEn_enemy_c actor; - /* 0x2AC */ request_of_phase_process_class m2AC; - /* 0x2B4 */ mDoExt_McaMorf* mpAnim; + /* 0x2AC */ request_of_phase_process_class mPhase; + /* 0x2B4 */ mDoExt_McaMorf* mpMorf; /* 0x2B8 */ u8 m2B8[0x2BC - 0x2B8]; - /* 0x2BC */ mDoExt_brkAnm* mBrkAnim; - /* 0x2C0 */ mDoExt_brkAnm* mKanteraAnim; - /* 0x2C4 */ mDoExt_brkAnm* m2C4; - /* 0x2C8 */ mDoExt_brkAnm* m2C8; - /* 0x2CC */ mDoExt_brkAnm* m2CC; - /* 0x2D0 */ mDoExt_brkAnm* m2D0; + /* 0x2BC */ mDoExt_brkAnm* mpLightFreezeBrkAnm; // Freezing before falling to the ground + /* 0x2C0 */ mDoExt_brkAnm* mpLanternGlowBrkAnm; + /* 0x2C4 */ mDoExt_brkAnm* mpLightStunBrkAnm; // Hit with light from the Mirror Shield before freezing + /* 0x2C8 */ mDoExt_brkAnm* mpCurseStartBrkAnm; // Falling on Link and inverting the controls + /* 0x2CC */ mDoExt_brkAnm* mpCurseEndBrkAnm; + /* 0x2D0 */ mDoExt_brkAnm* mpDefaultBrkAnm; /* 0x2D4 */ Mtx m2D4; /* 0x304 */ cXyz m304[3]; /* 0x328 */ cXyz m328[3]; @@ -73,7 +40,7 @@ struct bpw_class { /* 0x3DC */ u8 mType; /* 0x3DD */ u8 mUnknownParam2; /* 0x3DE */ u8 mLightState; - /* 0x3DF */ u8 m3DF; + /* 0x3DF */ u8 mHitType; /* 0x3E0 */ u8 m3E0; /* 0x3E1 */ u8 m3E1; /* 0x3E2 */ u8 m3E2; @@ -94,9 +61,9 @@ struct bpw_class { /* 0x3FC */ fpc_ProcID m3FC; /* 0x400 */ fpc_ProcID m400; /* 0x404 */ fpc_ProcID m404; - #if VERSION > VERSION_DEMO +#if VERSION > VERSION_DEMO /* 0x408 */ s16 m408; - #endif +#endif /* 0x40C */ cXyz m40C; /* 0x418 */ cXyz m418; /* 0x424 */ cXyz m424; @@ -131,31 +98,31 @@ struct bpw_class { /* 0x4A4 */ f32 m4A4; /* 0x4A8 */ f32 m4A8; /* 0x4AC */ int mChildPoeIds[15]; - /* 0x4E8 */ u32 m4E8; - /* 0x4EC */ LIGHT_INFLUENCE m4EC; - #if VERSION == VERSION_DEMO + /* 0x4E8 */ u32 mShadowId; + /* 0x4EC */ LIGHT_INFLUENCE mLightInfluence; +#if VERSION == VERSION_DEMO /* 0x508 */ JPABaseEmitter* m508_demo; /* 0x50C */ JPABaseEmitter* m50C_demo; /* 0x510 */ JPABaseEmitter* m510_demo; - #endif +#endif /* 0x50C */ dPa_smokeEcallBack m50C; - #if VERSION == VERSION_DEMO +#if VERSION == VERSION_DEMO /* 0x534 */ JPABaseEmitter* m534_demo; /* 0x538 */ JPABaseEmitter* m538_demo; /* 0x53C */ JPABaseEmitter* m53C_demo; /* 0x540 */ JPABaseEmitter* m540_demo; - #else +#else /* 0x52C */ dPa_followEcallBack m52C; /* 0x540 */ dPa_followEcallBack m540; - #endif +#endif /* 0x554 */ dPa_followEcallBack m554; /* 0x568 */ dPa_followEcallBack mFire1Dousa_Pa_followEcallBack; /* 0x57C */ dPa_followEcallBack mFire1Dousa_Pa_followEcallBack2; /* 0x590 */ dPa_followEcallBack m590; - #if VERSION == VERSION_DEMO +#if VERSION == VERSION_DEMO /* 0x594 */ JPABaseEmitter* m594_demo; /* 0x598 */ JPABaseEmitter* m598_demo; - #endif +#endif /* 0x5A4 */ dPa_followEcallBack mFireDousa2_Pa_followEcallBack; /* 0x5B8 */ dPa_followEcallBack mFireDousa2_Pa_followEcallBack2; /* 0x5CC */ dPa_followEcallBack m5CC; @@ -175,7 +142,7 @@ struct bpw_class { /* 0x9F4 */ dCcD_Sph mBodyAtSph; /* 0xB20 */ dCcD_Sph mKanteraCoSph; /* 0xC4C */ dCcD_Sph mDamageBallCoSph; - /* 0xD78 */ mDoExt_invisibleModel mD78; + /* 0xD78 */ mDoExt_invisibleModel mInvisibleModel; }; #endif /* D_A_BPW_H */ diff --git a/include/d/actor/d_a_btd.h b/include/d/actor/d_a_btd.h index c3b1e86ca..3ac5a8344 100644 --- a/include/d/actor/d_a_btd.h +++ b/include/d/actor/d_a_btd.h @@ -27,17 +27,17 @@ struct btd_sibuki_s { struct btd_class { /* 0x0000 */ fopEn_enemy_c actor; - /* 0x02AC */ request_of_phase_process_class m02AC; - /* 0x02B4 */ request_of_phase_process_class m02B4; - /* 0x02BC */ mDoExt_McaMorf* m02BC; - /* 0x02C0 */ mDoExt_btkAnm* btk; - /* 0x02C4 */ mDoExt_brkAnm* brk; - /* 0x02C8 */ mDoExt_McaMorf* m02C8; - /* 0x02CC */ mDoExt_btkAnm* btkS; - /* 0x02D0 */ mDoExt_brkAnm* brkS; - /* 0x02D4 */ mDoExt_McaMorf* m02D4; - /* 0x02D8 */ mDoExt_btkAnm* m02D8; - /* 0x02DC */ mDoExt_brkAnm* m02DC; + /* 0x02AC */ request_of_phase_process_class mPhaseBtd; + /* 0x02B4 */ request_of_phase_process_class mPhaseMagma; + /* 0x02BC */ mDoExt_McaMorf* mpPhase1Morf; + /* 0x02C0 */ mDoExt_btkAnm* btk; // First phase + /* 0x02C4 */ mDoExt_brkAnm* brk; // First phase + /* 0x02C8 */ mDoExt_McaMorf* mpPhase2Morf; + /* 0x02CC */ mDoExt_btkAnm* btkS; // Second phase + /* 0x02D0 */ mDoExt_brkAnm* brkS; // Second phase + /* 0x02D4 */ mDoExt_McaMorf* mpDeadHeadMorf; + /* 0x02D8 */ mDoExt_btkAnm* mpDeadHeadBtkAnm; + /* 0x02DC */ mDoExt_brkAnm* mpDeadHeadBrkAnm; /* 0x02E0 */ u8 m02E0; /* 0x02E1 */ s8 m02E1; /* 0x02E2 */ s16 m02E2; @@ -57,12 +57,12 @@ struct btd_class { /* 0x02FA */ s16 m02FA; /* 0x02FC */ cXyz m02FC[19]; /* 0x03E0 */ cXyz m03E0; - /* 0x03EC */ dCcD_Stts m03EC; - /* 0x0428 */ dCcD_Sph m0428[19]; - /* 0x1A6C */ dCcD_Sph m1A6C; - /* 0x1B98 */ dCcD_Sph m1B98; - /* 0x1CC4 */ dCcD_Sph m1CC4[50]; - /* 0x575C */ dCcD_Cyl m575C[6]; + /* 0x03EC */ dCcD_Stts mStts; + /* 0x0428 */ dCcD_Sph mAtSphs[19]; + /* 0x1A6C */ dCcD_Sph mEyeSph; + /* 0x1B98 */ dCcD_Sph mFireSph; + /* 0x1CC4 */ dCcD_Sph mSibukiSphs[50]; + /* 0x575C */ dCcD_Cyl mHandCyls[6]; /* 0x5E7C */ u8 m5E7C; /* 0x5E7D */ u8 m5E7D[0x5E80 - 0x5E7D]; /* 0x5E80 */ f32 m5E80; @@ -97,7 +97,7 @@ struct btd_class { /* 0x6048 */ csXyz m6048; /* 0x604E */ u8 m604E[0x6050 - 0x604E]; /* 0x6050 */ dPa_smokeEcallBack mPa_SmokeEcallBack[3]; - /* 0x60B0 */ LIGHT_INFLUENCE m60B0; + /* 0x60B0 */ LIGHT_INFLUENCE mLightInfluence; /* 0x60D0 */ f32 m60D0; /* 0x60D4 */ f32 m60D4; /* 0x60D8 */ u8 m60D8; @@ -106,7 +106,7 @@ struct btd_class { /* 0x60DB */ u8 mKankyoState; /* 0x60DC */ s16 mKankyoTimer; /* 0x60DE */ u8 m60DE[0x60E0 - 0x60DE]; - /* 0x60E0 */ dKy_tevstr_c m60E0; + /* 0x60E0 */ dKy_tevstr_c mTevstr; /* 0x6190 */ u8 m6190; /* 0x6191 */ u8 m6191[0x6194 - 0x6191]; /* 0x6194 */ btd_hahen_s hahen[35]; diff --git a/include/d/actor/d_a_bwd.h b/include/d/actor/d_a_bwd.h index 79754d89c..b2491bbfc 100644 --- a/include/d/actor/d_a_bwd.h +++ b/include/d/actor/d_a_bwd.h @@ -20,14 +20,14 @@ struct bwd_class { /* 0x02B4 */ request_of_phase_process_class mPhaseBwds; /* 0x02BC */ u8 m02BC; /* 0x02BD */ u8 m02BD[0x02BF - 0x02BD]; - /* 0x02C0 */ mDoExt_McaMorf* m02C0; - /* 0x02C4 */ mDoExt_brkAnm* m02C4; + /* 0x02C0 */ mDoExt_McaMorf* mpHeadMorf; + /* 0x02C4 */ mDoExt_brkAnm* mpHeadBrkAnm; /* 0x02C8 */ f32 m02C8; /* 0x02CC */ J3DModel* m02CC; /* 0x02D0 */ u8 m02D0[0x02D4 - 0x02D0]; - /* 0x02D4 */ J3DModel* m02D4[20]; + /* 0x02D4 */ J3DModel* mpBodyModel[20]; /* 0x0324 */ J3DModel* m0324[20]; - /* 0x0374 */ mDoExt_brkAnm* m0374[20]; + /* 0x0374 */ mDoExt_brkAnm* mpBodyMorf[20]; /* 0x0374 */ f32 m03C4[20]; /* 0x0414 */ s32 m0414; /* 0x0418 */ cXyz m0418[20]; @@ -51,14 +51,14 @@ struct bwd_class { /* 0x17EA */ u8 m17EA[0x17EC - 0x17EA]; /* 0x17EC */ J3DModel* m17EC[2]; /* 0x17F4 */ mDoExt_btkAnm* m17F4[2]; - /* 0x17FC */ Mtx m17FC[2]; - /* 0x185C */ dBgW* m185C[2]; + /* 0x17FC */ Mtx mBgwMtx1[2]; + /* 0x185C */ dBgW* mpBgW1[2]; /* 0x1864 */ s8 m1864; /* 0x1865 */ s8 m1865; /* 0x1866 */ u8 m1866[0x1868 - 0x1866]; - /* 0x1868 */ J3DModel* m1868; - /* 0x186C */ Mtx m186C; - /* 0x189C */ dBgW* m189C; + /* 0x1868 */ J3DModel* mpTriforcePlatformModel; + /* 0x186C */ Mtx mBgwMtx2; + /* 0x189C */ dBgW* mpBgW2; /* 0x18A0 */ cXyz m18A0; /* 0x18AC */ s16 m18AC; /* 0x18AE */ s16 m18AE; @@ -83,7 +83,7 @@ struct bwd_class { /* 0x1900 */ s16 m1900; /* 0x1902 */ s16 m1902; /* 0x1904 */ s32 m1904; - /* 0x1908 */ sita_s m1908[32]; + /* 0x1908 */ sita_s mTongueSegments[32]; /* 0x1B88 */ cXyz m1B88; /* 0x1B94 */ cXyz m1B94; /* 0x1BA0 */ f32 m1BA0; @@ -103,10 +103,10 @@ struct bwd_class { #if VERSION == VERSION_USA /* 0x1BC0 */ fpc_ProcID m1BC0; #endif - /* 0x1BC4 */ dCcD_Stts mCcD_Stts; - /* 0x1C00 */ dCcD_Sph mDamageSpheres[19]; - /* 0x3244 */ dCcD_Sph mCcD_Sph; - /* 0x3370 */ dCcD_Sph mCcD_Sph_Array5[5]; + /* 0x1BC4 */ dCcD_Stts mStts; + /* 0x1C00 */ dCcD_Sph mBodySph[19]; + /* 0x3244 */ dCcD_Sph mTongueSph; + /* 0x3370 */ dCcD_Sph mTongueCoSph[5]; /* 0x394C */ s8 m394C; /* 0x394D */ u8 m394D[0x3954 - 0x394D]; /* 0x3954 */ cXyz m3954; @@ -128,9 +128,9 @@ struct bwd_class { /* 0x3B08 */ s8 m3B08[2]; /* 0x3B0A */ u8 m3B0A[0x3B0C - 0x3B0A]; /* 0x3B0C */ cXyz m3B0C[2]; - /* 0x3B24 */ mDoExt_McaMorf* m3B24[2]; - /* 0x3B34 */ mDoExt_btkAnm* m3B2C[2]; - /* 0x3B34 */ mDoExt_brkAnm* m3B34[2]; + /* 0x3B24 */ mDoExt_McaMorf* mpGspMorf[2]; + /* 0x3B34 */ mDoExt_btkAnm* mpGspBtkAnm[2]; + /* 0x3B34 */ mDoExt_brkAnm* mpGspBrkAnm[2]; /* 0x3B3C */ f32 m3B3C; /* 0x3B40 */ f32 m3B40; /* 0x3B44 */ f32 m3B44; @@ -140,12 +140,16 @@ struct bwd_class { /* 0x3C15 */ s8 m3C15; /* 0x3C16 */ u8 m3C16[0x3C18 - 0x3C16]; /* 0x3C18 */ f32 m3C18; +#if VERSION > VERSION_DEMO /* 0x3C1C */ s16 m3C1C; +#endif /* 0x3C1E */ s16 m3C1E; /* 0x3C20 */ s16 m3C20; /* 0x3C22 */ s16 m3C22; /* 0x3C24 */ s8 m3C24; +#if VERSION > VERSION_DEMO /* 0x3C25 */ u8 m3C25[0x3C28 - 0x3C25]; +#endif /* 0x3C28 */ cXyz m3C28; /* 0x3C34 */ cXyz m3C34; /* 0x3C40 */ u8 m3C40[0x3C44 - 0x3C40]; diff --git a/src/d/actor/d_a_bdk.cpp b/src/d/actor/d_a_bdk.cpp index e933cf6bd..7c5033562 100644 --- a/src/d/actor/d_a_bdk.cpp +++ b/src/d/actor/d_a_bdk.cpp @@ -71,7 +71,7 @@ daBdk_HIO_c::daBdk_HIO_c() { /* 0000015C-000001A8 .text kamome_delete_sub__FPvPv */ void* kamome_delete_sub(void* param_1, void*) { - if (fopAc_IsActor(param_1) && fopAcM_GetName(param_1) == PROC_KAMOME) { + if (fopAcM_IsActor(param_1) && fopAcM_GetName(param_1) == PROC_KAMOME) { fopAcM_delete(static_cast(param_1)); } return NULL; @@ -79,7 +79,7 @@ void* kamome_delete_sub(void* param_1, void*) { /* 000001A8-000001F4 .text kui_delete_sub__FPvPv */ void* kui_delete_sub(void* param_1, void*) { - if (fopAc_IsActor(param_1) && fopAcM_GetName(param_1) == PROC_KUI) { + if (fopAcM_IsActor(param_1) && fopAcM_GetName(param_1) == PROC_KUI) { fopAcM_delete(static_cast(param_1)); } return NULL; @@ -87,7 +87,7 @@ void* kui_delete_sub(void* param_1, void*) { /* 000001F4-00000240 .text ep_delete_sub__FPvPv */ void* ep_delete_sub(void* param_1, void*) { - if (fopAc_IsActor(param_1) && fopAcM_GetName(param_1) == PROC_EP) { + if (fopAcM_IsActor(param_1) && fopAcM_GetName(param_1) == PROC_EP) { fopAcM_delete(static_cast(param_1)); } return NULL; @@ -95,7 +95,7 @@ void* ep_delete_sub(void* param_1, void*) { /* 00000240-0000028C .text dk_delete_sub__FPvPv */ void* dk_delete_sub(void* param_1, void*) { - if (fopAc_IsActor(param_1) && fopAcM_GetName(param_1) == PROC_DK) { + if (fopAcM_IsActor(param_1) && fopAcM_GetName(param_1) == PROC_DK) { fopAcM_delete(static_cast(param_1)); } return NULL; @@ -104,7 +104,7 @@ void* dk_delete_sub(void* param_1, void*) { /* 0000028C-000002E8 .text obj_delete_sub__FPvPv */ void* obj_delete_sub(void* param_1, void*) { fopAc_ac_c* actor = static_cast(param_1); - if (fopAc_IsActor(actor) && fopAcM_GetName(actor) == PROC_BDKOBJ + if (fopAcM_IsActor(actor) && fopAcM_GetName(actor) == PROC_BDKOBJ && (fopAcM_GetParam(actor) & 0xF) >= 2) { fopAcM_delete(actor); } @@ -113,7 +113,7 @@ void* obj_delete_sub(void* param_1, void*) { /* 000002E8-00000334 .text sea_delete_sub__FPvPv */ void* sea_delete_sub(void* param_1, void*) { - if (fopAc_IsActor(param_1) && fopAcM_GetName(param_1) == PROC_Obj_Tide) { + if (fopAcM_IsActor(param_1) && fopAcM_GetName(param_1) == PROC_Obj_Tide) { fopAcM_delete(static_cast(param_1)); } return NULL; @@ -121,7 +121,7 @@ void* sea_delete_sub(void* param_1, void*) { /* 00000334-00000380 .text bk_delete_sub__FPvPv */ void* bk_delete_sub(void* param_1, void*) { - if (fopAc_IsActor(param_1) && fopAcM_GetName(param_1) == PROC_BK) { + if (fopAcM_IsActor(param_1) && fopAcM_GetName(param_1) == PROC_BK) { fopAcM_delete(static_cast(param_1)); } return NULL; @@ -129,7 +129,7 @@ void* bk_delete_sub(void* param_1, void*) { /* 00000380-000003CC .text boko_delete_sub__FPvPv */ void* boko_delete_sub(void* param_1, void*) { - if (fopAc_IsActor(param_1) && fopAcM_GetName(param_1) == PROC_BOKO) { + if (fopAcM_IsActor(param_1) && fopAcM_GetName(param_1) == PROC_BOKO) { fopAcM_delete(static_cast(param_1)); } return NULL; @@ -138,7 +138,7 @@ void* boko_delete_sub(void* param_1, void*) { /* 000003CC-00000424 .text obj2_delete_sub__FPvPv */ void* obj2_delete_sub(void* param_1, void*) { fopAc_ac_c* actor = static_cast(param_1); - if (fopAc_IsActor(actor) && fopAcM_GetName(actor) == PROC_BDKOBJ + if (fopAcM_IsActor(actor) && fopAcM_GetName(actor) == PROC_BDKOBJ && actor->model == NULL) { fopAcM_delete(actor); } @@ -1952,7 +1952,7 @@ void end(bdk_class* i_this) { /* 00005EA0-00005F08 .text obj_s_sub__FPvPv */ void* obj_s_sub(void* param_1, void*) { fopAc_ac_c* actor = (fopAc_ac_c*)param_1; - if (fopAc_IsActor(actor) && fopAcM_GetName(actor) == PROC_BDKOBJ && (fpcM_GetParam(actor) & 0xF) != 0xF && actor->health != 0) { + if (fopAcM_IsActor(actor) && fopAcM_GetName(actor) == PROC_BDKOBJ && (fpcM_GetParam(actor) & 0xF) != 0xF && actor->health != 0) { return param_1; } return NULL; diff --git a/src/d/actor/d_a_bmd.cpp b/src/d/actor/d_a_bmd.cpp index 936b2e504..ed256e60f 100644 --- a/src/d/actor/d_a_bmd.cpp +++ b/src/d/actor/d_a_bmd.cpp @@ -77,11 +77,11 @@ static BOOL core_nodeCallBack(J3DNode* node, int calcTiming) { void mk_draw(bmd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; if (i_this->m2DC != 0) { - g_env_light.setLightTevColorType(i_this->mpMorf->getModel(), &actor->tevStr); - i_this->m2C8->entryDL(); - i_this->m2CC->setBaseTRMtx(i_this->m2C8->getModel()->getAnmMtx(1)); - g_env_light.setLightTevColorType(i_this->m2CC, &actor->tevStr); - mDoExt_modelUpdateDL(i_this->m2CC); + g_env_light.setLightTevColorType(i_this->mpBodyMorf->getModel(), &actor->tevStr); + i_this->mpMakarMorf->entryDL(); + i_this->mpMakarFaceModel->setBaseTRMtx(i_this->mpMakarMorf->getModel()->getAnmMtx(1)); + g_env_light.setLightTevColorType(i_this->mpMakarFaceModel, &actor->tevStr); + mDoExt_modelUpdateDL(i_this->mpMakarFaceModel); } } @@ -99,19 +99,19 @@ static BOOL daBmd_Draw(bmd_class* i_this) { } #endif g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &i_this->actor.current.pos, &i_this->actor.tevStr); - pJVar11 = i_this->mpMorf->getModel(); + pJVar11 = i_this->mpBodyMorf->getModel(); g_env_light.setLightTevColorType(pJVar11, &i_this->actor.tevStr); if (i_this->mB70 != 0) { i_this->mpBrkAnm->entry(pJVar11->getModelData()); i_this->mpBtkAnm->entry(pJVar11->getModelData()); } - i_this->mpMorf->entryDL(); + i_this->mpBodyMorf->entryDL(); if (i_this->m306 < 100) { - g_env_light.setLightTevColorType(i_this->m2C0->getModel(), &i_this->actor.tevStr); - i_this->m2C0->entryDL(); + g_env_light.setLightTevColorType(i_this->mpHeadMorf->getModel(), &i_this->actor.tevStr); + i_this->mpHeadMorf->entryDL(); } else if (i_this->m306 < 0x6e) { - g_env_light.setLightTevColorType(i_this->m2C4->getModel(), &i_this->actor.tevStr); - i_this->m2C4->entryDL(); + g_env_light.setLightTevColorType(i_this->mpHeadDeadMorf->getModel(), &i_this->actor.tevStr); + i_this->mpHeadDeadMorf->entryDL(); } mk_draw(i_this); dComIfGd_setSimpleShadow2( @@ -120,9 +120,9 @@ static BOOL daBmd_Draw(bmd_class* i_this) { dKy_tevstr_c tevstr = i_this->actor.tevStr; static cXyz g_pos(0.0f, 0.0f, 0.0f); g_env_light.settingTevStruct(TEV_TYPE_BG1, &g_pos, &tevstr); - g_env_light.setLightTevColorType(i_this->m2D0, &tevstr); - i_this->m2D4->entry(i_this->m2D0->getModelData()); - mDoExt_modelUpdateDL(i_this->m2D0); + g_env_light.setLightTevColorType(i_this->mpR00_EFModel, &tevstr); + i_this->mpR00_EFBrk->entry(i_this->mpR00_EFModel->getModelData()); + mDoExt_modelUpdateDL(i_this->mpR00_EFModel); dSnap_RegistFig(DSNAP_TYPE_BMD, &i_this->actor, 1.0f, 1.0f, 1.0f); return TRUE; } @@ -130,28 +130,23 @@ static BOOL daBmd_Draw(bmd_class* i_this) { /* 00000604-00000734 .text anm_init__FP9bmd_classifUcfi */ void anm_init(bmd_class* i_this, int bckFileIdx, f32 morf, u8 loopMode, f32 speed, int soundFileIdx) { if (soundFileIdx >= 0) { - i_this->mpMorf->setAnm( + i_this->mpBodyMorf->setAnm( (J3DAnmTransform*)dComIfG_getObjectRes("Bmd", bckFileIdx), loopMode, morf, speed, 0.0f, -1.0f, dComIfG_getObjectRes("Ki", soundFileIdx) ); } else { - i_this->mpMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmd", bckFileIdx), loopMode, morf, speed, 0.0f, -1.0f, NULL); + i_this->mpBodyMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmd", bckFileIdx), loopMode, morf, speed, 0.0f, -1.0f, NULL); } } /* 00000734-000010A4 .text damage__FP9bmd_class */ void damage(bmd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - s8 bVar1; - s16 sVar3; - s16 sVar5; - JPABaseEmitter* pJVar4; - int iVar7; cXyz local_40; cXyz local_4c; static s32 jno[] = {0x1A, 0x23, 0x2C, 0x35, 0x3E}; #if VERSION > VERSION_DEMO - bVar1 = false; + s8 bVar1 = false; #endif local_40.setall(0.0f); switch (i_this->m302) { @@ -170,8 +165,7 @@ void damage(bmd_class* i_this) { anm_init(i_this, BMD_BCK_HANA_OTIRU, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->m304 = 1; i_this->m302 = 2; - sVar5 = fopAcM_searchPlayerAngleY(actor); - i_this->m93C = sVar5; + i_this->m93C = fopAcM_searchPlayerAngleY(actor); i_this->mBD8 = 2000.0f; dComIfGp_particle_set(dPa_name::ID_AK_SN_BKMOPENHOUSHI00, &actor->current.pos); if (dComIfGp_getStartStageName()[0] == 'X') { @@ -182,28 +176,30 @@ void damage(bmd_class* i_this) { } break; case 2: - if (((s16)(REG0_S(1) + 10) == (s16)i_this->mpMorf->getFrame()) && (fopAcM_searchPlayerDistance(actor) < (REG0_F(8) + 400.0f))) { + if (((s16)(REG0_S(1) + 10) == (s16)i_this->mpBodyMorf->getFrame()) && (fopAcM_searchPlayerDistance(actor) < (REG0_F(8) + 400.0f))) { i_this->m904 = REG0_S(2) + 0x14; i_this->m314 = 0x1e; } - if ((s16)i_this->mpMorf->getFrame() == 30) { - for (s32 i = 0; i < (s32)ARRAY_SIZE(jno); i++) { - pJVar4 = dComIfGp_particle_setToon(dPa_name::ID_AK_ST_BKMOPENSMOKE00, &actor->current.pos, NULL, NULL, 0xB9, &i_this->mA90[i], fopAcM_GetRoomNo(actor)); - if (pJVar4 != NULL) { - pJVar4->setGlobalRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(jno[i])); + if ((s16)i_this->mpBodyMorf->getFrame() == 30) { + for (s32 i = 0; i < ARRAY_SSIZE(jno); i++) { + JPABaseEmitter* emitter = dComIfGp_particle_setToon( + dPa_name::ID_AK_ST_BKMOPENSMOKE00, &actor->current.pos, NULL, NULL, 0xB9, &i_this->mSmokeCb[i], fopAcM_GetRoomNo(actor) + ); + if (emitter != NULL) { + emitter->setGlobalRTMatrix(i_this->mpBodyMorf->getModel()->getAnmMtx(jno[i])); } } } - if ((s16)i_this->mpMorf->getFrame() == 10) { + if ((s16)i_this->mpBodyMorf->getFrame() == 10) { i_this->mBD8 = 2000.0f; } - if (i_this->mpMorf->isStop()) { + if (i_this->mpBodyMorf->isStop()) { anm_init(i_this, BMD_BCK_HIRAKU_WAIT, 5.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->m302 = 3; i_this->m308[0] = l_HIO.m14; i_this->m940 = 0; } - if ((s16)i_this->mpMorf->getFrame() > 25) { + if ((s16)i_this->mpBodyMorf->getFrame() > 25) { cLib_addCalc2(&i_this->mBDC, 1.0f, 1.0f, 0.1f); } break; @@ -217,11 +213,11 @@ void damage(bmd_class* i_this) { } cLib_addCalc2(&i_this->mBDC, 1.0f, 1.0f, 0.1f); break; - case 4: - if ((s16)i_this->mpMorf->getFrame() == 23) { + case 4: { + if ((s16)i_this->mpBodyMorf->getFrame() == 23) { mDoAud_seStart(JA_SE_CM_BKM_BODY_CLOSE, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } - if ((s16)i_this->mpMorf->getFrame() == 27) { + if ((s16)i_this->mpBodyMorf->getFrame() == 27) { dComIfGp_particle_set(dPa_name::ID_AK_SN_BKMCLOSEHOUSHI00, &actor->current.pos); if (dComIfGp_getStartStageName()[0] == 'X') { mDoAud_bgmStart(JA_BGM_PAST_BKM); @@ -229,15 +225,16 @@ void damage(bmd_class* i_this) { mDoAud_bgmStart(JA_BGM_KINDAN_BOSS); } } - iVar7 = i_this->mpMorf->getFrame(); - if ((s16)iVar7 <= 15) { + int frame = i_this->mpBodyMorf->getFrame(); + if ((s16)frame <= 15) { cLib_addCalc2(&i_this->mBDC, 1.0f, 1.0f, 0.1f); } - if ((s16)i_this->mpMorf->getFrame() == 15) { + if ((s16)i_this->mpBodyMorf->getFrame() == 15) { i_this->mBD8 = 2000.0f; } - iVar7 = i_this->mpMorf->getFrame(); - if ((s16)iVar7 < (s16)(REG0_S(5) + 0x14)) { + frame = i_this->mpBodyMorf->getFrame(); + s16 sVar3; + if ((s16)frame < (s16)(REG0_S(5) + 0x14)) { sVar3 = REG0_S(3) + 200; i_this->m942 = 0; } else { @@ -256,7 +253,7 @@ void damage(bmd_class* i_this) { } } cLib_addCalcAngleS2(&i_this->m940, -0x4000, 1, sVar3); - if (i_this->mpMorf->isStop()) { + if (i_this->mpBodyMorf->isStop()) { i_this->m302 = 5; i_this->m308[0] = 0x1e; #if VERSION > VERSION_DEMO @@ -264,6 +261,7 @@ void damage(bmd_class* i_this) { #endif } break; + } case 5: cLib_addCalcAngleS2(&i_this->m940, -0x4000, 1, 0x290); if (i_this->m308[0] == 0) { @@ -298,7 +296,9 @@ void damage(bmd_class* i_this) { mDoAud_seStart(JA_SE_CM_BKM_BODY_FALL, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); actor->speed.y = 10.0f; dComIfGp_particle_set(dPa_name::ID_AK_SN_BKMDROPDOWNSOIL00, &actor->current.pos); - dComIfGp_particle_setToon(dPa_name::ID_AK_ST_BKMDROPDOWNSMOKE00, &actor->current.pos, NULL, NULL, 0xB9, &i_this->mA90[5], (u8)actor->current.roomNo); + dComIfGp_particle_setToon( + dPa_name::ID_AK_ST_BKMDROPDOWNSMOKE00, &actor->current.pos, NULL, NULL, 0xB9, &i_this->mSmokeCb[5], (u8)actor->current.roomNo + ); } else { actor->speed.y = 0.0f; } @@ -334,7 +334,7 @@ void eat(bmd_class* i_this) { // fallthrough case 1: cLib_addCalcAngleS2(&i_this->m940, -0x4000, 1, 0x1000); - if (i_this->mpMorf->isStop()) { + if (i_this->mpBodyMorf->isStop()) { i_this->m302 = 2; anm_init(i_this, BMD_BCK_HANA_EAT, 10.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->m308[0] = 0x32; @@ -363,10 +363,10 @@ void eat(bmd_class* i_this) { if (i_this->mB78 == 0x55) { sp18 = actor->current.pos; sp18.y += REG17_F(0) + 1000.0f; - player->setThrowDamage(&sp18, i_this->mB96 + (REG0_S(6) + 0x5000), (REG17_F(1) + 50.0f), (REG17_F(2) + 120.0f), 4); + player->setThrowDamage(&sp18, (i_this->mB96 + 0x5000) + REG0_S(6), REG17_F(1) + 50.0f, REG17_F(2) + 120.0f, 4); i_this->m904 = REG0_S(2) + 0x14; } - if (i_this->mpMorf->isStop()) { + if (i_this->mpBodyMorf->isStop()) { i_this->m302 = 4; } break; @@ -422,6 +422,7 @@ void move1(bmd_class* i_this) { /* 00001684-00001B48 .text start__FP9bmd_class */ void start(bmd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); s16 sVar2; f32 dVar4; cXyz local_28; @@ -430,7 +431,7 @@ void start(bmd_class* i_this) { switch (i_this->m302) { case 0: anm_init(i_this, BMD_BCK_HIRAKU_WAIT, 1.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); - i_this->m2C0->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_COA_START1), J3DFrameCtrl::EMode_LOOP, 1.0f, 1.0f, 0.0f, -1.0f, NULL); + i_this->mpHeadMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_COA_START1), J3DFrameCtrl::EMode_LOOP, 1.0f, 1.0f, 0.0f, -1.0f, NULL); i_this->m302 = 1; i_this->m304 = 2; i_this->m2DC = 1; @@ -450,7 +451,9 @@ void start(bmd_class* i_this) { if (dVar4 < 500.0f) { i_this->m302 = 2; i_this->mB74 = 5; +#if VERSION > VERSION_DEMO i_this->m940 = -0x4000; +#endif mDoAud_bgmStreamPlay(); } break; @@ -510,7 +513,6 @@ void start(bmd_class* i_this) { /* 00001B48-00001EFC .text end__FP9bmd_class */ void end(bmd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - JPABaseEmitter* pJVar3; static s32 jno[] = {0x19, 0x22, 0x2B, 0x34, 0x3D}; daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); @@ -542,22 +544,22 @@ void end(bmd_class* i_this) { } if (i_this->mB76 == REG0_S(4) + 0x17c) { anm_init(i_this, BMD_BCK_HANA_DEAD2, 10.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); - mDoAud_seStart(JA_SE_CM_BKM_END_FLW_WAVING, &actor->current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + fopAcM_seStartCurrent(actor, JA_SE_CM_BKM_END_FLW_WAVING, 0); } if (i_this->mB76 == REG0_S(5) + 0x1c2) { anm_init(i_this, BMD_BCK_HANA_DEAD3, 10.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); - mDoAud_seStart(JA_SE_CM_BKM_END_FLW_LIFTUP, &actor->current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + fopAcM_seStartCurrent(actor, JA_SE_CM_BKM_END_FLW_LIFTUP, 0); i_this->mBD8 = 2000.0f; i_this->m332 = 9; - for (s32 i = 0; i < (s32)ARRAY_SIZE(jno); i++) { - pJVar3 = dComIfGp_particle_set(dPa_name::ID_AK_SN_BKMHANAKARERU00, &actor->current.pos); - if (pJVar3 != NULL) { - pJVar3->setGlobalRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(jno[i])); + for (s32 i = 0; i < ARRAY_SSIZE(jno); i++) { + JPABaseEmitter* emitter = dComIfGp_particle_set(dPa_name::ID_AK_SN_BKMHANAKARERU00, &actor->current.pos); + if (emitter != NULL) { + emitter->setGlobalRTMatrix(i_this->mpBodyMorf->getModel()->getAnmMtx(jno[i])); } } } if (i_this->mB76 == 0x230) { - mDoAud_seStart(JA_SE_CM_BKM_END_FLW_DIE, &actor->current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + fopAcM_seStartCurrent(actor, JA_SE_CM_BKM_END_FLW_DIE, 0); } if (i_this->mB76 == REG0_S(6) + 0x276) { dComIfGs_onStageBossEnemy(); @@ -573,12 +575,11 @@ void end(bmd_class* i_this) { /* 00001EFC-00002190 .text core_damage_check__FP9bmd_class */ void core_damage_check(bmd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - s8 bVar2; cXyz local_38; - CcAtInfo local_2c; + CcAtInfo atInfo; daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); - bVar2 = false; + s8 bVar2 = false; if (i_this->m310 != 0) { return; } @@ -586,10 +587,10 @@ void core_damage_check(bmd_class* i_this) { i_this->m310 = 8; fopAcM_monsSeStart(actor, JA_SE_CV_BKM_DAMAGE, 0); i_this->m306 = 1; - local_2c.pParticlePos = NULL; - local_2c.mpObj = i_this->mCoreSph.GetTgHitObj(); - local_2c.pParticlePos = i_this->mCoreSph.GetTgHitPosP(); - fopAc_ac_c* pfVar4 = cc_at_check(actor, &local_2c); + atInfo.pParticlePos = NULL; + atInfo.mpObj = i_this->mCoreSph.GetTgHitObj(); + atInfo.pParticlePos = i_this->mCoreSph.GetTgHitPosP(); + fopAc_ac_c* pfVar4 = cc_at_check(actor, &atInfo); if (pfVar4 != NULL) { local_38.x = actor->eyePos.x - pfVar4->current.pos.x; local_38.z = actor->eyePos.z - pfVar4->current.pos.z; @@ -612,7 +613,7 @@ void core_damage_check(bmd_class* i_this) { i_this->mMode = 0xb; i_this->m302 = 0; i_this->mB74 = 100; - dScnPly_ply_c::nextPauseTimer = 8; + dScnPly_ply_c::setPauseTimer(8); i_this->m310 = 20000; i_this->mBE0 = 2; i_this->mBDC = 1.0f; @@ -626,21 +627,19 @@ void core_damage_check(bmd_class* i_this) { void core_move(bmd_class* i_this) { /* Nonmatching - switch case */ fopAc_ac_c* actor = &i_this->actor; - int iVar1; - bool bVar5; JPABaseEmitter* pJVar7; J3DModel* pJVar11; cXyz local_40; cXyz local_4c; cXyz local_58; - bVar5 = false; + bool bVar5 = false; core_damage_check(i_this); switch (i_this->m306) { case 0: break; case 1: - i_this->m2C0->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_COA_DAMAGE), J3DFrameCtrl::EMode_NONE, 1.0f, 1.0f, 0.0f, -1.0f, NULL); + i_this->mpHeadMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_COA_DAMAGE), J3DFrameCtrl::EMode_NONE, 1.0f, 1.0f, 0.0f, -1.0f, NULL); i_this->m306 = 2; i_this->m918 = 0; i_this->m91C = REG0_F(9) + 6000.0f; @@ -649,14 +648,18 @@ void core_move(bmd_class* i_this) { case 2: if (std::fabsf(i_this->m91C) < 200.0f) { i_this->m306 = 0; - i_this->m2C0->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_COA_WAIT), J3DFrameCtrl::EMode_LOOP, 5.0f, 1.0f, 0.0f, -1.0f, NULL); + i_this->mpHeadMorf->setAnm( + (J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_COA_WAIT), J3DFrameCtrl::EMode_LOOP, 5.0f, 1.0f, 0.0f, -1.0f, NULL + ); } break; case 100: - i_this->m2C4->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_COA_DEAD1), J3DFrameCtrl::EMode_NONE, 5.0f, 1.0f, 0.0f, -1.0f, NULL); + i_this->mpHeadDeadMorf->setAnm( + (J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_COA_DEAD1), J3DFrameCtrl::EMode_NONE, 5.0f, 1.0f, 0.0f, -1.0f, NULL + ); i_this->m306 = 0x65; i_this->m924 = actor->current.pos; - cMtx_YrotS(*calc_mtx, actor->shape_angle.y + (REG0_S(4) + 3000)); + cMtx_YrotS(*calc_mtx, (actor->shape_angle.y + 3000) + REG0_S(4)); local_40.y = 0.0f; local_40.x = 0.0f; local_40.z = REG0_F(15) + 7.0f; @@ -677,7 +680,9 @@ void core_move(bmd_class* i_this) { i_this->m924.y = (i_this->m328 - 10.0f) + REG0_F(13); i_this->m306 = 0x66; mDoAud_bgmStreamPlay(); - i_this->m2C4->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_COA_DEAD2), J3DFrameCtrl::EMode_NONE, 1.0f, 1.0f, 0.0f, -1.0f, NULL); + i_this->mpHeadDeadMorf->setAnm( + (J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_COA_DEAD2), J3DFrameCtrl::EMode_NONE, 1.0f, 1.0f, 0.0f, -1.0f, NULL + ); i_this->m930.y = 0.0f; i_this->m930.z = 0.0f; i_this->m930.x = 0.0f; @@ -687,60 +692,67 @@ void core_move(bmd_class* i_this) { } break; case 102: - iVar1 = i_this->m2C4->getFrame(); - if (iVar1 == 14) { + if ((int)i_this->mpHeadDeadMorf->getFrame() == 14) { bVar5 = true; fopAcM_monsSeStart(actor, JA_SE_CV_BKM_JITABATA, 0); } i_this->mA8C = 3; - if (i_this->m2C4->isStop()) { - i_this->m2C4->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_COA_NDEAD1), J3DFrameCtrl::EMode_NONE, 1.0f, 1.0f, 0.0f, -1.0f, NULL); + if (i_this->mpHeadDeadMorf->isStop()) { + i_this->mpHeadDeadMorf->setAnm( + (J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_COA_NDEAD1), J3DFrameCtrl::EMode_NONE, 1.0f, 1.0f, 0.0f, -1.0f, NULL + ); i_this->m306 = 0x67; i_this->m930.z = 10.0f; i_this->m930.x = 10.0f; i_this->m308[1] = REG0_S(6) + 0xc3; } - break; + goto temp_884; case 103: - iVar1 = i_this->m2C4->getFrame(); - if (iVar1 == 18) { + if ((int)i_this->mpHeadDeadMorf->getFrame() == 18) { bVar5 = true; fopAcM_monsSeStart(actor, JA_SE_CV_BKM_JITABATA, 0); } i_this->mA8C = 3; - if (i_this->m2C4->isStop()) { - i_this->m2C4->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_COA_NDEAD2), J3DFrameCtrl::EMode_NONE, 1.0f, 1.0f, 0.0f, -1.0f, NULL); - i_this->m306 = 0x68; + if (!i_this->mpHeadDeadMorf->isStop()) { + goto temp_884; } - break; + i_this->mpHeadDeadMorf->setAnm( + (J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_COA_NDEAD2), J3DFrameCtrl::EMode_NONE, 1.0f, 1.0f, 0.0f, -1.0f, NULL + ); + i_this->m306 = 0x68; + goto temp_884; case 104: - if ((int)i_this->m2C4->getFrame() == 17 || (int)i_this->m2C4->getFrame() == 37) { + if ((int)i_this->mpHeadDeadMorf->getFrame() == 17 || (int)i_this->mpHeadDeadMorf->getFrame() == 37) { bVar5 = true; fopAcM_monsSeStart(actor, JA_SE_CV_BKM_JITABATA, 0); } i_this->mA8C = 10; - if (i_this->m2C4->isStop()) { - i_this->m2C4->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_COA_LDEAD), J3DFrameCtrl::EMode_NONE, 1.0f, 1.0f, 0.0f, -1.0f, NULL); - i_this->m306 = 0x69; - i_this->m930.z = 0.0f; - i_this->m930.x = 0.0f; + if (!i_this->mpHeadDeadMorf->isStop()) { + goto temp_884; } - break; + i_this->mpHeadDeadMorf->setAnm( + (J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_COA_LDEAD), J3DFrameCtrl::EMode_NONE, 1.0f, 1.0f, 0.0f, -1.0f, NULL + ); + i_this->m306 = 0x69; + i_this->m930.z = 0.0f; + i_this->m930.x = 0.0f; + goto temp_884; case 105: - if ((s16)i_this->m2C4->getFrame() == 37) { + if ((int)i_this->mpHeadDeadMorf->getFrame() == 37) { pJVar7 = dComIfGp_particle_set(dPa_name::ID_AK_SN_BKMCORESIGH00, &actor->current.pos); if (pJVar7 != NULL) { - pJVar7->setGlobalRTMatrix(i_this->m2C4->getModel()->getAnmMtx(5)); + pJVar7->setGlobalRTMatrix(i_this->mpHeadDeadMorf->getModel()->getAnmMtx(5)); } fopAcM_monsSeStart(actor, JA_SE_CV_BKM_DIE, 0); } - if (i_this->m2C4->isStop()) { + if (i_this->mpHeadDeadMorf->isStop()) { local_58 = i_this->m924; local_58.y += REG0_F(2) + 80.0f; - fopAcM_createDisappear(actor, &local_58, 0xF, daDisItem_HEART_CONTAINER_e, 0xFF); + fopAcM_createDisappear(actor, &local_58, 15, daDisItem_HEART_CONTAINER_e); i_this->m306 = 0x6e; i_this->m308[2] = 0xaa; } + temp_884: i_this->m924 += i_this->m930; if ((i_this->m308[1] & 0xF) == 0) { i_this->m930.x *= -1.0f; @@ -768,19 +780,19 @@ void core_move(bmd_class* i_this) { MtxPosition(&local_40, &local_4c); i_this->m90C[0].x = local_4c.z; i_this->m90C[0].z = local_4c.x; - local_40.z = i_this->m920 * cM_ssin(i_this->m918 + (REG0_S(6) - 20000)); + local_40.z = i_this->m920 * cM_ssin((i_this->m918 - 20000) + REG0_S(6)); MtxPosition(&local_40, &local_4c); i_this->m90C[1].x = local_4c.z; i_this->m90C[1].z = local_4c.x; i_this->m918 += REG0_S(5) + 6000; - cLib_addCalc0(&i_this->m91C, 1.0f, (REG0_F(10) + 250.0f)); - cLib_addCalc0(&i_this->m920, 1.0f, (REG0_F(10) + 200.0f)); - pJVar11 = i_this->m2C0->getModel(); + cLib_addCalc0(&i_this->m91C, 1.0f, REG0_F(10) + 250.0f); + cLib_addCalc0(&i_this->m920, 1.0f, REG0_F(10) + 200.0f); + pJVar11 = i_this->mpHeadMorf->getModel(); mDoMtx_stack_c::transS(actor->current.pos.x, actor->current.pos.y, actor->current.pos.z); mDoMtx_stack_c::YrotM(i_this->m93C); pJVar11->setBaseTRMtx(mDoMtx_stack_c::get()); - i_this->m2C0->play(&actor->eyePos, 0, 0); - i_this->m2C0->calc(); + i_this->mpHeadMorf->play(&actor->eyePos, 0, 0); + i_this->mpHeadMorf->calc(); MTXCopy(pJVar11->getAnmMtx(6), *calc_mtx); local_40.x = 0.0f; local_40.y = -20.0f; @@ -800,10 +812,10 @@ void core_move(bmd_class* i_this) { mDoMtx_stack_c::transS(i_this->m924.x, i_this->m924.y, i_this->m924.z); mDoMtx_stack_c::YrotM(i_this->m93C); mDoMtx_stack_c::XrotM(i_this->m93E); - pJVar11 = i_this->m2C4->getModel(); + pJVar11 = i_this->mpHeadDeadMorf->getModel(); pJVar11->setBaseTRMtx(mDoMtx_stack_c::get()); - i_this->m2C4->play(&actor->eyePos, 0, 0); - i_this->m2C4->calc(); + i_this->mpHeadDeadMorf->play(&actor->eyePos, 0, 0); + i_this->mpHeadDeadMorf->calc(); MTXCopy(pJVar11->getAnmMtx(REG0_S(4) + 1), *calc_mtx); local_40.z = 0.0f; local_40.y = 0.0f; @@ -817,7 +829,7 @@ void core_move(bmd_class* i_this) { i_this->mCoreSph.SetR(50.0f); dComIfG_Ccsp()->Set(&i_this->mCoreSph); if (bVar5) { - dComIfGp_particle_setToon(dPa_name::ID_AK_ST_BKMCOREDEADSMOKE00, &i_this->m924, NULL, NULL, 0xB9, &i_this->mA90[6], (u8)actor->current.roomNo); + dComIfGp_particle_setToon(dPa_name::ID_AK_ST_BKMCOREDEADSMOKE00, &i_this->m924, NULL, NULL, 0xB9, &i_this->mSmokeCb[6], (u8)actor->current.roomNo); mDoAud_seStart(JA_SE_CM_BKM_END_CORE_LEAP, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } } @@ -831,7 +843,6 @@ void mk_voice_set(bmd_class* i_this, u32 param_2) { /* 00002F40-0000330C .text mk_move__FP9bmd_class */ void mk_move(bmd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - JPABaseEmitter* pJVar3; cXyz local_28; if (i_this->m2DC != 0) { @@ -841,7 +852,9 @@ void mk_move(bmd_class* i_this) { break; case 1: if (i_this->m308[3] == 0) { - i_this->m2C8->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_CALL_01), J3DFrameCtrl::EMode_LOOP, 5.0f, 1.0f, 0.0f, -1.0f, NULL); + i_this->mpMakarMorf->setAnm( + (J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_CALL_01), J3DFrameCtrl::EMode_LOOP, 5.0f, 1.0f, 0.0f, -1.0f, NULL + ); i_this->m308[3] = (s16)(cM_rndF(90.0f) + 60.0f); i_this->m2DC = 2; mk_voice_set(i_this, JA_SE_CV_CB_HELP); @@ -849,38 +862,42 @@ void mk_move(bmd_class* i_this) { break; case 2: if (i_this->m308[3] == 0) { - i_this->m2C8->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_CALL_02), J3DFrameCtrl::EMode_LOOP, 5.0f, 1.0f, 0.0f, -1.0f, NULL); + i_this->mpMakarMorf->setAnm( + (J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_CALL_02), J3DFrameCtrl::EMode_LOOP, 5.0f, 1.0f, 0.0f, -1.0f, NULL + ); i_this->m308[3] = (s16)(cM_rndF(90.0f) + 60.0f); i_this->m2DC = 1; mk_voice_set(i_this, JA_SE_CV_CB_HELP); } break; case 3: - i_this->m2C8->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_CALL_01), J3DFrameCtrl::EMode_LOOP, 5.0f, 1.0f, 0.0f, -1.0f, NULL); + i_this->mpMakarMorf->setAnm( + (J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_CALL_01), J3DFrameCtrl::EMode_LOOP, 5.0f, 1.0f, 0.0f, -1.0f, NULL + ); i_this->m2DC = 10; mk_voice_set(i_this, JA_SE_CV_CB_HELP); break; case 4: - i_this->m2C8->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_CALL_03), J3DFrameCtrl::EMode_LOOP, 5.0f, 1.0f, 0.0f, -1.0f, NULL); + i_this->mpMakarMorf->setAnm( + (J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_CALL_03), J3DFrameCtrl::EMode_LOOP, 5.0f, 1.0f, 0.0f, -1.0f, NULL + ); i_this->m2DC = 10; mk_voice_set(i_this, JA_SE_CV_CB_HELP); break; case 5: - i_this->m2C8->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_DROP), J3DFrameCtrl::EMode_NONE, 1.0f, 1.0f, 0.0f, -1.0f, NULL); + i_this->mpMakarMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_DROP), J3DFrameCtrl::EMode_NONE, 1.0f, 1.0f, 0.0f, -1.0f, NULL); i_this->m2DC = 6; break; case 6: - if ((int)i_this->m2C8->getFrame() == 6) { + if ((int)i_this->mpMakarMorf->getFrame() == 6) { local_28 = i_this->m2E0; local_28.y += 10.0f; - pJVar3 = dComIfGp_particle_setToon(dPa_name::ID_AK_ST_BKMCOREDEADSMOKE00, &local_28, NULL, NULL, 0xB9, &i_this->mA90[6], (u8)actor->current.roomNo); - if (pJVar3 != NULL) { - pJVar3->mGlobalDynamicsScale.x = 0.5f; - pJVar3->mGlobalDynamicsScale.y = 0.5f; - pJVar3->mGlobalDynamicsScale.z = 0.5f; - pJVar3->mGlobalParticleScale.x = 0.5f; - pJVar3->mGlobalParticleScale.y = 0.5f; - pJVar3->mGlobalParticleScale.z = 0.5f; + JPABaseEmitter* emitter = dComIfGp_particle_setToon( + dPa_name::ID_AK_ST_BKMCOREDEADSMOKE00, &local_28, NULL, NULL, 0xB9, &i_this->mSmokeCb[6], (u8)actor->current.roomNo + ); + if (emitter != NULL) { + JGeometry::TVec3 scale(0.5f, 0.5f, 0.5f); + emitter->setGlobalScale(scale); } mk_voice_set(i_this, JA_SE_CV_CB_SAVED); } @@ -893,9 +910,9 @@ void mk_move(bmd_class* i_this) { } mDoMtx_stack_c::transS(i_this->m2E0.x, i_this->m2E0.y, i_this->m2E0.z); mDoMtx_stack_c::YrotM(i_this->m2FA); - i_this->m2C8->getModel()->setBaseTRMtx(mDoMtx_stack_c::get()); - i_this->m2C8->play(NULL, 0, 0); - i_this->m2C8->calc(); + i_this->mpMakarMorf->getModel()->setBaseTRMtx(mDoMtx_stack_c::get()); + i_this->mpMakarMorf->play(NULL, 0, 0); + i_this->mpMakarMorf->calc(); } } @@ -950,8 +967,9 @@ void wait(bmd_class* i_this) { MtxPosition(&local_30, &local_3c); i_this->m318 = player->current.pos + local_3c; } - case 1: - cLib_addCalc2(&actor->speedF, i_this->m331 * 0.15f, 1.0f, 0.1f); + case 1: { + f32 tmp = i_this->m331 * 0.15f; + cLib_addCalc2(&actor->speedF, tmp, 1.0f, 0.1f); local_30 = i_this->m318 - actor->current.pos; cLib_addCalcAngleS2(&actor->current.angle.y, cM_atan2s(local_30.x, local_30.z), 0x10, 0x800); fVar7 = std::sqrtf(local_30.x * local_30.x + local_30.z * local_30.z); @@ -960,6 +978,7 @@ void wait(bmd_class* i_this) { i_this->m308[0] = (s16)(int)(cM_rndF(150.0f) + 150.0f); } break; + } case 2: i_this->m330 = 1; cLib_addCalc0(&actor->speedF, 1.0f, 0.1f); @@ -1074,7 +1093,7 @@ void move(bmd_class* i_this) { if (i_this->mMode != 3) { fVar1 = 0.0f; if (0 < i_this->m331) { - fVar1 = REG0_F(18) + (i_this->m331 * (REG0_F(17) + 2.5f) + 250.0f); + fVar1 = REG0_F(18) + (i_this->m331 * (REG0_F(17) + VERSION_SELECT(5.0f, 5.0f, 2.5f, 2.5f)) + VERSION_SELECT(200.0f, 200.0f, 250.0f, 250.0f)); if (i_this->mMode == 10) { fVar1 += 100.0f; } @@ -1092,12 +1111,12 @@ static u16 eff_joint[] = {0x0008, 0x0009, 0x0004}; /* 00003BDC-00003D48 .text eff_cont__FP9bmd_class */ void eff_cont(bmd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->mA7C); i++) { + for (s32 i = 0; i < ARRAY_SSIZE(i_this->mA7C); i++) { if (i_this->mA7C[i] != NULL) { if (i >= 2) { - i_this->mA7C[i]->setGlobalRTMatrix(i_this->m2C4->getModel()->getAnmMtx(eff_joint[i])); + i_this->mA7C[i]->setGlobalRTMatrix(i_this->mpHeadDeadMorf->getModel()->getAnmMtx(eff_joint[i])); } else { - i_this->mA7C[i]->setGlobalRTMatrix(i_this->m2C0->getModel()->getAnmMtx(eff_joint[i])); + i_this->mA7C[i]->setGlobalRTMatrix(i_this->mpHeadMorf->getModel()->getAnmMtx(eff_joint[i])); } if (i_this->mA88[i] != 0) { i_this->mA88[i]--; @@ -1133,7 +1152,7 @@ void ride_call_back(dBgW* bgw, fopAc_ac_c* i_ac, fopAc_ac_c* i_pt) { /* 00003E38-000054D4 .text demo_camera__FP9bmd_class */ void demo_camera(bmd_class* i_this) { - /* Nonmatching - switch case, regalloc */ + /* Nonmatching - regalloc */ fopAc_ac_c* actor = &i_this->actor; cXyz local_44; cXyz local_50; @@ -1153,7 +1172,11 @@ void demo_camera(bmd_class* i_this) { actor->eventInfo.onCondition(dEvtCnd_UNK2_e); i_this->mB76 = 0; i_this->mB78 = 0; +#if VERSION == VERSION_DEMO + break; +#else return; +#endif } i_this->mB74++; camera_class* camera2 = dComIfGp_getCamera(0); @@ -1196,7 +1219,7 @@ void demo_camera(bmd_class* i_this) { i_this->mB78 = 0; break; } - i_this->mB74 = i_this->mB74 + 1; + i_this->mB74++; camera->mCamera.Stop(); camera->mCamera.SetTrimSize(2); i_this->mB9C = 60.0f; @@ -1209,9 +1232,7 @@ void demo_camera(bmd_class* i_this) { i_this->mB88.x = -87.0f; i_this->mB88.y = 58.0f; i_this->mB88.z = 102.0f; - local_50.x = REG0_F(7) + 61.0f; - local_50.y = 0.0f; - local_50.z = REG0_F(8) + 492.0f; + local_50.set(REG0_F(7) + 61.0f, 0.0f, REG0_F(8) + 492.0f); player->setPlayerPosAndAngle(&local_50, -0x75fb); if (i_this->mB78 == 0x1e) { i_this->mB78 = 0; @@ -1257,15 +1278,17 @@ void demo_camera(bmd_class* i_this) { case 9: cLib_addCalc2(&i_this->mB88.y, actor->eyePos.y + 30.0f, 0.2f, REG0_F(4) + 5.0f); if (i_this->mB78 == 0x1e) { - i_this->m2C0->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_NEW_SDEMO1), J3DFrameCtrl::EMode_NONE, 1.0f, 1.0f, 0.0f, -1.0f, NULL); + i_this->mpHeadMorf->setAnm( + (J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_NEW_SDEMO1), J3DFrameCtrl::EMode_NONE, 1.0f, 1.0f, 0.0f, -1.0f, NULL + ); mDoAud_seStart(JA_SE_CM_BKM_CORE_ENTER, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); fopAcM_monsSeStart(actor, JA_SE_CV_BKM_ENTER, 0); } if (i_this->mB78 > 0x1e) { - if (i_this->m2C0->isStop()) { + if (i_this->mpHeadMorf->isStop()) { i_this->mB78 = 0; i_this->mB74++; - i_this->m2C0->setAnm( + i_this->mpHeadMorf->setAnm( (J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_NEW_SDEMO2), J3DFrameCtrl::EMode_LOOP, 1.0f, 1.0f, 0.0f, -1.0f, NULL ); } @@ -1298,17 +1321,17 @@ void demo_camera(bmd_class* i_this) { i_this->mB88.y = 164.0f; i_this->mB88.z = 104.0f; if (i_this->mB78 == 0x1e) { - i_this->m2C0->setAnm( - (J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_NEW_SDEMO3), J3DFrameCtrl::EMode_NONE, (REG0_F(16) + 4.0f), 1.0f, 0.0f, -1.0f, NULL + i_this->mpHeadMorf->setAnm( + (J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_NEW_SDEMO3), J3DFrameCtrl::EMode_NONE, REG0_F(16) + 4.0f, 1.0f, 0.0f, -1.0f, NULL ); } - if (0x1b < i_this->mB78) { - if (i_this->m2C0->isStop()) { + if (i_this->mB78 > 0x1b) { + if (i_this->mpHeadMorf->isStop()) { i_this->mB78 = 0; i_this->mB74++; i_this->m2DC = 0; mk_voice_set(i_this, 0x48c6); - i_this->m2C0->setAnm( + i_this->mpHeadMorf->setAnm( (J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_NEW_SDEMO4), J3DFrameCtrl::EMode_NONE, 1.0f, 1.0f, 0.0f, -1.0f, NULL ); i_this->mB88 = actor->eyePos; @@ -1328,24 +1351,24 @@ void demo_camera(bmd_class* i_this) { player->changeDemoMode(daPy_demo_c::DEMO_SURPRISED_e); player->voiceStart(0x31); } - i_this->m2C0->setPlaySpeed(0.0f); + i_this->mpHeadMorf->setPlaySpeed(0.0f); if (i_this->mB78 == 0x28) { i_this->mB7C.x = -139.0f; i_this->mB7C.y = 125.0f; i_this->mB7C.z = 475.0f; i_this->mB88 = actor->eyePos; i_this->mB88.y += REG0_F(15) + 60.0f; - i_this->m2C0->setPlaySpeed(1.0f); + i_this->mpHeadMorf->setPlaySpeed(1.0f); } } else { cLib_addCalc2(&i_this->mB9C, REG0_F(12) + 35.0f, 0.2f, REG0_F(13) + 1.0f); cLib_addCalc2(&i_this->mB88.x, actor->eyePos.x, 0.2f, REG0_F(4) + 10.0f); cLib_addCalc2(&i_this->mB88.y, actor->eyePos.y + 10.0f + REG0_F(14), 0.2f, REG0_F(4) + 10.0f); cLib_addCalc2(&i_this->mB88.z, actor->eyePos.z, 0.2f, REG0_F(4) + 10.0f); - if (i_this->m2C0->isStop()) { + if (i_this->mpHeadMorf->isStop()) { i_this->mB78 = REG0_S(6); i_this->m302 = 3; - i_this->m2C0->setAnm( + i_this->mpHeadMorf->setAnm( (J3DAnmTransform*)dComIfG_getObjectRes("Bmd", BMD_BCK_COA_START3), J3DFrameCtrl::EMode_LOOP, 1.0f, 1.0f, 0.0f, -1.0f, NULL ); i_this->m308[0] = 10; @@ -1397,7 +1420,7 @@ void demo_camera(bmd_class* i_this) { mDoAud_bgmStart(JA_BGM_KINDAN_BOSS); } i_this->mB71 = 1; - g_dComIfG_gameInfo.save.getMemory().getBit().onStageBossDemo(); + dComIfGs_onStageBossDemo(); } break; case 100: { @@ -1431,7 +1454,7 @@ void demo_camera(bmd_class* i_this) { cLib_addCalc2(&i_this->mB88.y, i_this->m924.y, 0.5f, 200.0f); cLib_addCalc2(&i_this->mB88.z, i_this->m924.z, 0.2f, 200.0f); } - cMtx_YrotS(*calc_mtx, actor->shape_angle.y + (REG0_S(4) + 3000)); + cMtx_YrotS(*calc_mtx, (actor->shape_angle.y + 3000) + REG0_S(4)); local_44.x = 0.0f; local_44.y = REG0_F(7) + 70.0f; local_44.z = REG0_F(6) + 500.0f + 300.0f + 200.0f; @@ -1443,21 +1466,21 @@ void demo_camera(bmd_class* i_this) { cLib_addCalc2(&i_this->mB7C.x, local_50.x, 0.5f, 200.0f); cLib_addCalc2(&i_this->mB7C.y, local_50.y, 0.8f, 200.0f); cLib_addCalc2(&i_this->mB7C.z, local_50.z, 0.5f, 200.0f); - if (0x3c < i_this->mB76) { - cMtx_YrotS(*calc_mtx, actor->shape_angle.y + (REG0_S(7) + 3000)); + if (i_this->mB76 > 0x3c) { + cMtx_YrotS(*calc_mtx, (actor->shape_angle.y + 3000) + REG0_S(7)); local_44.x = REG0_F(11) + 200.0f; local_44.y = 0.0f; local_44.z = 0.0f; MtxPosition(&local_44, &local_50); local_50 += actor->current.pos; - player->setPlayerPosAndAngle(&local_50, actor->shape_angle.y + (REG0_S(6) + 3000)); + player->setPlayerPosAndAngle(&local_50, (actor->shape_angle.y + 3000) + REG0_S(6)); } local_44.x = 0.0f; local_44.y = 0.0f; local_44.z = (REG0_F(6) + 500.0f + 300.0f + 200.0f) - 150.0f; MtxPosition(&local_44, &i_this->m2E0); i_this->m2E0 += actor->current.pos; - i_this->m2FA = actor->shape_angle.y + (REG0_S(4) + 3000); + i_this->m2FA = (actor->shape_angle.y + 3000) + REG0_S(4); break; case 102: { i_this->mB9C = REG0_F(8) + 55.0f; @@ -1474,13 +1497,13 @@ void demo_camera(bmd_class* i_this) { // Fall-through } case 103: { - s16 iVar6 = i_this->mBA0 * 22384.0f; - cLib_addCalcAngleS2(&i_this->mB96, (s16)(actor->shape_angle.y + REG0_S(2)) + 0x5770, 0x10, iVar6); - s16 r5 = i_this->mBA0 * 3000.0f; - cLib_addCalcAngleS2(&i_this->mB94, -5000, 0x10, r5); + s16 r6 = i_this->mBA0 * 22384.0f; + cLib_addCalcAngleS2(&i_this->mB96, (actor->shape_angle.y + 0x5770) + REG0_S(2), 0x10, r6); + r6 = i_this->mBA0 * 3000.0f; + cLib_addCalcAngleS2(&i_this->mB94, -5000, 0x10, r6); cLib_addCalc2(&i_this->mBA4, 500.0f, 0.0625f, i_this->mBA0 * 1000.0f); cLib_addCalc2(&i_this->mBA0, REG0_F(10) + 0.0048f, 0.1f, 4.8e-05f); - cMtx_YrotS(*calc_mtx, (int)i_this->mB96); + cMtx_YrotS(*calc_mtx, i_this->mB96); cMtx_XrotM(*calc_mtx, i_this->mB94); local_44.y = 0.0f; local_44.x = 0.0f; @@ -1515,7 +1538,7 @@ void demo_camera(bmd_class* i_this) { local_b0.z = i_this->mB88.z; s16 iVar6 = i_this->mBA8 * cM_scos(i_this->m2FE * 0x1c00) * 7.5f; camera->mCamera.Set(local_b0, local_a4, iVar6, i_this->mB9C); - cLib_addCalc0(&i_this->mBA8, 1.0f, (REG0_F(16) + 2.0f)); + cLib_addCalc0(&i_this->mBA8, 1.0f, REG0_F(16) + 2.0f); JUTReport(0x1e, 0x1ae, "K MAIN COUNT %d", (int)i_this->mB76); JUTReport(0x19a, 0x1ae, "K SUB COUNT %d", (int)i_this->mB78); i_this->mB78++; @@ -1558,7 +1581,7 @@ static BOOL daBmd_Execute(bmd_class* i_this) { #endif i_this->m2FE++; i_this->m330 = 0; - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m308); i++) { + for (s32 i = 0; i < ARRAY_SSIZE(i_this->m308); i++) { if (i_this->m308[i] != 0) { i_this->m308[i]--; } @@ -1581,27 +1604,27 @@ static BOOL daBmd_Execute(bmd_class* i_this) { mDoMtx_stack_c::YrotM(actor->shape_angle.y); mDoMtx_stack_c::XrotM(actor->shape_angle.x); mDoMtx_stack_c::ZrotM(actor->shape_angle.z); - i_this->mpMorf->getModel()->setBaseTRMtx(mDoMtx_stack_c::get()); + i_this->mpBodyMorf->getModel()->setBaseTRMtx(mDoMtx_stack_c::now); MTXCopy(mDoMtx_stack_c::now, *calc_mtx); if ((0 < i_this->m940) || (i_this->m314 != 0)) { MtxScale(0.0f, 0.0f, 0.0f, true); } MTXCopy(*calc_mtx, i_this->mA34); i_this->pm_bgw[5]->Move(); - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m944); i++) { + for (s32 i = 0; i < ARRAY_SSIZE(i_this->m944); i++) { MTXCopy(mDoMtx_stack_c::now, *calc_mtx); cMtx_YrotM(*calc_mtx, (i * 13107.2f) + REG0_F(11)); - MtxTrans((REG0_F(4) - 200.0f), 0.0f, 0.0f, true); + MtxTrans(REG0_F(4) - 200.0f, 0.0f, 0.0f, true); cMtx_ZrotM(*calc_mtx, i_this->m940); - MtxTrans(-(REG0_F(4) - 200.0f), (15.0f + REG0_F(5)), REG0_F(6), true); + MtxTrans(-(REG0_F(4) - 200.0f), 15.0f + REG0_F(5), REG0_F(6), true); if ((0 < i_this->m940) || (i_this->m314 != 0)) { MtxScale(0.0f, 0.0f, 0.0f, true); } MTXCopy(*calc_mtx, i_this->m944[i]); i_this->pm_bgw[i]->Move(); } - i_this->mpMorf->play(&actor->eyePos, 0, 0); - i_this->mpMorf->calc(); + i_this->mpBodyMorf->play(&actor->eyePos, 0, 0); + i_this->mpBodyMorf->calc(); if (i_this->mB70 != 0) { i_this->mpBrkAnm->play(); i_this->mpBtkAnm->play(); @@ -1659,8 +1682,8 @@ static BOOL daBmd_Execute(bmd_class* i_this) { } } mDoMtx_stack_c::transS(0.0f, 0.1f, 0.0f); - i_this->m2D0->setBaseTRMtx(mDoMtx_stack_c::get()); - i_this->m2D4->setFrame(i_this->m2D8); + i_this->mpR00_EFModel->setBaseTRMtx(mDoMtx_stack_c::get()); + i_this->mpR00_EFBrk->setFrame(i_this->m2D8); return TRUE; } @@ -1674,15 +1697,15 @@ static BOOL daBmd_Delete(bmd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; dComIfG_resDeleteDemo(&i_this->mPhs, "Bmd"); mDoHIO_deleteChild(l_HIO.mNo); - if (actor->heap != NULL) { - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->pm_bgw); i++) { + if (VERSION == VERSION_DEMO || actor->heap != NULL) { + for (s32 i = 0; i < ARRAY_SSIZE(i_this->pm_bgw); i++) { if (i_this->pm_bgw[i] != NULL) { dComIfG_Bgsp()->Release(i_this->pm_bgw[i]); } } } - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->mA90); i++) { - i_this->mA90[i].remove(); + for (s32 i = 0; i < ARRAY_SSIZE(i_this->mSmokeCb); i++) { + i_this->mSmokeCb[i].remove(); } dKyw_pntwind_cut(&i_this->mWindInfluence); mDoAud_seDeleteObject(&i_this->m2E0); @@ -1691,16 +1714,7 @@ static BOOL daBmd_Delete(bmd_class* i_this) { /* 00005CF4-000064C0 .text useHeapInit__FP9bmd_class */ BOOL useHeapInit(bmd_class* i_this) { - J3DModelData* pJVar2; - mDoExt_McaMorf* morf; - J3DAnmTevRegKey* pJVar5; - int iVar6; - J3DAnmTextureSRTKey* pAnm; - dBgW* bgw; - cBgD_t* pcVar9; - J3DModel* pJVar13; - - morf = new mDoExt_McaMorf( + i_this->mpBodyMorf = new mDoExt_McaMorf( (J3DModelData*)dComIfG_getObjectRes("Bmd", BMD_BMD_BKM), NULL, NULL, @@ -1714,32 +1728,33 @@ BOOL useHeapInit(bmd_class* i_this) { 0, 0x11020203 ); - i_this->mpMorf = morf; - pJVar13 = i_this->mpMorf->getModel(); - if (pJVar13 == NULL) { - return FALSE; - } else if (i_this->mpMorf == NULL) { + J3DModel* model = i_this->mpBodyMorf->getModel(); + if (model == NULL) { return FALSE; } +#if VERSION > VERSION_DEMO + else if (i_this->mpBodyMorf == NULL) + { + return FALSE; + } +#endif i_this->mpBrkAnm = new mDoExt_brkAnm(); if (i_this->mpBrkAnm == NULL) { return FALSE; } - pJVar5 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bmd", BMD_BRK_BKM); - iVar6 = i_this->mpBrkAnm->init(pJVar13->getModelData(), pJVar5, true, J3DFrameCtrl::EMode_NONE); - if (iVar6 == 0) { + J3DAnmTevRegKey* pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bmd", BMD_BRK_BKM); + if (!i_this->mpBrkAnm->init(model->getModelData(), pBrk, true, J3DFrameCtrl::EMode_NONE)) { return FALSE; } i_this->mpBtkAnm = new mDoExt_btkAnm(); if (i_this->mpBtkAnm == NULL) { return FALSE; } - pAnm = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bmd", BMD_BTK_BKM); - iVar6 = i_this->mpBtkAnm->init(pJVar13->getModelData(), pAnm, true, J3DFrameCtrl::EMode_NONE); - if (iVar6 == 0) { + J3DAnmTextureSRTKey* pBtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bmd", BMD_BTK_BKM); + if (!i_this->mpBtkAnm->init(model->getModelData(), pBtk, true, J3DFrameCtrl::EMode_NONE)) { return FALSE; } - morf = new mDoExt_McaMorf( + i_this->mpHeadMorf = new mDoExt_McaMorf( (J3DModelData*)dComIfG_getObjectRes("Bmd", BMD_BMD_BKM_COA), NULL, NULL, @@ -1753,16 +1768,15 @@ BOOL useHeapInit(bmd_class* i_this) { 0, 0x11020203 ); - i_this->m2C0 = morf; - pJVar13 = i_this->m2C0->getModel(); - if (pJVar13 == NULL) { + model = i_this->mpHeadMorf->getModel(); + if (model == NULL) { return FALSE; } - pJVar13->setUserArea((u32)i_this); - for (u16 uVar16 = 0; uVar16 < pJVar13->getModelData()->getJointNum(); uVar16++) { - pJVar13->getModelData()->getJointNodePointer(uVar16)->setCallBack(core_nodeCallBack); + model->setUserArea((u32)i_this); + for (u16 uVar16 = 0; uVar16 < model->getModelData()->getJointNum(); uVar16++) { + model->getModelData()->getJointNodePointer(uVar16)->setCallBack(core_nodeCallBack); } - morf = new mDoExt_McaMorf( + i_this->mpHeadDeadMorf = new mDoExt_McaMorf( (J3DModelData*)dComIfG_getObjectRes("Bmd", BMD_BMD_BKM_COA_DEADMODEL), NULL, NULL, @@ -1776,33 +1790,42 @@ BOOL useHeapInit(bmd_class* i_this) { 0, 0x11020203 ); - i_this->m2C4 = morf; - if (i_this->m2C4->getModel() == NULL) { + if (i_this->mpHeadDeadMorf->getModel() == NULL) { return FALSE; } - bgw = new dBgW(); - i_this->pm_bgw[5] = bgw; - JUT_ASSERT(0xf41, i_this->pm_bgw[5] != 0); + i_this->pm_bgw[5] = new dBgW(); + JUT_ASSERT(VERSION_SELECT(3834, 3902, 3905, 3905), i_this->pm_bgw[5] != 0); +#if VERSION >= VERSION_USA if (i_this->pm_bgw[5] == NULL) { return FALSE; } - pcVar9 = (cBgD_t*)dComIfG_getObjectRes("Bmd", BMD_DZB_COLL1); - i_this->pm_bgw[5]->Set(pcVar9, dBgW::MOVE_BG_e, &i_this->mA34); +#endif + i_this->pm_bgw[5]->Set((cBgD_t*)dComIfG_getObjectRes("Bmd", BMD_DZB_COLL1), dBgW::MOVE_BG_e, &i_this->mA34); i_this->pm_bgw[5]->SetCrrFunc(dBgS_MoveBGProc_Typical); i_this->pm_bgw[5]->SetRideCallback(ride_call_back); - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m944); i++) { - bgw = new dBgW(); - i_this->pm_bgw[i] = bgw; - JUT_ASSERT(0xf53, i_this->pm_bgw[i] != 0); +#if VERSION < VERSION_USA + if (dComIfG_Bgsp()->Regist(i_this->pm_bgw[5], &i_this->actor)) { + return FALSE; + } +#endif + for (s32 i = 0; i < ARRAY_SSIZE(i_this->m944); i++) { + i_this->pm_bgw[i] = new dBgW(); + JUT_ASSERT(VERSION_SELECT(3853, 3921, 3923, 3923), i_this->pm_bgw[i] != 0); +#if VERSION >= VERSION_USA if (i_this->pm_bgw[i] == 0) { return FALSE; } - pcVar9 = (cBgD_t*)dComIfG_getObjectRes("Bmd", BMD_DZB_COLL2); - i_this->pm_bgw[i]->Set(pcVar9, dBgW::MOVE_BG_e, &i_this->m944[i]); +#endif + i_this->pm_bgw[i]->Set((cBgD_t*)dComIfG_getObjectRes("Bmd", BMD_DZB_COLL2), dBgW::MOVE_BG_e, &i_this->m944[i]); i_this->pm_bgw[i]->SetCrrFunc(dBgS_MoveBGProc_Typical); i_this->pm_bgw[i]->SetRideCallback(ride_call_back); +#if VERSION < VERSION_USA + if (dComIfG_Bgsp()->Regist(i_this->pm_bgw[i], &i_this->actor)) { + return FALSE; + } +#endif } - morf = new mDoExt_McaMorf( + i_this->mpMakarMorf = new mDoExt_McaMorf( (J3DModelData*)dComIfG_getObjectRes("Bmd", BMD_BMD_CB), NULL, NULL, @@ -1816,29 +1839,25 @@ BOOL useHeapInit(bmd_class* i_this) { 0, 0x11020203 ); - i_this->m2C8 = morf; - if (i_this->m2C8->getModel() == NULL) { + if (i_this->mpMakarMorf->getModel() == NULL) { return FALSE; } - pJVar2 = (J3DModelData*)dComIfG_getObjectRes("Bmd", BMD_BMD_CB_FACE); - pJVar13 = mDoExt_J3DModel__create(pJVar2, 0, 0x11020203); - i_this->m2CC = pJVar13; - if (i_this->m2CC == NULL) { + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Bmd", BMD_BMD_CB_FACE); + i_this->mpMakarFaceModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203); + if (i_this->mpMakarFaceModel == NULL) { return FALSE; } - pJVar2 = (J3DModelData*)dComIfG_getObjectRes("Bmd", BMD_BDL_R00_EF); - pJVar13 = mDoExt_J3DModel__create(pJVar2, 0, 0x11020203); - i_this->m2D0 = pJVar13; - if (i_this->m2D0 == NULL) { + modelData = (J3DModelData*)dComIfG_getObjectRes("Bmd", BMD_BDL_R00_EF); + i_this->mpR00_EFModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203); + if (i_this->mpR00_EFModel == NULL) { return FALSE; } - i_this->m2D4 = new mDoExt_brkAnm(); - if (i_this->m2D4 == NULL) { + i_this->mpR00_EFBrk = new mDoExt_brkAnm(); + if (i_this->mpR00_EFBrk == NULL) { return FALSE; } - pJVar5 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bmd", BMD_BRK_R00_EF); - iVar6 = i_this->m2D4->init(pJVar2, pJVar5, true, J3DFrameCtrl::EMode_NONE, 0.0f, 0, -1, false, 0); - if (iVar6 == 0) { + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bmd", BMD_BRK_R00_EF); + if (!i_this->mpR00_EFBrk->init(modelData, pBrk, true, J3DFrameCtrl::EMode_NONE, 0.0f, 0, -1, false, 0)) { return FALSE; } return TRUE; @@ -1951,8 +1970,8 @@ static cPhs_State daBmd_Create(fopAc_ac_c* a_this) { if (res != cPhs_COMPLEATE_e) { return res; } - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->mA90); i++) { - i_this->mA90[i].setFollowOff(); + for (s32 i = 0; i < ARRAY_SSIZE(i_this->mSmokeCb); i++) { + i_this->mSmokeCb[i].setFollowOff(); } if (dComIfGs_isStageBossEnemy() && (dComIfGp_getStartStageName()[0] != 'X')) { if ((!dComIfGs_checkGetItem(dItem_PEARL_FARORE_e)) || (REG0_S(6) != 0)) { @@ -1965,8 +1984,8 @@ static cPhs_State daBmd_Create(fopAc_ac_c* a_this) { } else if (!fopAcM_entrySolidHeap(a_this, solidHeapCB, 0x96000)) { res = cPhs_ERROR_e; } else { -#if VERSION > VERSION_DEMO - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->pm_bgw); i++) { +#if VERSION >= VERSION_USA + for (s32 i = 0; i < ARRAY_SSIZE(i_this->pm_bgw); i++) { if (dComIfG_Bgsp()->Regist(i_this->pm_bgw[i], a_this) != false) { return cPhs_ERROR_e; } diff --git a/src/d/actor/d_a_bmdfoot.cpp b/src/d/actor/d_a_bmdfoot.cpp index 0feef851b..40596c149 100644 --- a/src/d/actor/d_a_bmdfoot.cpp +++ b/src/d/actor/d_a_bmdfoot.cpp @@ -59,86 +59,76 @@ static BOOL nodeCallBack(J3DNode* node, int calcTiming) { /* 000001D8-000002B0 .text daBmdfoot_Draw__FP13bmdfoot_class */ static BOOL daBmdfoot_Draw(bmdfoot_class* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; - J3DModel* pJVar1; if (i_this->mBC8 != 0) { - pJVar1 = i_this->m2B4->getModel(); + J3DModel* model = i_this->mpBodyVineMorf->getModel(); g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &actor->current.pos, &actor->tevStr); - g_env_light.setLightTevColorType(pJVar1, &actor->tevStr); - i_this->btk->entry(pJVar1->getModelData()); - i_this->m2B4->entryDL(); + g_env_light.setLightTevColorType(model, &actor->tevStr); + i_this->btk->entry(model->getModelData()); + i_this->mpBodyVineMorf->entryDL(); if (i_this->mBA8 >= 10) { - pJVar1 = i_this->mAF4->getModel(); - g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &i_this->mBAC, &i_this->mAF8); - g_env_light.setLightTevColorType(pJVar1, &i_this->mAF8); - i_this->mAF4->entryDL(); + model = i_this->mpFloorVineMorf->getModel(); + g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &i_this->mBAC, &i_this->mTevstr); + g_env_light.setLightTevColorType(model, &i_this->mTevstr); + i_this->mpFloorVineMorf->entryDL(); } } return TRUE; } /* 000002B0-000003D8 .text anm_init__FP13bmdfoot_classifUcfi */ -void anm_init(bmdfoot_class* i_this, int bckFileIdx, float morf, unsigned char loopMode, float speed, int soundFileIdx) { +void anm_init(bmdfoot_class* i_this, int bckFileIdx, f32 morf, unsigned char loopMode, f32 speed, int soundFileIdx) { if (soundFileIdx >= 0) { - i_this->m2B4->setAnm( - (J3DAnmTransform*)dComIfG_getObjectRes("Bmdfoot", bckFileIdx), - loopMode, morf, speed, 0.0f, -1.0f, - dComIfG_getObjectRes("Bmdfoot", soundFileIdx) + i_this->mpBodyVineMorf->setAnm( + (J3DAnmTransform*)dComIfG_getObjectRes("Bmdfoot", bckFileIdx), loopMode, morf, speed, 0.0f, -1.0f, dComIfG_getObjectRes("Bmdfoot", soundFileIdx) ); } else { - i_this->m2B4->setAnm( - (J3DAnmTransform*)dComIfG_getObjectRes("Bmdfoot", bckFileIdx), - loopMode, morf, speed, 0.0f, -1.0f, - NULL - ); + i_this->mpBodyVineMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bmdfoot", bckFileIdx), loopMode, morf, speed, 0.0f, -1.0f, NULL); } } /* 000003D8-00000440 .text housi_off__FP13bmdfoot_class */ void housi_off(bmdfoot_class* i_this) { - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m41C); i++) { - if (i_this->m41C[i].getEmitter() != NULL) { - i_this->m41C[i].getEmitter()->stopCreateParticle(); + for (s32 i = 0; i < ARRAY_SSIZE(i_this->mAsiWaitFollowCB); i++) { + if (i_this->mAsiWaitFollowCB[i].getEmitter() != NULL) { + i_this->mAsiWaitFollowCB[i].getEmitter()->stopCreateParticle(); } } - if (i_this->m4B0.getEmitter() != NULL) { - i_this->m4B0.remove(); + if (i_this->mLAttackSmoke01CB.getEmitter() != NULL) { + i_this->mLAttackSmoke01CB.remove(); } } /* 00000440-00000840 .text wait__FP13bmdfoot_class */ void wait(bmdfoot_class* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; - short sVar2; - int iVar3; cXyz local_98; static s32 eff_id[] = {0x0A, 0x0C, 0x11}; - s32 i; - iVar3 = i_this->m2B4->getFrame(); + int frame = i_this->mpBodyVineMorf->getFrame(); local_98.setall(0.0f); - - for (i = 0; i < (s32)ARRAY_SIZE(i_this->m3F8); i++) { - MTXCopy(i_this->m2B4->getModel()->getAnmMtx(eff_id[i]), *calc_mtx); + + for (s32 i = 0; i < ARRAY_SSIZE(i_this->m3F8); i++) { + MTXCopy(i_this->mpBodyVineMorf->getModel()->getAnmMtx(eff_id[i]), *calc_mtx); MtxPosition(&local_98, &i_this->m3F8[i]); if (i_this->m3F4 == 0) { - dComIfGp_particle_set(dPa_name::ID_AK_SN_BKMASIWAIT00, &i_this->m3F8[i], NULL, NULL, 0xFF, &i_this->m41C[i]); + dComIfGp_particle_set(dPa_name::ID_AK_SN_BKMASIWAIT00, &i_this->m3F8[i], NULL, NULL, 0xFF, &i_this->mAsiWaitFollowCB[i]); } - if (i_this->m41C[i].getEmitter() != NULL) { - if (iVar3 == 0) { - i_this->m41C[i].getEmitter()->playCreateParticle(); - } else if (iVar3 == 20) { - i_this->m41C[i].getEmitter()->stopCreateParticle(); + if (i_this->mAsiWaitFollowCB[i].getEmitter() != NULL) { + if (frame == 0) { + i_this->mAsiWaitFollowCB[i].getEmitter()->playCreateParticle(); + } else if (frame == 20) { + i_this->mAsiWaitFollowCB[i].getEmitter()->stopCreateParticle(); } } } - + i_this->m3F4 = 1; - + switch (i_this->m2BC) { case -1: - for (i = 2; i <= (s32)ARRAY_SIZE(i_this->m3A4); i++) { - cLib_addCalc2(&i_this->m2CC[i].x, (s32)(0x10U - i) * (0.003f + REG12_F(3)), 0.1f, (0.008f + REG12_F(4))); + for (s32 i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { + cLib_addCalc2(&i_this->m2CC[i].x, (s32)(0x10 - i) * (0.003f + REG12_F(3)), 0.1f, 0.008f + REG12_F(4)); i_this->m3A4[i] = 0.0f; } if (i_this->m2C0[2] == 0) { @@ -149,17 +139,17 @@ void wait(bmdfoot_class* i_this) { break; case 0: i_this->m2BC++; - anm_init(i_this, BMDFOOT_BCK_ASI_WAIT, 50.0f, J3DFrameCtrl::EMode_LOOP, (cM_rndF(0.2f) + 0.9f), -1); - i_this->m2C0[0] = (s16)(int)(cM_rndF(150.0f) + 100.0f); - i_this->m3EC = (s16)(int)cM_rndFX(32768.0f); - for (i = 2; i <= (s32)ARRAY_SIZE(i_this->m3A4); i++) { + anm_init(i_this, BMDFOOT_BCK_ASI_WAIT, 50.0f, J3DFrameCtrl::EMode_LOOP, cM_rndF(0.2f) + 0.9f, -1); + i_this->m2C0[0] = cM_rndF(150.0f) + 100.0f; + i_this->m3EC = cM_rndFX(32768.0f); + for (s32 i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { i_this->m3A4[i] = REG14_F(13) + (0.2f + cM_rndFX(0.1f)); } break; case 1: i_this->m3EC = (i_this->m3EC + (s16)(REG14_S(4) + 0x200)); if (boss->m332 == 1) { - sVar2 = actor->current.angle.y - fopAcM_searchPlayerAngleY(actor); + s16 sVar2 = actor->current.angle.y - fopAcM_searchPlayerAngleY(actor); if (sVar2 < 0) { sVar2 = -sVar2; } @@ -168,7 +158,7 @@ void wait(bmdfoot_class* i_this) { i_this->m2BA = 1; i_this->m2BC = 0; } else { - i_this->m2C0[0] = (s16)(int)(cM_rndF(50.0f) + 50.0f); + i_this->m2C0[0] = cM_rndF(50.0f) + 50.0f; } } else { if (boss->m332 == 2) { @@ -185,19 +175,15 @@ void wait(bmdfoot_class* i_this) { void attack_1(bmdfoot_class* i_this) { /* Nonmatching - retail-only regalloc */ fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; - bool bVar2; - short sVar3; - short sVar5; - J3DModel* pJVar9; s32 i; cXyz local_5c; cXyz cStack_68; static s32 jno[] = {0x0A, 0x0C, 0x11}; static s32 col_joint[] = {0x01, 0x03, 0x05, 0x07, 0x09}; - bVar2 = false; + bool bVar2 = false; local_5c.setall(0.0f); - + switch (i_this->m2BC) { case 0: i_this->m2C0[0] = cM_rndF(20.0f); @@ -214,7 +200,7 @@ void attack_1(bmdfoot_class* i_this) { if (i_this->mBD0 == 0) { i_this->mBD0 = 0x1e; } - if (i_this->m2B4->isStop()) { + if (i_this->mpBodyVineMorf->isStop()) { anm_init(i_this, BMDFOOT_BCK_ASI_ATTACK_LOOP, 5.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->m2C0[0] = 0x3c; i_this->m2BC++; @@ -224,7 +210,7 @@ void attack_1(bmdfoot_class* i_this) { if (i_this->mBD0 == 0) { i_this->mBD0 = 0x1e; } - for (i = 2; i <= (s32)ARRAY_SIZE(i_this->m3A4); i++) { + for (i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { i_this->m3A4[i] = 0.0f; cLib_addCalc0(&i_this->m2CC[i].z, 0.1f, 0.05f); } @@ -239,22 +225,23 @@ void attack_1(bmdfoot_class* i_this) { bVar2 = true; if (i_this->m2C0[0] == 1) { mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_ATTACK, &i_this->mAE8, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); - for (s32 i = 0; i < (s32)ARRAY_SIZE(jno); i++) { - MTXCopy(i_this->m2B4->getModel()->getAnmMtx(jno[i]), *calc_mtx); + for (s32 i = 0; i < ARRAY_SSIZE(jno); i++) { + MTXCopy(i_this->mpBodyVineMorf->getModel()->getAnmMtx(jno[i]), *calc_mtx); MtxPosition(&local_5c, &cStack_68); dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_BKMSATTACKHOUSHI00, &cStack_68, 0xFF, g_whiteColor, g_whiteColor, 0); } dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_BKMSATTACKSOIL00, &i_this->mAE8, 0xFF, g_whiteColor, g_whiteColor, 0); dComIfGp_particle_setSimple(dPa_name::ID_AK_ST_O_BKMSATTACKSMOKE00, &i_this->mAE8, 0xB9, g_whiteColor, g_whiteColor, 0); } - if (i_this->m2B4->isStop()) { + if (i_this->mpBodyVineMorf->isStop()) { i_this->m2BA = 0; i_this->m2BC = 0; } break; } - - sVar3 = fopAcM_searchPlayerAngleY(actor) - actor->current.angle.y; + + s16 sVar3 = fopAcM_searchPlayerAngleY(actor) - actor->current.angle.y; + s16 sVar5; if (sVar3 > l_HIO.m06) { sVar5 = l_HIO.m06; } else if (sVar3 < (s16)-l_HIO.m06) { @@ -264,17 +251,17 @@ void attack_1(bmdfoot_class* i_this) { } cLib_addCalcAngleS2(&i_this->m2BE, sVar5, 4, i_this->mBC4 + 128.0f); cLib_addCalc2(&i_this->mBC4, 10000.0f, 1.0f, REG0_F(7) + 20.0f); - + if (bVar2) { - pJVar9 = i_this->m2B4->getModel(); - for (i = 0; i < (s32)ARRAY_SIZE(i_this->m50C); i++) { - MTXCopy(pJVar9->getAnmMtx((i_this->m2B8 & 7U) + col_joint[i]), *calc_mtx); + J3DModel* model = i_this->mpBodyVineMorf->getModel(); + for (i = 0; i < ARRAY_SSIZE(i_this->mSph); i++) { + MTXCopy(model->getAnmMtx((i_this->m2B8 & 7U) + col_joint[i]), *calc_mtx); MtxPosition(&local_5c, &cStack_68); - i_this->m50C[i].SetC(cStack_68); - i_this->m50C[i].SetR(40.0f); - i_this->m50C[i].OnAtSetBit(); - i_this->m50C[i].OffCoSetBit(); - dComIfG_Ccsp()->Set(&i_this->m50C[i]); + i_this->mSph[i].SetC(cStack_68); + i_this->mSph[i].SetR(40.0f); + i_this->mSph[i].OnAtSetBit(); + i_this->mSph[i].OffCoSetBit(); + dComIfG_Ccsp()->Set(&i_this->mSph[i]); } } } @@ -282,16 +269,12 @@ void attack_1(bmdfoot_class* i_this) { /* 00000D8C-00001180 .text ug_move__FP13bmdfoot_class */ s32 ug_move(bmdfoot_class* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; - u32 uVar4; - f32 dVar5; - f32 dVar6; - float fVar7; cXyz local_4c; cXyz cStack_58; cXyz local_64; - daPy_py_c* apdVar3 = daPy_getPlayerActorClass(); - uVar4 = 0; + daPy_py_c* player = daPy_getPlayerActorClass(); + u32 uVar4 = 0; switch (i_this->mBA8) { case 0: break; @@ -301,20 +284,20 @@ s32 ug_move(bmdfoot_class* i_this) { i_this->mBB8.y = actor->current.angle.y; i_this->mBC0 = 0.0f; i_this->mBA8 = 2; - fVar7 = cM_rndF(10000.0f); - i_this->m2B8 = (s16)(int)fVar7; - dComIfGp_particle_setToon(dPa_name::ID_AK_ST_BKMLATTACKSMOKE01, &i_this->mBAC, &i_this->mBB8, NULL, 0xB9, &i_this->m4B0, (u8)actor->current.roomNo); + i_this->m2B8 = cM_rndF(10000.0f); + dComIfGp_particle_setToon( + dPa_name::ID_AK_ST_BKMLATTACKSMOKE01, &i_this->mBAC, &i_this->mBB8, NULL, 0xB9, &i_this->mLAttackSmoke01CB, (u8)actor->current.roomNo + ); break; case 0xa: break; case 2: - local_64 = apdVar3->current.pos - i_this->mBAC; - fVar7 = local_64.abs(); - dVar5 = (fVar7 * 10.0f); + local_64 = player->current.pos - i_this->mBAC; + f32 dVar5 = (local_64.abs() * 10.0f); if (dVar5 > (REG14_F(14) + 10000.0f)) { dVar5 = (REG14_F(14) + 10000.0f); } - dVar6 = cM_ssin(i_this->m2B8 * (REG14_S(3) + 2000)); + f32 dVar6 = cM_ssin(i_this->m2B8 * (REG14_S(3) + 2000)); s16 r28 = dVar5 * dVar6; s16 r4 = r28 + cM_atan2s(local_64.x, local_64.z); cLib_addCalcAngleS2(&i_this->mBB8.y, r4, 0x10, 0x2000); @@ -325,11 +308,10 @@ s32 ug_move(bmdfoot_class* i_this) { MtxPosition(&local_4c, &cStack_58); i_this->mBAC += cStack_58; i_this->mBC0 = i_this->mBC0 + local_4c.z; - fVar7 = local_64.abs(); - if ((fVar7 < 300.0f) || (i_this->mBC0 > REG14_F(15) + 3000.0f)) { + if ((local_64.abs() < 300.0f) || (i_this->mBC0 > REG14_F(15) + 3000.0f)) { i_this->mBA8 = 10; - if (i_this->m4B0.getEmitter() != NULL) { - i_this->m4B0.remove(); + if (i_this->mLAttackSmoke01CB.getEmitter() != NULL) { + i_this->mLAttackSmoke01CB.remove(); } uVar4 = 1; } @@ -337,17 +319,17 @@ s32 ug_move(bmdfoot_class* i_this) { } MtxTrans(i_this->mBAC.x, i_this->mBAC.y, i_this->mBAC.z, false); cMtx_YrotM(*calc_mtx, i_this->mBB8.y); - J3DModel* model = i_this->mAF4->getModel(); + J3DModel* model = i_this->mpFloorVineMorf->getModel(); model->setBaseTRMtx(*calc_mtx); - i_this->mAF4->play(NULL, 0, 0); - i_this->mAF4->calc(); + i_this->mpFloorVineMorf->play(NULL, 0, 0); + i_this->mpFloorVineMorf->calc(); return uVar4; } /* 00001180-00001B00 .text attack_2__FP13bmdfoot_class */ void attack_2(bmdfoot_class* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; - J3DAnmTransform* pJVar2; + J3DAnmTransform* pBck; cXyz local_3c; cXyz local_48; static s32 col_joint[] = {0x11, 0x0F, 0x0C, 0x09}; @@ -358,7 +340,7 @@ void attack_2(bmdfoot_class* i_this) { boss->m334 = 10; switch (i_this->m2BC) { case 0: - i_this->m2C0[0] = (s16)(int)cM_rndF(20.0f); + i_this->m2C0[0] = cM_rndF(20.0f); i_this->m2BC++; case 1: i_this->mBC4 = 0.0f; @@ -370,15 +352,15 @@ void attack_2(bmdfoot_class* i_this) { } break; case 2: - if ((s32)i_this->m2B4->getFrame() == 49) { - MTXCopy(i_this->m2B4->getModel()->getAnmMtx(0x11), *calc_mtx); + if ((s32)i_this->mpBodyVineMorf->getFrame() == 49) { + MTXCopy(i_this->mpBodyVineMorf->getModel()->getAnmMtx(0x11), *calc_mtx); MtxPosition(&local_3c, &local_48); dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_BKMSATTACKHOUSHI00, &local_48, 0xFF, g_whiteColor, g_whiteColor, 0); dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_BKMSATTACKSOIL00, &local_48, 0xFF, g_whiteColor, g_whiteColor, 0); dComIfGp_particle_setSimple(dPa_name::ID_AK_ST_O_BKMSATTACKSMOKE00, &local_48, 0xB9, g_whiteColor, g_whiteColor, 0); mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_IN_G, &i_this->mAE8, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } - if (i_this->m2B4->isStop()) { + if (i_this->mpBodyVineMorf->isStop()) { anm_init(i_this, BMDFOOT_BCK_ASI_UMARU_WAIT, 10.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->m2BC++; i_this->mBA8 = 1; @@ -387,13 +369,13 @@ void attack_2(bmdfoot_class* i_this) { case 3: mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_DIG, &i_this->mBAC, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); if (ug_move(i_this)) { - pJVar2 = (J3DAnmTransform*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BCK_ASI_DATTACK1); - i_this->mAF4->setAnm(pJVar2, J3DFrameCtrl::EMode_NONE, 1.0f, 1.0f, 0.0f, -1.0f, NULL); + pBck = (J3DAnmTransform*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BCK_ASI_DATTACK1); + i_this->mpFloorVineMorf->setAnm(pBck, J3DFrameCtrl::EMode_NONE, 1.0f, 1.0f, 0.0f, -1.0f, NULL); i_this->m2BC++; } break; case 4: - if ((s32)i_this->mAF4->getFrame() == 2) { + if ((s32)i_this->mpFloorVineMorf->getFrame() == 2) { local_48 = i_this->mBAC; dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_BKMSATTACKHOUSHI00, &local_48, 0xFF, g_whiteColor, g_whiteColor, 0); dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_BKMSATTACKSOIL00, &local_48, 0xFF, g_whiteColor, g_whiteColor, 0); @@ -401,9 +383,9 @@ void attack_2(bmdfoot_class* i_this) { mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_OUT_G, &i_this->mBAC, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } ug_move(i_this); - if (i_this->mAF4->isStop()) { - pJVar2 = (J3DAnmTransform*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BCK_ASI_DATTACK2); - i_this->mAF4->setAnm(pJVar2, J3DFrameCtrl::EMode_LOOP, 1.0f, 1.0f, 0.0f, -1.0f, NULL); + if (i_this->mpFloorVineMorf->isStop()) { + pBck = (J3DAnmTransform*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BCK_ASI_DATTACK2); + i_this->mpFloorVineMorf->setAnm(pBck, J3DFrameCtrl::EMode_LOOP, 1.0f, 1.0f, 0.0f, -1.0f, NULL); i_this->m2C0[0] = 0xb4; i_this->m2BC++; } @@ -411,31 +393,33 @@ void attack_2(bmdfoot_class* i_this) { case 5: ug_move(i_this); mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_L_ATK, &i_this->mBAC, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); - for (s32 i = 0; i < (s32)ARRAY_SIZE(col_joint); i++) { - MTXCopy(i_this->mAF4->getModel()->getAnmMtx(col_joint[i]), *calc_mtx); + for (s32 i = 0; i < ARRAY_SSIZE(col_joint); i++) { + MTXCopy(i_this->mpFloorVineMorf->getModel()->getAnmMtx(col_joint[i]), *calc_mtx); MtxPosition(&local_3c, &local_48); - i_this->m50C[i].SetC(local_48); - i_this->m50C[i].SetR(40.0f); - dComIfG_Ccsp()->Set(&i_this->m50C[i]); + i_this->mSph[i].SetC(local_48); + i_this->mSph[i].SetR(40.0f); + dComIfG_Ccsp()->Set(&i_this->mSph[i]); } if (i_this->m2C0[0] == 0) { - pJVar2 = (J3DAnmTransform*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BCK_ASI_DATTACK3); - i_this->mAF4->setAnm(pJVar2, J3DFrameCtrl::EMode_NONE, 1.0f, 1.0f, 0.0f, -1.0f, NULL); + pBck = (J3DAnmTransform*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BCK_ASI_DATTACK3); + i_this->mpFloorVineMorf->setAnm(pBck, J3DFrameCtrl::EMode_NONE, 1.0f, 1.0f, 0.0f, -1.0f, NULL); i_this->m2BC++; } break; case 6: ug_move(i_this); - if ((s32)i_this->mAF4->getFrame() == 12) { + if ((s32)i_this->mpFloorVineMorf->getFrame() == 12) { dComIfGp_particle_set(dPa_name::ID_AK_SN_BKMLATTACKHOUSHI00, &i_this->mBAC); dComIfGp_particle_set(dPa_name::ID_AK_SN_BKMLATTACKSOIL00, &i_this->mBAC); i_this->m498[0].x = i_this->mBAC.x; i_this->m498[0].y = i_this->mBAC.y; i_this->m498[0].z = i_this->mBAC.z; - dComIfGp_particle_setToon(dPa_name::ID_AK_ST_BKMLATTACKSMOKE00, &i_this->m498[0], NULL, NULL, 0xB9, &i_this->m458[0], (u8)actor->current.roomNo); + dComIfGp_particle_setToon( + dPa_name::ID_AK_ST_BKMLATTACKSMOKE00, &i_this->m498[0], NULL, NULL, 0xB9, &i_this->mLAttackSmoke00CB[0], (u8)actor->current.roomNo + ); mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_IN_G2, &i_this->mBAC, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } - if (i_this->mAF4->isStop()) { + if (i_this->mpFloorVineMorf->isStop()) { anm_init(i_this, BMDFOOT_BCK_ASI_NUKU, 5.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->m2BC++; i_this->mBA8 = 0; @@ -443,7 +427,7 @@ void attack_2(bmdfoot_class* i_this) { } break; case 7: - if ((s32)i_this->m2B4->getFrame() == 13) { + if ((s32)i_this->mpBodyVineMorf->getFrame() == 13) { local_48 = actor->current.pos; local_48.y = i_this->mBAC.y; dComIfGp_particle_set(dPa_name::ID_AK_SN_BKMLATTACKHOUSHI00, &local_48); @@ -451,42 +435,42 @@ void attack_2(bmdfoot_class* i_this) { i_this->m498[1].x = local_48.x; i_this->m498[1].y = local_48.y; i_this->m498[1].z = local_48.z; - dComIfGp_particle_setToon(dPa_name::ID_AK_ST_BKMLATTACKSMOKE00, &i_this->m498[1], NULL, NULL, 0xB9, &i_this->m458[1], (u8)actor->current.roomNo); + dComIfGp_particle_setToon( + dPa_name::ID_AK_ST_BKMLATTACKSMOKE00, &i_this->m498[1], NULL, NULL, 0xB9, &i_this->mLAttackSmoke00CB[1], (u8)actor->current.roomNo + ); } - if (i_this->m2B4->isStop()) { + if (i_this->mpBodyVineMorf->isStop()) { i_this->m2BA = 0; i_this->m2BC = 0; } } - MTXCopy(i_this->m2B4->getModel()->getAnmMtx(4), *calc_mtx); + MTXCopy(i_this->mpBodyVineMorf->getModel()->getAnmMtx(4), *calc_mtx); MtxPosition(&local_3c, &local_48); - i_this->m50C[4].SetC(local_48); - i_this->m50C[4].SetR(50.0f); - i_this->m50C[4].OffAtSetBit(); - i_this->m50C[4].OnCoSetBit(); - dComIfG_Ccsp()->Set(&i_this->m50C[4]); + i_this->mSph[4].SetC(local_48); + i_this->mSph[4].SetR(50.0f); + i_this->mSph[4].OffAtSetBit(); + i_this->mSph[4].OnCoSetBit(); + dComIfG_Ccsp()->Set(&i_this->mSph[4]); } /* 00001B00-00001CDC .text damage__FP13bmdfoot_class */ void damage(bmdfoot_class* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; f32 dVar5; - float fVar9; switch (i_this->m2BC) { case 0: anm_init(i_this, BMDFOOT_BCK_ASI_NOBIKIRU, 40.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->m2BC++; i_this->m2C0[0] = 0x1e; - fVar9 = cM_rndFX(32768.0f); - i_this->m3EC = (s16)(int)fVar9; - for (s32 i = 2; i <= (s32)ARRAY_SIZE(i_this->m3A4); i++) { + i_this->m3EC = cM_rndFX(32768.0f); + for (s32 i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { i_this->m3A4[i] = (0.3f + cM_rndFX(0.2f)); } case 1: if (i_this->m2C0[0] != 0) { dVar5 = ((fopAcM_GetParam(actor) & 0xf) * 0.01f); - for (s32 i = 2; i <= (s32)ARRAY_SIZE(i_this->m3A4); i++) { + for (s32 i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { cLib_addCalc2(&i_this->m2CC[i].x, -(dVar5 + (0.05f + ((i) * (0.03f + REG14_F(3))))), 0.1f, REG14_F(4) + 0.1f); } } @@ -502,34 +486,34 @@ void damage(bmdfoot_class* i_this) { /* 00001CDC-00001ED8 .text start__FP13bmdfoot_class */ void start(bmdfoot_class* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; - - for (s32 i = 2; i <= (s32)ARRAY_SIZE(i_this->m3A4); i++) { + + for (s32 i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { i_this->m2CC[i].z = 0; i_this->m3A4[i] = 0; } - + switch (i_this->m2BC) { case 0: if (boss->m332 == 6) { i_this->m2BC = 1; - i_this->m2C0[0] = (s16)(int)cM_rndF(10.0f); + i_this->m2C0[0] = cM_rndF(10.0f); } break; case 1: if (i_this->m2C0[0] == 0) { i_this->mBC8 = 1; - anm_init(i_this, BMDFOOT_BCK_ASI_START1, 1.0f, J3DFrameCtrl::EMode_NONE, (cM_rndF(0.2f) + 0.9f), -1); + anm_init(i_this, BMDFOOT_BCK_ASI_START1, 1.0f, J3DFrameCtrl::EMode_NONE, cM_rndF(0.2f) + 0.9f, -1); i_this->m2BC = 2; } break; case 2: - if (i_this->m2B4->isStop()) { - anm_init(i_this, BMDFOOT_BCK_ASI_START2, 30.0f, J3DFrameCtrl::EMode_LOOP, (cM_rndF(0.2f) + 0.9f), -1); + if (i_this->mpBodyVineMorf->isStop()) { + anm_init(i_this, BMDFOOT_BCK_ASI_START2, 30.0f, J3DFrameCtrl::EMode_LOOP, cM_rndF(0.2f) + 0.9f, -1); i_this->m2BC = 3; } break; case 3: - if ((s32)i_this->m2B4->getFrame() == 2) { + if ((s32)i_this->mpBodyVineMorf->getFrame() == 2) { mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_MOVE_1, &i_this->mAE8, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } if (boss->m332 == 7) { @@ -542,7 +526,7 @@ void start(bmdfoot_class* i_this) { /* 00001ED8-00001FB8 .text end__FP13bmdfoot_class */ void end(bmdfoot_class* i_this) { - for (s32 i = 2; i <= (s32)ARRAY_SIZE(i_this->m3A4); i++) { + for (s32 i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { i_this->m2CC[i].z = 0; i_this->m3A4[i] = 0; } @@ -557,12 +541,11 @@ void end(bmdfoot_class* i_this) { /* 00001FB8-000021B8 .text move__FP13bmdfoot_class */ void move(bmdfoot_class* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; - s16 sVar1; cXyz local_20; cXyz cStack_2c; if (boss != NULL) { - sVar1 = (u16)(fopAcM_GetParam(actor) & 0xF) << 13; + s16 sVar1 = (u16)(fopAcM_GetParam(actor) & 0xF) << 13; cMtx_YrotS(*calc_mtx, boss->actor.shape_angle.y); cMtx_XrotM(*calc_mtx, boss->actor.shape_angle.x); cMtx_ZrotM(*calc_mtx, boss->actor.shape_angle.z); @@ -608,7 +591,7 @@ void move(bmdfoot_class* i_this) { /* 000021B8-00002204 .text s_a_d_sub__FPvPv */ void* s_a_d_sub(void* search, void* param_2) { UNUSED(param_2); - if ((fopAc_IsActor(search)) && (fopAcM_GetName(search) == PROC_BMD)) { + if ((fopAcM_IsActor(search)) && (fopAcM_GetName(search) == PROC_BMD)) { return search; } else { return NULL; @@ -618,8 +601,6 @@ void* s_a_d_sub(void* search, void* param_2) { /* 00002204-00002594 .text daBmdfoot_Execute__FP13bmdfoot_class */ static BOOL daBmdfoot_Execute(bmdfoot_class* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; - short sVar1; - J3DModel* pJVar5; cXyz local_68; s32 i; @@ -627,7 +608,7 @@ static BOOL daBmdfoot_Execute(bmdfoot_class* i_this) { boss = (bmd_class*)fpcM_Search(s_a_d_sub, i_this); } i_this->m2B8++; - for (i = 0; i < (s32)ARRAY_SIZE(i_this->m2C0); i++) { + for (i = 0; i < ARRAY_SSIZE(i_this->m2C0); i++) { if (i_this->m2C0[i] != 0) { i_this->m2C0[i]--; } @@ -640,17 +621,17 @@ static BOOL daBmdfoot_Execute(bmdfoot_class* i_this) { cMtx_YrotM(*calc_mtx, actor->current.angle.y + i_this->m2BE); cMtx_XrotM(*calc_mtx, actor->current.angle.x); cMtx_ZrotM(*calc_mtx, actor->current.angle.z + i_this->m2BE * 2); - pJVar5 = i_this->m2B4->getModel(); + J3DModel* pJVar5 = i_this->mpBodyVineMorf->getModel(); pJVar5->setBaseTRMtx(*calc_mtx); - i_this->m2B4->play(NULL, 0, 0); - i_this->m2B4->calc(); + i_this->mpBodyVineMorf->play(NULL, 0, 0); + i_this->mpBodyVineMorf->calc(); if (i_this->mBD0 != 0) { if (i_this->mBD0 == 0x1e) { mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_MOVE_2, &i_this->mAE8, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } i_this->mBD0 = i_this->mBD0 + -1; } - sVar1 = 29 - i_this->mBD0; + s16 sVar1 = 29 - i_this->mBD0; if (sVar1 >= 30) { sVar1 = sVar1 % 30; } @@ -671,7 +652,7 @@ static BOOL daBmdfoot_Execute(bmdfoot_class* i_this) { sVar1_2 = REG0_S(4); } cLib_addCalcAngleS2(&actor->current.angle.x, sVar1_2, 0x10, 0x80); - for (i = 2; i <= (s32)ARRAY_SIZE(i_this->m3A4); i++) { + for (i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { f32 f1 = i_this->m3A4[i] * cM_ssin(i_this->m3EC + i * (REG0_S(6) + 9000)); cLib_addCalc2(&i_this->m2CC[i].z, f1, 0.05f, 0.01f + REG14_F(5)); cLib_addCalc0(&i_this->m2CC[i].x, 0.05f, 0.005f + REG14_F(5)); @@ -686,72 +667,65 @@ static BOOL daBmdfoot_IsDelete(bmdfoot_class*) { /* 0000259C-000026B0 .text daBmdfoot_Delete__FP13bmdfoot_class */ static BOOL daBmdfoot_Delete(bmdfoot_class* i_this) { - dComIfG_resDeleteDemo(&i_this->m2AC, "Bmdfoot"); + dComIfG_resDeleteDemo(&i_this->mPhase, "Bmdfoot"); if (i_this->mBD2 != 0) { hio_set = 0; mDoHIO_deleteChild(l_HIO.mNo); } mDoAud_seDeleteObject(&i_this->mAE8); mDoAud_seDeleteObject(&i_this->mBAC); - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m41C); i++) { - i_this->m41C[i].remove(); + for (s32 i = 0; i < ARRAY_SSIZE(i_this->mAsiWaitFollowCB); i++) { + i_this->mAsiWaitFollowCB[i].remove(); } - i_this->m458[0].remove(); - i_this->m458[1].remove(); - i_this->m4B0.remove(); + i_this->mLAttackSmoke00CB[0].remove(); + i_this->mLAttackSmoke00CB[1].remove(); + i_this->mLAttackSmoke01CB.remove(); boss = NULL; return TRUE; } /* 000026B0-000029B4 .text useHeapInit__FP13bmdfoot_class */ s32 useHeapInit(bmdfoot_class* i_this) { - mDoExt_McaMorf* pmVar1; - mDoExt_btkAnm* pmVar5; - J3DAnmTextureSRTKey* pAnm; - int iVar7; - J3DModel* pJVar9; + i_this->mpBodyVineMorf = new mDoExt_McaMorf( + (J3DModelData*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BMD_ASI), + NULL, + NULL, + (J3DAnmTransformKey*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BCK_ASI_WAIT), + J3DFrameCtrl::EMode_LOOP, + cM_rndF(0.2f) + 0.9f, + 0, + -1, + 1, + NULL, + 0, + 0x11020203 + ); + J3DModel* model = i_this->mpBodyVineMorf->getModel(); + if (model == NULL) { + return FALSE; + } +#if VERSION > VERSION_DEMO + if (i_this->mpBodyVineMorf == NULL) { + return FALSE; + } +#endif - pmVar1 = new mDoExt_McaMorf( - (J3DModelData*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BMD_ASI), - NULL, - NULL, - (J3DAnmTransformKey*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BCK_ASI_WAIT), - J3DFrameCtrl::EMode_LOOP, - cM_rndF(0.2f) + 0.9f, - 0, - -1, - 1, - NULL, - 0, - 0x11020203 - ); - i_this->m2B4 = pmVar1; - pJVar9 = i_this->m2B4->getModel(); - if (pJVar9 == NULL) { - return FALSE; + model->setUserArea((u32)i_this); + for (u16 i = 0; i < model->getModelData()->getJointNum(); i++) { + model->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack); } -#if VERSION > VERSION_DEMO - if (i_this->m2B4 == NULL) { - return FALSE; - } -#endif - - pJVar9->setUserArea((u32)i_this); - for (u16 uVar16 = 0; uVar16 < pJVar9->getModelData()->getJointNum(); uVar16++) { - pJVar9->getModelData()->getJointNodePointer(uVar16)->setCallBack(nodeCallBack); - } - pmVar5 = new mDoExt_btkAnm(); - i_this->btk = pmVar5; + i_this->btk = new mDoExt_btkAnm(); JUT_ASSERT(DEMO_SELECT(1416, 1426), i_this->btk); - pAnm = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BTK_ASI); - iVar7 = i_this->btk->init(pJVar9->getModelData(), pAnm, true, J3DFrameCtrl::EMode_NONE); -#if VERSION > VERSION_DEMO - if (iVar7 == 0) { + J3DAnmTextureSRTKey* pBtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BTK_ASI); +#if VERSION == VERSION_DEMO + i_this->btk->init(model->getModelData(), pBtk, true, J3DFrameCtrl::EMode_NONE); +#else + if (!i_this->btk->init(model->getModelData(), pBtk, true, J3DFrameCtrl::EMode_NONE)) { return FALSE; } #endif - - pmVar1 = new mDoExt_McaMorf( + + i_this->mpFloorVineMorf = new mDoExt_McaMorf( (J3DModelData*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BMD_ASI), NULL, NULL, @@ -765,11 +739,10 @@ s32 useHeapInit(bmdfoot_class* i_this) { 0, 0x11020203 ); - i_this->mAF4 = pmVar1; - if (i_this->mAF4->getModel() == NULL) { + if (i_this->mpFloorVineMorf->getModel() == NULL) { return FALSE; } - + return TRUE; } @@ -809,18 +782,17 @@ static cPhs_State daBmdfoot_Create(fopAc_ac_c* a_this) { /* Radius */ 40.0f, }}, }; - cPhs_State res; fopAcM_ct(a_this, bmdfoot_class); bmdfoot_class* i_this = (bmdfoot_class*)a_this; - res = dComIfG_resLoad(&i_this->m2AC, "Bmdfoot"); + cPhs_State res = dComIfG_resLoad(&i_this->mPhase, "Bmdfoot"); if (res == cPhs_ERROR_e) { return cPhs_ERROR_e; } else if (res != cPhs_COMPLEATE_e) { return res; } - i_this->m458[0].setFollowOff(); - i_this->m458[1].setFollowOff(); + i_this->mLAttackSmoke00CB[0].setFollowOff(); + i_this->mLAttackSmoke00CB[1].setFollowOff(); if (!fopAcM_entrySolidHeap(a_this, solidHeapCB, 0x5040)) { return cPhs_ERROR_e; } @@ -830,12 +802,12 @@ static cPhs_State daBmdfoot_Create(fopAc_ac_c* a_this) { l_HIO.mNo = mDoHIO_createChild("森ボス足", &l_HIO); // Forest boss feet } a_this->health = 2; - i_this->m2B8 = (s16)(int)cM_rndF(10000.0f); + i_this->m2B8 = cM_rndF(10000.0f); boss = NULL; - i_this->m4D0.Init(0xFF, 0, a_this); - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m50C); i++) { - i_this->m50C[i].SetStts(&i_this->m4D0); - i_this->m50C[i].Set(cc_sph_src); + i_this->mStts.Init(0xFF, 0, a_this); + for (s32 i = 0; i < ARRAY_SSIZE(i_this->mSph); i++) { + i_this->mSph[i].SetStts(&i_this->mStts); + i_this->mSph[i].Set(cc_sph_src); } a_this->attention_info.position.y = -20000.0f; a_this->eyePos.y = -20000.0f; @@ -845,7 +817,7 @@ static cPhs_State daBmdfoot_Create(fopAc_ac_c* a_this) { i_this->mBC8 = 1; } #if VERSION > VERSION_DEMO - i_this->mAF8 = a_this->tevStr; + i_this->mTevstr = a_this->tevStr; #endif return cPhs_COMPLEATE_e; } diff --git a/src/d/actor/d_a_bmdhand.cpp b/src/d/actor/d_a_bmdhand.cpp index 549586e54..ce6d5de1b 100644 --- a/src/d/actor/d_a_bmdhand.cpp +++ b/src/d/actor/d_a_bmdhand.cpp @@ -43,12 +43,16 @@ static f32 boss_joint_xad[] = {60.0f, 20.0f, -20.0f, -60.0f}; void hand_draw(bmdhand_class* i_this) { fopAc_ac_c* actor = &i_this->actor; if (i_this->m320 > 0.01f) { - g_env_light.setLightTevColorType(i_this->m2B4->getModel(), &actor->tevStr); - i_this->m2B4->updateDL(); + g_env_light.setLightTevColorType(i_this->mpMorf->getModel(), &actor->tevStr); + i_this->mpMorf->updateDL(); } - GXColor local_18 = {0xFF, 0xFF, 0xFF, 0xFF}; - i_this->m554.update(0x14, local_18, &actor->tevStr); - dComIfGd_set3DlineMat(&i_this->m554); +#ifdef __MWERKS__ + i_this->mLineMat.update(0x14, (GXColor){0xFF, 0xFF, 0xFF, 0xFF}, &actor->tevStr); +#else + GXColor local_18 = (GXColor){0xFF, 0xFF, 0xFF, 0xFF}; + i_this->mLineMat.update(0x14, local_18, &actor->tevStr); +#endif + dComIfGd_set3DlineMat(&i_this->mLineMat); } /* 000001CC-0000022C .text daBmdhand_Draw__FP13bmdhand_class */ @@ -66,23 +70,24 @@ void hand_mtx_set(bmdhand_class* i_this) { f32 x; MtxTrans(i_this->m2F0.x, i_this->m2F0.y, i_this->m2F0.z, false); - mDoMtx_XrotM(*calc_mtx, i_this->m300); - mDoMtx_YrotM(*calc_mtx, i_this->m302); - mDoMtx_XrotM(*calc_mtx, REG12_S(1) + -0x4000); + cMtx_XrotM(*calc_mtx, i_this->m300); + cMtx_YrotM(*calc_mtx, i_this->m302); + cMtx_XrotM(*calc_mtx, REG12_S(1) + -0x4000); x = i_this->m320; MtxScale(x, x, x, true); MtxTrans(0.0f, REG12_F(3) + -130.0f, 0.0f, true); - i_this->m2B4->getModel()->setBaseTRMtx(*calc_mtx); + J3DModel* model = i_this->mpMorf->getModel(); + model->setBaseTRMtx(*calc_mtx); } /* 00000310-00000388 .text control3__FP13bmdhand_class */ void control3(bmdhand_class* i_this) { - hand_s* phVar1 = &i_this->m324[0]; - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m324); i++, phVar1++) { + hand_s* hand_i = &i_this->m324[0]; + for (s32 i = 0; i < ARRAY_SSIZE(i_this->m324); i++, hand_i++) { if (i < 10) { - phVar1->m18 = 10.5f; + hand_i->m18 = 10.5f; } else { - phVar1->m18 = (15.0f - (s32)(i - 10U)) * 0.7f; + hand_i->m18 = (15.0f - (s32)(i - 10)) * 0.7f; } } } @@ -96,8 +101,8 @@ void control1(bmdhand_class* i_this) { i_this->m324[0].m00 = actor->current.pos; s32 i = 1; - hand_s* phVar5 = &i_this->m324[1]; - mDoMtx_YrotS(*calc_mtx, actor->current.angle.y); + hand_s* hand_i = &i_this->m324[1]; + cMtx_YrotS(*calc_mtx, actor->current.angle.y); cXyz local_94; cXyz cStack_a0; cXyz local_ac; @@ -110,20 +115,20 @@ void control1(bmdhand_class* i_this) { local_94.z = i_this->m310; f32 dVar9 = i_this->m31C; cXyz local_c4; - for (i = 1; i < 0x13; i++, ++phVar5) { + for (i = 1; i < 0x13; i++, ++hand_i) { local_c4.x = (dVar9 * cM_ssin(i_this->m2B8 * (REG0_S(5) + 0x44c) + i * (REG0_S(6) + 4000))); local_c4.z = (dVar9 * cM_scos(i_this->m2B8 * (REG0_S(7) + 800) + i * (REG0_S(8) + 4000))); f32 fVar1 = (i < 15) ? 1.0f : 1.0f - (i - 15) * 0.2f; - dVar8 = phVar5->m00.x - phVar5[-1].m00.x + (local_ac.x * fVar1) + (local_c4.x * fVar1); - dVar10 = phVar5->m00.y - phVar5[-1].m00.y + local_ac.y; - dVar7 = phVar5->m00.z - phVar5[-1].m00.z + (local_ac.z * fVar1) + (local_c4.z * fVar1); + dVar8 = hand_i->m00.x - hand_i[-1].m00.x + (local_ac.x * fVar1) + (local_c4.x * fVar1); + dVar10 = hand_i->m00.y - hand_i[-1].m00.y + local_ac.y; + dVar7 = hand_i->m00.z - hand_i[-1].m00.z + (local_ac.z * fVar1) + (local_c4.z * fVar1); s16 iVar4; int iVar3 = cM_atan2s(dVar8, dVar7); iVar4 = -cM_atan2s(dVar10, std::sqrtf((dVar8 * dVar8) + (dVar7 * dVar7))); - mDoMtx_YrotS(*calc_mtx, iVar3); - mDoMtx_XrotM(*calc_mtx, iVar4); + cMtx_YrotS(*calc_mtx, iVar3); + cMtx_XrotM(*calc_mtx, iVar4); MtxPosition(&local_94, &cStack_a0); - phVar5->m00 = phVar5[-1].m00 + cStack_a0; + hand_i->m00 = hand_i[-1].m00 + cStack_a0; } } @@ -142,22 +147,22 @@ void control2(bmdhand_class* i_this) { s32 i = 0x12; s16 iVar4; int iVar3; - hand_s* phVar5 = &i_this->m324[0x12]; - for (i = 0x12; i >= 1; i--, phVar5--) { - f32 fVar1 = phVar5->m00.x - phVar5[1].m00.x; - f32 dVar9 = ((phVar5->m00.y - phVar5[1].m00.y) - 10.0f); - f32 fVar2 = phVar5->m00.z - phVar5[1].m00.z; + hand_s* hand_i = &i_this->m324[0x12]; + for (i = 0x12; i >= 1; i--, hand_i--) { + f32 fVar1 = hand_i->m00.x - hand_i[1].m00.x; + f32 dVar9 = ((hand_i->m00.y - hand_i[1].m00.y) - 10.0f); + f32 fVar2 = hand_i->m00.z - hand_i[1].m00.z; iVar3 = cM_atan2s(fVar1, fVar2); iVar4 = -cM_atan2s(dVar9, std::sqrtf((fVar1 * fVar1) + (fVar2 * fVar2))); - mDoMtx_YrotS(*calc_mtx, iVar3); - mDoMtx_XrotM(*calc_mtx, iVar4); + cMtx_YrotS(*calc_mtx, iVar3); + cMtx_XrotM(*calc_mtx, iVar4); if (i == 0x12) { local_7c.z = i_this->m310 + 70.0f + REG12_F(6); } else { local_7c.z = i_this->m310; } MtxPosition(&local_7c, &cStack_88); - phVar5->m00 = phVar5[1].m00 + cStack_88; + hand_i->m00 = hand_i[1].m00 + cStack_88; } i_this->m2F0 = i_this->m324[0x13].m00; local_7c = i_this->m324[0x12].m00 - i_this->m324[0x13].m00; @@ -168,72 +173,71 @@ void control2(bmdhand_class* i_this) { /* 00000A1C-00000EFC .text cut_control__FP13bmdhand_class */ void cut_control(bmdhand_class* i_this) { - /* Nonmatching - regalloc */ + /* Nonmatching - retail-only regalloc */ fopAc_ac_c* actor = &i_this->actor; - + i_this->m324[0].m00 = actor->current.pos; - s32 i = 1; - hand_s* pcVar6 = &i_this->m324[i]; + hand_s* hand_i = &i_this->m324[1]; cXyz local_e8; cXyz cStack_f4; cXyz local_100; - mDoMtx_YrotS(*calc_mtx, actor->current.angle.y); + cMtx_YrotS(*calc_mtx, actor->current.angle.y); local_e8.x = 0.0f; local_e8.y = i_this->m314; local_e8.z = i_this->m318; MtxPosition(&local_e8, &local_100); cLib_addCalc2(&i_this->m314, REG14_F(7) + -3.0f, 1.0f, REG12_F(4) + 0.1f); cLib_addCalc2(&i_this->m318, REG14_F(8) + 20.0f + 10.0f, 1.0f, REG12_F(5) + 0.2f); - cLib_addCalc0(&i_this->m31C, 1.0f, (REG12_F(6) + 1.0f)); + cLib_addCalc0(&i_this->m31C, 1.0f, REG12_F(6) + 1.0f); local_e8.z = i_this->m310; + f32 fVar_x; + f32 delta_y; f32 dVar9; dVar9 = (REG7_F(10) + 0.5f); cXyz local_100_scaled; cXyz local_124; - f32 fVar_x; - f32 fVar_y; - f32 fVar_z; - f32 delta_y; - for (i = 1; i < (s32)ARRAY_SIZE(i_this->m324); i++, pcVar6++) { + for (s32 i = 1; i < ARRAY_SSIZE(i_this->m324); i++, hand_i++) { local_124.x = i_this->m31C * cM_ssin(i_this->m2B8 * (REG0_S(4) + 0xdac) + i * (REG0_S(5) + 4000)); local_124.y = i_this->m31C * cM_scos(i_this->m2B8 * (REG0_S(6) + 4000) + i * (REG0_S(7) + 4000)); local_124.z = i_this->m31C * cM_scos(i_this->m2B8 * (REG0_S(8) + 0xed8) + i * (REG0_S(9) + 4000)); f32 factor = 1.0f - i * (REG0_F(9) + 0.03763158f); local_100_scaled.x = local_100.x * factor; local_100_scaled.z = local_100.z * factor; - fVar_x = pcVar6->m0C.x + (pcVar6->m00.x - pcVar6[-1].m00.x + local_100_scaled.x + local_124.x); - fVar_y = pcVar6->m0C.y + (pcVar6->m00.y + local_100.y + local_124.y); + f32 fVar_y; + f32 fVar_z; + fVar_x = hand_i->m0C.x + (hand_i->m00.x - hand_i[-1].m00.x + local_100_scaled.x + local_124.x); + fVar_y = hand_i->m0C.y + (hand_i->m00.y + local_100.y + local_124.y); if (fVar_y < (5.0f + boss->m328)) { fVar_y = (5.0f + boss->m328); } - delta_y = fVar_y - pcVar6[-1].m00.y; - fVar_z = pcVar6->m0C.z + (pcVar6->m00.z - pcVar6[-1].m00.z + local_100_scaled.z + local_124.z); + delta_y = fVar_y - hand_i[-1].m00.y; + fVar_z = hand_i->m0C.z + (hand_i->m00.z - hand_i[-1].m00.z + local_100_scaled.z + local_124.z); s16 iVar5; int iVar4 = cM_atan2s(fVar_x, fVar_z); iVar5 = -cM_atan2s(delta_y, std::sqrtf((fVar_x * fVar_x) + (fVar_z * fVar_z))); - mDoMtx_YrotS(*calc_mtx, iVar4); - mDoMtx_XrotM(*calc_mtx, iVar5); + cMtx_YrotS(*calc_mtx, iVar4); + cMtx_XrotM(*calc_mtx, iVar5); MtxPosition(&local_e8, &cStack_f4); - pcVar6->m0C = pcVar6->m00; - pcVar6->m00 = pcVar6[-1].m00 + cStack_f4; - pcVar6->m0C.x = (dVar9 * (pcVar6->m00.x - pcVar6->m0C.x)); - pcVar6->m0C.y = (dVar9 * (pcVar6->m00.y - pcVar6->m0C.y)); - pcVar6->m0C.z = (dVar9 * (pcVar6->m00.z - pcVar6->m0C.z)); + hand_i->m0C = hand_i->m00; + hand_i->m00 = hand_i[-1].m00 + cStack_f4; + hand_i->m0C.x = (dVar9 * (hand_i->m00.x - hand_i->m0C.x)); + hand_i->m0C.y = (dVar9 * (hand_i->m00.y - hand_i->m0C.y)); + hand_i->m0C.z = (dVar9 * (hand_i->m00.z - hand_i->m0C.z)); if ((i == 0x13) && (i_this->m2CA != 0)) { - dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_BKMTENTACLEBLOOD00, &pcVar6->m00, 0xFF, g_whiteColor, g_whiteColor, 0); + dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_BKMTENTACLEBLOOD00, &hand_i->m00, 0xFF, g_whiteColor, g_whiteColor, 0); } } } /* 00000EFC-00000FAC .text cut_control3__FP13bmdhand_class */ void cut_control3(bmdhand_class* i_this) { - hand_s* phVar1 = &i_this->m324[0]; + hand_s* hand_i = &i_this->m324[0]; - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m324); i++, phVar1++) { + for (s32 i = 0; i < ARRAY_SSIZE(i_this->m324); i++, hand_i++) { if (i < 10) { - phVar1->m18 = 10.5f; + hand_i->m18 = 10.5f; } else { - phVar1->m18 = (15.0f - (s32)(i - 10U)) * 0.7f; + hand_i->m18 = (15.0f - (s32)(i - 10)) * 0.7f; } } cLib_addCalc2(&i_this->m2F0.y, i_this->m2CC.y, 1.0f, 10.0f); @@ -253,8 +257,8 @@ void start_control1(bmdhand_class* i_this) { i_this->m324[0].m00 = actor->current.pos; s32 i = 1; - hand_s* phVar5 = &i_this->m324[i]; - mDoMtx_YrotS(*calc_mtx, actor->current.angle.y); + hand_s* hand_i = &i_this->m324[1]; + cMtx_YrotS(*calc_mtx, actor->current.angle.y); local_94.x = 0.0f; local_94.y = i_this->m314; local_94.z = i_this->m318; @@ -263,20 +267,20 @@ void start_control1(bmdhand_class* i_this) { cLib_addCalc2(&i_this->m318, REG0_F(8) + 5.0f, 1.0f, 1.0f); local_94.z = i_this->m310; f32 dVar9 = i_this->m31C; - for (i = 1; i < 0x13; i++, phVar5++) { + for (i = 1; i < 0x13; i++, hand_i++) { local_c4.x = (dVar9 * cM_ssin(i_this->m2B8 * (REG0_S(5) + 0x640) + i * (REG0_S(6) + 3000))); local_c4.y = (dVar9 * cM_ssin(i_this->m2B8 * (REG0_S(5) + 0x6a4) + i * (REG0_S(6) + 4000))); local_c4.z = (dVar9 * cM_scos(i_this->m2B8 * (REG0_S(7) + 0x578) + i * (REG0_S(8) + 0xdac))); - fVar1 = local_c4.x + (local_ac.x + (phVar5->m00.x - phVar5[-1].m00.x)); - dVar10 = local_c4.y + (local_ac.y + (phVar5->m00.y - phVar5[-1].m00.y)); - fVar2 = local_c4.z + (local_ac.z + (phVar5->m00.z - phVar5[-1].m00.z)); + fVar1 = local_c4.x + (local_ac.x + (hand_i->m00.x - hand_i[-1].m00.x)); + dVar10 = local_c4.y + (local_ac.y + (hand_i->m00.y - hand_i[-1].m00.y)); + fVar2 = local_c4.z + (local_ac.z + (hand_i->m00.z - hand_i[-1].m00.z)); s16 iVar4; int iVar3 = cM_atan2s(fVar1, fVar2); iVar4 = -cM_atan2s(dVar10, std::sqrtf((fVar1 * fVar1) + (fVar2 * fVar2))); - mDoMtx_YrotS(*calc_mtx, iVar3); - mDoMtx_XrotM(*calc_mtx, iVar4); + cMtx_YrotS(*calc_mtx, iVar3); + cMtx_XrotM(*calc_mtx, iVar4); MtxPosition(&local_94, &cStack_a0); - phVar5->m00 = phVar5[-1].m00 + cStack_a0; + hand_i->m00 = hand_i[-1].m00 + cStack_a0; } } @@ -292,17 +296,17 @@ void start_control2(bmdhand_class* i_this) { s32 i = 0x12; s16 iVar4; int iVar3; - hand_s* phVar5 = &i_this->m324[i]; - for (i = 0x12; i >= 1; i--, phVar5--) { - f32 fVar1 = phVar5->m00.x - phVar5[1].m00.x; - f32 dVar9 = ((phVar5->m00.y - phVar5[1].m00.y) - 5.0f); - f32 fVar2 = phVar5->m00.z - phVar5[1].m00.z; + hand_s* hand_i = &i_this->m324[0x12]; + for (i = 0x12; i >= 1; i--, hand_i--) { + f32 fVar1 = hand_i->m00.x - hand_i[1].m00.x; + f32 dVar9 = ((hand_i->m00.y - hand_i[1].m00.y) - 5.0f); + f32 fVar2 = hand_i->m00.z - hand_i[1].m00.z; iVar3 = cM_atan2s(fVar1, fVar2); iVar4 = -cM_atan2s(dVar9, std::sqrtf((fVar1 * fVar1) + (fVar2 * fVar2))); - mDoMtx_YrotS(*calc_mtx, iVar3); - mDoMtx_XrotM(*calc_mtx, iVar4); + cMtx_YrotS(*calc_mtx, iVar3); + cMtx_XrotM(*calc_mtx, iVar4); MtxPosition(&local_7c, &cStack_88); - phVar5->m00 = phVar5[1].m00 + cStack_88; + hand_i->m00 = hand_i[1].m00 + cStack_88; } i_this->m2F0 = i_this->m324[0x13].m00; local_7c = i_this->m324[0x12].m00 - i_this->m324[0x13].m00; @@ -316,7 +320,7 @@ void hand_close(bmdhand_class* i_this) { J3DAnmTransform* pAnimRes; pAnimRes = (J3DAnmTransform*)dComIfG_getObjectRes("Bmdhand", BMDHAND_BCK_FOOK_TOJIRU); - i_this->m2B4->setAnm(pAnimRes, 0, REG0_F(6) + 5.0f, 1.0f, 0.0f, -1.0f, NULL); + i_this->mpMorf->setAnm(pAnimRes, 0, REG0_F(6) + 5.0f, 1.0f, 0.0f, -1.0f, NULL); } /* 0000161C-000016AC .text hand_open__FP13bmdhand_class */ @@ -324,36 +328,35 @@ void hand_open(bmdhand_class* i_this) { J3DAnmTransform* pAnimRes; pAnimRes = (J3DAnmTransform*)dComIfG_getObjectRes("Bmdhand", BMDHAND_BCK_FOOK_HIRAKU); - i_this->m2B4->setAnm(pAnimRes, 0, REG0_F(6) + 5.0f, 1.0f, 0.0f, -1.0f, NULL); + i_this->mpMorf->setAnm(pAnimRes, 0, REG0_F(6) + 5.0f, 1.0f, 0.0f, -1.0f, NULL); } /* 000016AC-00001D30 .text hand_calc__FP13bmdhand_class */ void hand_calc(bmdhand_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - f32 dVar6; f32 fVar7; cXyz local_b8; cXyz local_c4; local_b8.y = 0.0f; local_b8.x = 0.0f; - if ((i_this->m2B8 & 0xfU) == 0) { - dBgS_LinChk local_ac; + if ((i_this->m2B8 & 0xf) == 0) { + dBgS_LinChk linChk; cXyz local_d0; cXyz local_dc; local_d0 = i_this->m2D8; local_dc = i_this->m2D8; local_dc.y += 2500.0f; - local_ac.Set(&local_d0, &local_dc, actor); - if (dComIfG_Bgsp()->LineCross(&local_ac)) { - i_this->m2CC = local_ac.GetCross(); + linChk.Set(&local_d0, &local_dc, actor); + if (dComIfG_Bgsp()->LineCross(&linChk)) { + i_this->m2CC = linChk.GetCross(); i_this->m2CC.y += l_HIO.m08; } } switch (i_this->m2BC) { case 0: - mDoMtx_YrotS(*calc_mtx, actor->current.angle.y); - if ((fopAcM_GetParam(actor) & 1U) == 0) { + cMtx_YrotS(*calc_mtx, actor->current.angle.y); + if ((fopAcM_GetParam(actor) & 1) == 0) { local_b8.z = REG0_F(9) + 250.0f; } else { local_b8.z = REG0_F(10) + 350.0f; @@ -372,8 +375,8 @@ void hand_calc(bmdhand_class* i_this) { } break; case 1: - mDoMtx_YrotS(*calc_mtx, actor->current.angle.y); - if ((fopAcM_GetParam(actor) & 1U) == 0) { + cMtx_YrotS(*calc_mtx, actor->current.angle.y); + if ((fopAcM_GetParam(actor) & 1) == 0) { local_b8.z = REG0_F(9) + 250.0f; } else { local_b8.z = REG0_F(10) + 350.0f; @@ -382,8 +385,7 @@ void hand_calc(bmdhand_class* i_this) { i_this->m2E4.x = actor->current.pos.x + local_c4.x; i_this->m2E4.z = actor->current.pos.z + local_c4.z; local_c4 = i_this->m2E4 - i_this->m2D8; - fVar7 = std::sqrtf(local_c4.x * local_c4.x + local_c4.z * local_c4.z); - if (fVar7 > REG14_F(0) + 100.0f) { + if (std::sqrtf(SQUARE(local_c4.x) + SQUARE(local_c4.z)) > REG14_F(0) + 100.0f) { if (i_this->m2C0[0] == 0) { i_this->m2BC = 2; i_this->m2C0[0] = 0x28; @@ -404,10 +406,9 @@ void hand_calc(bmdhand_class* i_this) { i_this->m2E4.y = (i_this->m2CC.y - 150.0f) + REG0_F(0xe); fVar7 = 0.1f; } - dVar6 = fVar7; cLib_addCalc2(&i_this->m2D8.x, i_this->m2E4.x, fVar7, i_this->m308 * 30.0f); - cLib_addCalc2(&i_this->m2D8.z, i_this->m2E4.z, dVar6, i_this->m308 * 30.0f); - cLib_addCalc2(&i_this->m2D8.y, i_this->m2E4.y, dVar6, i_this->m308 * 30.0f); + cLib_addCalc2(&i_this->m2D8.z, i_this->m2E4.z, fVar7, i_this->m308 * 30.0f); + cLib_addCalc2(&i_this->m2D8.y, i_this->m2E4.y, fVar7, i_this->m308 * 30.0f); cLib_addCalc2(&i_this->m308, 1.0f, 1.0f, 0.1f); if (i_this->m2C0[0] == 0) { i_this->m2BC = 1; @@ -419,32 +420,33 @@ void hand_calc(bmdhand_class* i_this) { /* 00002168-000025D4 .text start_hand_calc__FP13bmdhand_class */ void start_hand_calc(bmdhand_class* i_this) { - /* Nonmatching - math */ fopAc_ac_c* actor = &i_this->actor; cXyz local_a8; cXyz cStack_b4; local_a8.y = 0.0f; local_a8.x = 0.0f; - dBgS_LinChk local_9c; + dBgS_LinChk linChk; cXyz local_c0; cXyz local_cc; local_c0 = i_this->m2D8; local_cc = i_this->m2D8; local_cc.y += 2500.0f; - local_9c.Set(&local_c0, &local_cc, actor); - if (dComIfG_Bgsp()->LineCross(&local_9c)) { - i_this->m2CC = local_9c.GetCross(); + linChk.Set(&local_c0, &local_cc, actor); + if (dComIfG_Bgsp()->LineCross(&linChk)) { + i_this->m2CC = linChk.GetCross(); i_this->m2CC.y += l_HIO.m08; } switch (i_this->m2BC) { - case 0: - mDoMtx_YrotS(*calc_mtx, actor->current.angle.y); - f32 fVar1 = (i_this->m2E4.y - i_this->m2D8.y) * ((REG13_F(4) + 0.1f) * (REG13_F(5) + 2.0f)); + case 0: + cMtx_YrotS(*calc_mtx, actor->current.angle.y); + f32 fVar1 = i_this->m2E4.y - i_this->m2D8.y; + fVar1 *= REG13_F(4) + 0.1f; + fVar1 *= REG13_F(5) + 2.0f; local_a8.x = fVar1 * cM_ssin(i_this->m2B8 * (REG13_S(5) + 0x5dc)); local_a8.z = fVar1 * cM_scos(i_this->m2B8 * (REG13_S(5) + 0x4B0)); local_a8.y = fVar1 * cM_ssin(i_this->m2B8 * (REG13_S(7) + 500)); - if ((fopAcM_GetParam(actor) & 1U) == 0) { + if ((fopAcM_GetParam(actor) & 1) == 0) { local_a8.z = REG0_F(9) + 250.0f; } else { local_a8.z = REG0_F(10) + 350.0f; @@ -461,20 +463,24 @@ void start_hand_calc(bmdhand_class* i_this) { /* 000025D4-00002E74 .text hand_move__FP13bmdhand_class */ void hand_move(bmdhand_class* i_this) { - /* Nonmatching - regalloc, math */ fopAc_ac_c* actor = &i_this->actor; - f32 fVar10; cXyz local_40; cXyz local_4c; cXyz local_58; - hand_s* pcVar9 = i_this->m324; + hand_s* hand_i = i_this->m324; +#if VERSION == VERSION_DEMO + s8 r29 = 0; +#endif if (boss != NULL) { - actor->current.angle.y = (fopAcM_GetParam(actor) & 0x1f) * -0xccc + REG8_S(4) + -13000 + boss->actor.shape_angle.y; - MTXCopy(boss->mpMorf->getModel()->getAnmMtx(boss_joint_d[(fopAcM_GetParam(actor) & 0x1fU)]), *calc_mtx); + u8 r0 = (fopAcM_GetParam(actor)); + s16 r3 = REG8_S(4); + r3 += ((r0 & 0x1f) * -0xccc) + -13000; + actor->current.angle.y = r3 + boss->actor.shape_angle.y; + MTXCopy(boss->mpBodyMorf->getModel()->getAnmMtx(boss_joint_d[(fopAcM_GetParam(actor) & 0x1f)]), *calc_mtx); local_40.x = REG14_F(6); local_40.y = REG14_F(7); - local_40.z = boss_joint_xad[(fopAcM_GetParam(actor) & 3U)]; + local_40.z = boss_joint_xad[(fopAcM_GetParam(actor) & 3)]; MtxPosition(&local_40, &actor->current.pos); if ((i_this->m2BA != 2) && (boss->m332 == 3)) { i_this->m2BA = 2; @@ -507,17 +513,23 @@ void hand_move(bmdhand_class* i_this) { i_this->m2C0[0] = l_HIO.m0C; i_this->m314 = 3.0f; i_this->m318 = 40.0f; - fVar10 = cM_rndF(20.0f); - i_this->m31C = fVar10 + 30.0f; + i_this->m31C = cM_rndF(20.0f) + 30.0f; +#if VERSION > VERSION_DEMO i_this->m2C8 = 0x14; +#endif } break; case 1: +#if VERSION > VERSION_DEMO i_this->m2C8 = 0x14; +#endif i_this->m2CA = 2; cLib_addCalc2(&i_this->m310, REG14_F(0xc) + 20.0f, 0.1f, 0.5f); cut_control(i_this); cut_control3(i_this); +#if VERSION == VERSION_DEMO + r29 = 1; +#endif if (i_this->m2C0[0] < 100) { cLib_addCalc2(&i_this->m320, 0.0f, 1.0f, 0.01f); } @@ -529,7 +541,9 @@ void hand_move(bmdhand_class* i_this) { } break; case 2: +#if VERSION > VERSION_DEMO i_this->m2C8 = 0x14; +#endif if (i_this->m2C0[1] == 0) { cLib_addCalc2(&i_this->m310, REG14_F(0xc) + 20.0f, 0.1f, 0.5f); } @@ -538,9 +552,11 @@ void hand_move(bmdhand_class* i_this) { } cut_control(i_this); cut_control3(i_this); +#if VERSION == VERSION_DEMO + r29 = 1; +#endif if (boss->m332 == 4) { - fVar10 = cM_rndF(50.0f); - i_this->m2C0[0] = (s16)fVar10; + i_this->m2C0[0] = cM_rndF(50.0f); i_this->m2BA = 5; i_this->m2BC = 0; } else if (boss->m332 == 9) { @@ -555,8 +571,7 @@ void hand_move(bmdhand_class* i_this) { i_this->m2E4.y = 10000.0f; i_this->m2D8 = actor->current.pos; i_this->m30C = 1.0f; - fVar10 = cM_rndF(50.0f); - i_this->m2C0[0] = (s16)fVar10; + i_this->m2C0[0] = cM_rndF(50.0f); } break; case 1: @@ -588,41 +603,50 @@ void hand_move(bmdhand_class* i_this) { } break; case 4: +#if VERSION > VERSION_DEMO i_this->m2C8 = 0x14; +#endif cLib_addCalc0(&i_this->m310, 0.1f, 0.2f); cLib_addCalc0(&i_this->m320, 1.0f, 0.01f); cut_control(i_this); cut_control3(i_this); +#if VERSION == VERSION_DEMO + r29 = 1; +#endif break; case 5: +#if VERSION > VERSION_DEMO i_this->m2C8 = REG8_S(2) + 0x46; +#endif if (i_this->m2C0[0] == 0) { i_this->m2BA = 0; i_this->m2BC = 0; - fVar10 = cM_rndF(0.2f); - i_this->m30C = fVar10; + i_this->m30C = cM_rndF(0.2f); i_this->m31C = 0.0f; } break; } } - cXyz* line_data = i_this->m554.getPos(0); - u8* line_size = i_this->m554.getSize(0); - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m324); i++, pcVar9++, line_data++, line_size++) { - *line_data = pcVar9->m00; - *line_size = pcVar9->m18; + cXyz* line_data = i_this->mLineMat.getPos(0); + u8* line_size = i_this->mLineMat.getSize(0); + for (s32 i = 0; i < ARRAY_SSIZE(i_this->m324); i++, hand_i++, line_data++, line_size++) { + *line_data = hand_i->m00; + *line_size = hand_i->m18; if (i == 10) { - actor->eyePos = pcVar9->m00; + actor->eyePos = hand_i->m00; actor->attention_info.position = actor->eyePos; i_this->m5CC.SetC(actor->eyePos); dComIfG_Ccsp()->Set(&i_this->m5CC); - } else if (i == (s32)((i_this->m2B8 & 3U) * 4 + 3)) { - i_this->m6F8.SetC(pcVar9->m00); - dComIfG_Ccsp()->Set(&i_this->m6F8); + } else { + s32 r0 = ((i_this->m2B8 & 3) * 4) + 3; + if (r0 == i) { + i_this->m6F8.SetC(hand_i->m00); + dComIfG_Ccsp()->Set(&i_this->m6F8); + } } } - if (i_this->m2C8 != 0) { + if (DEMO_SELECT(r29, i_this->m2C8) != 0) { local_4c.x = 0.0f; local_4c.y = -20000.0f; local_4c.z = 0.0f; @@ -638,7 +662,7 @@ void hand_move(bmdhand_class* i_this) { /* 00002E74-00002EC0 .text s_a_d_sub__FPvPv */ void* s_a_d_sub(void* param_1, void* param_2) { UNUSED(param_2); - if ((fopAc_IsActor(param_1)) && (fopAcM_GetName(param_1) == PROC_BMD)) { + if ((fopAcM_IsActor(param_1)) && (fopAcM_GetName(param_1) == PROC_BMD)) { return param_1; } else { return NULL; @@ -651,7 +675,7 @@ static BOOL daBmdhand_Execute(bmdhand_class* i_this) { boss = (bmd_class*)fpcM_Search(s_a_d_sub, i_this); } i_this->m2B8++; - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m2C0); i++) { + for (s32 i = 0; i < ARRAY_SSIZE(i_this->m2C0); i++) { if (i_this->m2C0[i] != 0) { i_this->m2C0[i]--; } @@ -677,7 +701,7 @@ static BOOL daBmdhand_Execute(bmdhand_class* i_this) { hand_close(i_this); } } - i_this->m2B4->play(NULL, 0, 0); + i_this->mpMorf->play(NULL, 0, 0); return TRUE; } @@ -688,7 +712,7 @@ static BOOL daBmdhand_IsDelete(bmdhand_class*) { /* 00003030-000030C4 .text daBmdhand_Delete__FP13bmdhand_class */ static BOOL daBmdhand_Delete(bmdhand_class* i_this) { - dComIfG_resDelete(&i_this->m2AC, "Bmdhand"); + dComIfG_resDeleteDemo(&i_this->mPhase, "Bmdhand"); if (i_this->m824 != 0) { hio_set = 0; mDoHIO_deleteChild(l_HIO.mNo); @@ -700,10 +724,7 @@ static BOOL daBmdhand_Delete(bmdhand_class* i_this) { /* 000030C4-00003210 .text useHeapInit__FP13bmdhand_class */ s32 useHeapInit(bmdhand_class* i_this) { - mDoExt_McaMorf* morf; - ResTIMG* pImg; - - morf = new mDoExt_McaMorf( + i_this->mpMorf = new mDoExt_McaMorf( (J3DModelData*)dComIfG_getObjectRes("Bmdhand", BMDHAND_BMD_BKM_FOOK), NULL, NULL, @@ -717,15 +738,16 @@ s32 useHeapInit(bmdhand_class* i_this) { 0, 0x11020203 ); - i_this->m2B4 = morf; - if (i_this->m2B4->getModel() == NULL) { + if (i_this->mpMorf->getModel() == NULL) { return FALSE; } - if (i_this->m2B4 == NULL) { +#if VERSION > VERSION_DEMO + if (i_this->mpMorf == NULL) { return FALSE; } - pImg = (ResTIMG*)dComIfG_getObjectRes("Bmdhand", BMDHAND_BTI_SYOKUSYU_UE); - if (!i_this->m554.init(1, 0x14, pImg, 1)) { +#endif + ResTIMG* pBti = (ResTIMG*)dComIfG_getObjectRes("Bmdhand", BMDHAND_BTI_SYOKUSYU_UE); + if (!i_this->mLineMat.init(1, 20, pBti, 1)) { return FALSE; } return TRUE; @@ -767,12 +789,11 @@ static cPhs_State daBmdhand_Create(fopAc_ac_c* a_this) { /* Radius */ 100.0f, }}, }; - cPhs_State res; fopAc_ac_c* actor = a_this; fopAcM_ct(actor, bmdhand_class); bmdhand_class* i_this = (bmdhand_class*)a_this; - res = dComIfG_resLoad(&i_this->m2AC, "Bmdhand"); + cPhs_State res = dComIfG_resLoad(&i_this->mPhase, "Bmdhand"); if (res == cPhs_ERROR_e) { return cPhs_ERROR_e; } else if (res != cPhs_COMPLEATE_e) { @@ -789,12 +810,12 @@ static cPhs_State daBmdhand_Create(fopAc_ac_c* a_this) { actor->health = 2; i_this->m2B8 = (s16)cM_rndF(10000.0f); boss = NULL; - i_this->m590.Init(0xFF, 0xFF, actor); + i_this->mStts.Init(0xFF, 0xFF, actor); i_this->m5CC.Set(cc_sph_src); - i_this->m5CC.SetStts(&i_this->m590); + i_this->m5CC.SetStts(&i_this->mStts); i_this->m5CC.SetR(110.0f); i_this->m6F8.Set(cc_sph_src); - i_this->m6F8.SetStts(&i_this->m590); + i_this->m6F8.SetStts(&i_this->mStts); i_this->m5CC.SetR(90.0f); if (!(dComIfGs_isStageBossDemo()) && (dComIfGp_getStartStageName()[0] != 'X')) { i_this->m2BA = 3; diff --git a/src/d/actor/d_a_bpw.cpp b/src/d/actor/d_a_bpw.cpp index 919080583..d1e667828 100644 --- a/src/d/actor/d_a_bpw.cpp +++ b/src/d/actor/d_a_bpw.cpp @@ -15,12 +15,46 @@ #include "d/d_cc_d.h" #include "d/d_s_play.h" #include "f_op/f_op_camera.h" +#include "f_op/f_op_camera_mng.h" #if VERSION == VERSION_DEMO #include "m_Do/m_Do_controller_pad.h" #else #include "m_Do/m_Do_graphic.h" #endif +enum Actor_Type { + ACTOR_TYPE_BODY = 0, + ACTOR_TYPE_KANTERA = 1, + ACTOR_TYPE_DAMAGE_BALL = 2, + ACTOR_TYPE_TORITUKI = 3, +}; + +enum Damage_Action { + DAMAGE_ACTION_LINE = 0, + DAMAGE_ACTION_DAMAGE_BALL = 1, +}; + +enum Action { + ACTION_MOVE_DOUSA = 0, + ACTION_ATTACK_KOUGEKI = 1, + ACTION_BODY_DOWN_KARADA_TAORE = 2, + ACTION_DAMAGE = 3, + ACTION_SEPARATION_BUNRI_DOUSA = 4, + ACTION_START_DEMO = 20, +}; + +enum Action_State { + ACTION_STATE_DAMAGE_CARRIED = 0x54, + ACTION_STATE_DAMAGE_THROWN = 0x55, + ACTION_STATE_DAMAGE_HIT = 0x65, + ACTION_STATE_SEPARATE_BUNRI_DOUSA_INIT = 0x6E, + ACTION_STATE_SEPARATE_BUNRI_DOUSA_EXECUTE = 0x6F, + ACTION_STATE_SEPARATE_BUNRI_DOUSA_END_INIT = 0x72, + ACTION_STATE_SEPARATE_BUNRI_DOUSA_END_GATHER = 0x73, + ACTION_STATE_SEPARATE_BUNRI_DOUSA_END_GROW = 0x74, + ACTION_STATE_SEPARATE_BUNRI_DOUSA_END_FINISH = 0x75, +}; + static bool GOUEN_FIRE_HIT; static fopAc_ac_c* check_info[100]; static s32 get_check_count; @@ -119,8 +153,8 @@ const u32 unused_4324[] = { /* 000003C4-000004F0 .text draw_SUB__FP9bpw_class */ void draw_SUB(bpw_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - J3DModel* pJVar1 = i_this->mpAnim->getModel(); - pJVar1->setBaseScale(actor->scale); + J3DModel* model = i_this->mpMorf->getModel(); + model->setBaseScale(actor->scale); mDoMtx_stack_c::transS(actor->current.pos.x + i_this->m3AC.x, actor->current.pos.y + i_this->m3AC.y, actor->current.pos.z + i_this->m3AC.z); mDoMtx_stack_c::YrotM(i_this->m3D8); mDoMtx_stack_c::XrotM(i_this->m3D6); @@ -128,98 +162,85 @@ void draw_SUB(bpw_class* i_this) { mDoMtx_stack_c::YrotM(actor->shape_angle.y); mDoMtx_stack_c::XrotM(actor->shape_angle.x); mDoMtx_stack_c::ZrotM(actor->shape_angle.z); - pJVar1->setBaseTRMtx(mDoMtx_stack_c::now); - if (i_this->mType != bpw_class::Actor_Type_DAMAGE_BALL_e) { - if (i_this->mType != bpw_class::Actor_Type_TORITUKI_e) { - i_this->mpAnim->calc(); + model->setBaseTRMtx(mDoMtx_stack_c::now); + if (i_this->mType != ACTOR_TYPE_DAMAGE_BALL) { + if (i_this->mType != ACTOR_TYPE_TORITUKI) { + i_this->mpMorf->calc(); } - g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &actor->current.pos, &actor->tevStr); + dKy_getEnvlight().settingTevStruct(TEV_TYPE_ACTOR, &actor->current.pos, &actor->tevStr); } } /* 000004F0-000005D8 .text kantera_draw_SUB__FP9bpw_class */ void kantera_draw_SUB(bpw_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - J3DModel* pJVar1 = i_this->mpAnim->getModel(); - pJVar1->setBaseScale(actor->scale); + J3DModel* model = i_this->mpMorf->getModel(); + model->setBaseScale(actor->scale); 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); MtxTrans(i_this->m3AC.x, i_this->m3AC.y, i_this->m3AC.z, true); - pJVar1->setBaseTRMtx(*calc_mtx); - i_this->mpAnim->calc(); - g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &actor->current.pos, &actor->tevStr); + model->setBaseTRMtx(*calc_mtx); + i_this->mpMorf->calc(); + dKy_getEnvlight().settingTevStruct(TEV_TYPE_ACTOR, &actor->current.pos, &actor->tevStr); } /* 000005D8-00000998 .text body_draw__FP9bpw_class */ void body_draw(bpw_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - u32 uVar2; - bpw_class* pfVar3; - u16 uVar3; - J3DModelData* pJVar4; - J3DModel* pJVar5; cXyz local_28; cXyz local_34; - pJVar5 = i_this->mpAnim->getModel(); - pJVar4 = pJVar5->getModelData(); - for (uVar3 = 0; uVar3 < pJVar4->getMaterialNum(); uVar3++) { - pJVar4->getMaterialNodePointer(uVar3)->getTevKColor(3)->mColor.a = i_this->m47E; + J3DModel* model = i_this->mpMorf->getModel(); + J3DModelData* modelData = model->getModelData(); + for (u16 i = 0; i < modelData->getMaterialNum(); i++) { + modelData->getMaterialNodePointer(i)->getTevKColor(3)->mColor.a = i_this->m47E; } if (i_this->m3E0 == 0) { dComIfGd_setListMaskOff(); } dSnap_RegistFig(DSNAP_TYPE_UNKCE, actor, 1.0f, 1.0f, 1.0f); if (i_this->m3E0 != 0) { - i_this->mBrkAnim->entry(pJVar5->getModelData()); + i_this->mpLightFreezeBrkAnm->entry(model->getModelData()); + } else if (i_this->m3E1 != 0) { + i_this->mpLightStunBrkAnm->entry(model->getModelData()); + } else if (i_this->m3E2 == 2) { + i_this->mpCurseStartBrkAnm->entry(model->getModelData()); + } else if (i_this->m3E2 == 1) { + i_this->mpCurseEndBrkAnm->entry(model->getModelData()); } else { - if (i_this->m3E1 != 0) { - i_this->m2C4->entry(pJVar5->getModelData()); - } else { - if (i_this->m3E2 == 2) { - i_this->m2C8->entry(pJVar5->getModelData()); - } else if (i_this->m3E2 == 1) { - i_this->m2CC->entry(pJVar5->getModelData()); - } else { - i_this->m2D0->entry(pJVar5->getModelData()); - } - } + i_this->mpDefaultBrkAnm->entry(model->getModelData()); } - i_this->mpAnim->entryDL(); + i_this->mpMorf->entryDL(); dComIfGd_setList(); if (i_this->m3E0 == 0) { - i_this->mD78.entryMaskOff(); + i_this->mInvisibleModel.entryMaskOff(); } else { - i_this->mD78.entry(); + i_this->mInvisibleModel.entry(); } if (i_this->m3E0 != 0) { - i_this->mBrkAnim->remove(pJVar5->getModelData()); + i_this->mpLightFreezeBrkAnm->remove(model->getModelData()); + } else if (i_this->m3E1 != 0) { + i_this->mpLightStunBrkAnm->remove(model->getModelData()); + } else if (i_this->m3E2 == 2) { + i_this->mpCurseStartBrkAnm->remove(model->getModelData()); + } else if (i_this->m3E2 == 1) { + i_this->mpCurseEndBrkAnm->remove(model->getModelData()); } else { - if (i_this->m3E1 != 0) { - i_this->m2C4->remove(pJVar5->getModelData()); - } else { - if (i_this->m3E2 == 2) { - i_this->m2C8->remove(pJVar5->getModelData()); - } else if (i_this->m3E2 == 1) { - i_this->m2CC->remove(pJVar5->getModelData()); - } else { - i_this->m2D0->remove(pJVar5->getModelData()); - } - } + i_this->mpDefaultBrkAnm->remove(model->getModelData()); } - if ((i_this->m47E == 0) || (fopAcM_CheckStatus(actor, fopAcStts_CARRY_e))) { + if ((i_this->m47E == 0) || (fopAcM_checkCarryNow(actor))) { return; } dSnap_RegistFig(DSNAP_TYPE_UNKCB, actor, 1.0f, 1.0f, 1.0f); - local_28.set(actor->current.pos.x, actor->current.pos.y + 400.0f + REG8_F(0x12), actor->current.pos.z); - uVar2 = dComIfGd_setShadow( - i_this->m4E8, + local_28.set(actor->current.pos.x, actor->current.pos.y + 400.0f + REG8_F(18), actor->current.pos.z); + i_this->mShadowId = dComIfGd_setShadow( + i_this->mShadowId, 1, - i_this->mpAnim->getModel(), + i_this->mpMorf->getModel(), &local_28, - REG8_F(0x13) + 1300.0f, + REG8_F(19) + 1300.0f, 200.0f, actor->current.pos.y, i_this->mAcch.GetGroundH(), @@ -229,11 +250,10 @@ void body_draw(bpw_class* i_this) { 1.0f, &dDlst_shadowControl_c::mSimpleTexObj ); - i_this->m4E8 = uVar2; - if ((i_this->m4E8 != 0) && (i_this->mAttWaitTimer != 4)) { - pfVar3 = (bpw_class*)fopAcM_SearchByID(i_this->m3FC); + if ((i_this->mShadowId != 0) && (i_this->mAttWaitTimer != 4)) { + bpw_class* pfVar3 = (bpw_class*)fopAcM_SearchByID(i_this->m3FC); if (pfVar3 != NULL) { - dComIfGd_addRealShadow(i_this->m4E8, pfVar3->mpAnim->getModel()); + dComIfGd_addRealShadow(i_this->mShadowId, pfVar3->mpMorf->getModel()); } } if (REG8_S(1) != 0) { @@ -250,50 +270,47 @@ void body_draw(bpw_class* i_this) { /* 00000998-00000B64 .text kantera_draw__FP9bpw_class */ void kantera_draw(bpw_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - GXColor pdVar1; - u32 uVar2; - J3DModel* pJVar3; cXyz local_20; cXyz local_2c; cXyz local_38; - pJVar3 = i_this->mpAnim->getModel(); + J3DModel* model = i_this->mpMorf->getModel(); local_20.setall(0.0f); if (i_this->m3E7 == 0) { - i_this->mKanteraAnim->entry(pJVar3->getModelData()); + i_this->mpLanternGlowBrkAnm->entry(model->getModelData()); } - i_this->mpAnim->entryDL(); + i_this->mpMorf->entryDL(); if (i_this->m3E7 == 0) { - i_this->mKanteraAnim->remove(pJVar3->getModelData()); + i_this->mpLanternGlowBrkAnm->remove(model->getModelData()); } if (i_this->m3E7 == 0) { - cMtx_copy(i_this->mpAnim->getModel()->getBaseTRMtx(), *calc_mtx); + cMtx_copy(i_this->mpMorf->getModel()->getBaseTRMtx(), *calc_mtx); MtxPosition(&local_20, &local_2c); MtxTrans(local_2c.x, local_2c.y, local_2c.z, false); MtxScale(3.0f, 3.0f, 3.0f, true); cMtx_copy(*calc_mtx, i_this->m2D4); - pdVar1.r = 0xeb; - pdVar1.g = 0x7d; - pdVar1.b = 0; - pdVar1.a = 0; - dComIfGd_setAlphaModelColor(pdVar1); + GXColor color; + color.r = 0xeb; + color.g = 0x7d; + color.b = 0; + color.a = 0; + dComIfGd_setAlphaModelColor(color); dComIfGd_setAlphaModel(dDlst_alphaModel_c::TYPE_THREE_SPHERES, i_this->m2D4, i_this->m47E); } if (i_this->mActionState >= 2) { - local_38.set(actor->current.pos.x, actor->current.pos.y + 400.0f + REG12_F(0x12), actor->current.pos.z); - uVar2 = dComIfGd_setShadow( - i_this->m4E8, + local_38.set(actor->current.pos.x, actor->current.pos.y + 400.0f + REG12_F(18), actor->current.pos.z); + i_this->mShadowId = dComIfGd_setShadow( + i_this->mShadowId, 1, - i_this->mpAnim->getModel(), + i_this->mpMorf->getModel(), &local_38, - REG12_F(0x13) + 1300.0f, + REG12_F(19) + 1300.0f, 200.0f, actor->current.pos.y, i_this->mAcch.GetGroundH(), i_this->mAcch.m_gnd, &actor->tevStr ); - i_this->m4E8 = uVar2; } } @@ -304,12 +321,12 @@ static void damage_ball_draw(bpw_class* i_this) { MtxScale(0.8f, 0.8f, 0.8f, true); cMtx_YrotM(*calc_mtx, actor->shape_angle.y); cMtx_copy(*calc_mtx, i_this->m2D4); - GXColor pdVar1; - pdVar1.r = 0xeb; - pdVar1.g = 0x50; - pdVar1.b = 0; - pdVar1.a = 0; - dComIfGd_setAlphaModelColor(pdVar1); + GXColor color; + color.r = 0xeb; + color.g = 0x50; + color.b = 0; + color.a = 0; + dComIfGd_setAlphaModelColor(color); dComIfGd_setAlphaModel(dDlst_alphaModel_c::TYPE_TWO_SPHERES, i_this->m2D4, i_this->m47E); } @@ -324,23 +341,20 @@ void line_draw(bpw_class*) { /* 00000C24-00000CF0 .text torituki_draw__FP9bpw_class */ void torituki_draw(bpw_class* i_this) { - u16 uVar3; - J3DModelData* pJVar4; - - pJVar4 = i_this->mpAnim->getModel()->getModelData(); - for (uVar3 = 0; uVar3 < pJVar4->getMaterialNum(); uVar3++) { - pJVar4->getMaterialNodePointer(uVar3)->getTevKColor(3)->mColor.a = i_this->m47E; + J3DModelData* modelData = i_this->mpMorf->getModel()->getModelData(); + for (u16 i = 0; i < modelData->getMaterialNum(); i++) { + modelData->getMaterialNodePointer(i)->getTevKColor(3)->mColor.a = i_this->m47E; } dComIfGd_setListMaskOff(); - i_this->mpAnim->updateDL(); + i_this->mpMorf->updateDL(); dComIfGd_setList(); - i_this->mD78.entryMaskOff(); + i_this->mInvisibleModel.entryMaskOff(); } /* 00000CF0-00000DF4 .text daBPW_Draw__FP9bpw_class */ static BOOL daBPW_Draw(bpw_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - J3DModel* pJVar3 = i_this->mpAnim->getModel(); + J3DModel* model = i_this->mpMorf->getModel(); #if VERSION > VERSION_DEMO if (i_this->m408 > 1) { mDoGph_gInf_c::setBlureRate(i_this->m408); @@ -350,25 +364,25 @@ static BOOL daBPW_Draw(bpw_class* i_this) { mDoGph_gInf_c::offBlure(); } #endif - if (i_this->mType != bpw_class::Actor_Type_DAMAGE_BALL_e) { - g_env_light.setLightTevColorType(pJVar3, &actor->tevStr); + if (i_this->mType != ACTOR_TYPE_DAMAGE_BALL) { + dKy_getEnvlight().setLightTevColorType(model, &actor->tevStr); } switch (i_this->mType) { - case bpw_class::Actor_Type_BODY_e: + case ACTOR_TYPE_BODY: body_draw(i_this); break; - case bpw_class::Actor_Type_KANTERA_e: + case ACTOR_TYPE_KANTERA: kantera_draw(i_this); break; - case bpw_class::Actor_Type_DAMAGE_BALL_e: - if (i_this->mUnknownParam2 == bpw_class::Damage_Action_LINE_e) { + case ACTOR_TYPE_DAMAGE_BALL: + if (i_this->mUnknownParam2 == DAMAGE_ACTION_LINE) { line_draw(i_this); } - if (i_this->mUnknownParam2 == bpw_class::Damage_Action_DAMAGE_BALL_e) { + if (i_this->mUnknownParam2 == DAMAGE_ACTION_DAMAGE_BALL) { damage_ball_draw(i_this); } break; - case bpw_class::Actor_Type_TORITUKI_e: + case ACTOR_TYPE_TORITUKI: torituki_draw(i_this); break; } @@ -379,11 +393,11 @@ static BOOL daBPW_Draw(bpw_class* i_this) { void anm_init(bpw_class* i_this, int bckFileIdx, f32 morf, u8 loopMode, f32 speed, int soundFileIdx) { i_this->m3F8 = bckFileIdx; if (soundFileIdx >= 0) { - i_this->mpAnim->setAnm( + i_this->mpMorf->setAnm( (J3DAnmTransform*)dComIfG_getObjectRes("BPW", bckFileIdx), loopMode, morf, speed, 0.0f, -1.0f, dComIfG_getObjectRes("BPW", soundFileIdx) ); } else { - i_this->mpAnim->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("BPW", bckFileIdx), loopMode, morf, speed, 0.0f, -1.0f, NULL); + i_this->mpMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("BPW", bckFileIdx), loopMode, morf, speed, 0.0f, -1.0f, NULL); } } @@ -391,13 +405,12 @@ void anm_init(bpw_class* i_this, int bckFileIdx, f32 morf, u8 loopMode, f32 spee BOOL body_atari_check(bpw_class* i_this) { fopAc_ac_c* actor = &i_this->actor; bool bVar2; - cCcD_Obj* pcVar5; cXyz local_4c; cXyz local_58; - CcAtInfo local_40; + CcAtInfo atInfo; daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); - i_this->m3DF = 0; + i_this->mHitType = 0; if (i_this->m47E == 0) { return 0; } @@ -405,26 +418,26 @@ BOOL body_atari_check(bpw_class* i_this) { if (!i_this->mBodyCoSph.ChkTgHit()) { return 0; } - pcVar5 = i_this->mBodyCoSph.GetTgHitObj(); - if (pcVar5 == NULL) { + cCcD_Obj* hitObj = i_this->mBodyCoSph.GetTgHitObj(); + if (hitObj == NULL) { return 0; } bVar2 = false; - local_40.mpObj = i_this->mBodyCoSph.GetTgHitObj(); - i_this->m3DF = 1; + atInfo.mpObj = i_this->mBodyCoSph.GetTgHitObj(); + i_this->mHitType = 1; if (i_this->m3E0 == 0) { - switch (pcVar5->GetAtType()) { + switch (hitObj->GetAtType()) { case AT_TYPE_LIGHT: - i_this->m3DF = 10; - if (i_this->mBodyAction != bpw_class::Action_DAMAGE_e) { - i_this->mBodyAction = bpw_class::Action_DAMAGE_e; + i_this->mHitType = 10; + if (i_this->mBodyAction != ACTION_DAMAGE) { + i_this->mBodyAction = ACTION_DAMAGE; i_this->mActionState = 0x50; } break; case AT_TYPE_LIGHT_ARROW: - i_this->m3DF = 0xb; - if (i_this->mBodyAction != bpw_class::Action_DAMAGE_e) { - i_this->mBodyAction = bpw_class::Action_DAMAGE_e; + i_this->mHitType = 0xb; + if (i_this->mBodyAction != ACTION_DAMAGE) { + i_this->mBodyAction = ACTION_DAMAGE; i_this->mActionState = 0x50; } break; @@ -434,32 +447,24 @@ BOOL body_atari_check(bpw_class* i_this) { if (i_this->mActionState != 0x53) { return 0; } - switch (pcVar5->GetAtType()) { + switch (hitObj->GetAtType()) { case AT_TYPE_DARKNUT_SWORD: case AT_TYPE_MOBLIN_SPEAR: case AT_TYPE_UNK800: case AT_TYPE_MACHETE: case AT_TYPE_SWORD: fopAcM_seStart(actor, JA_SE_LK_SW_HIT_S, 0x44); - if (player->getCutType() == daPy_py_c::CUT_TYPE_CUT_EA || - player->getCutType() == daPy_py_c::CUT_TYPE_CUT_EB || - player->getCutType() == daPy_py_c::CUT_TYPE_CUT_TURN || - player->getCutType() == daPy_py_c::CUT_TYPE_CUT_ROLL || - player->getCutType() == daPy_py_c::CUT_TYPE_JUMPCUT_SWORD || - player->getCutType() == daPy_py_c::CUT_TYPE_JUMPCUT_STICK || - player->getCutType() == daPy_py_c::CUT_TYPE_JUMPCUT_MACHETE || - player->getCutType() == daPy_py_c::CUT_TYPE_BT_JUMPCUT || - player->getCutType() == daPy_py_c::CUT_TYPE_BT_ROLLCUT || - player->getCutType() == daPy_py_c::CUT_TYPE_BT_VERTICALJUMPCUT || - player->getCutType() == daPy_py_c::CUT_TYPE_JUMPCUT_CLUB || - player->getCutType() == daPy_py_c::CUT_TYPE_JUMPCUT_DN_SWORD || - player->getCutType() == daPy_py_c::CUT_TYPE_JUMPCUT_SPEAR || - player->getCutType() == daPy_py_c::CUT_TYPE_CUT_EXA || - player->getCutType() == daPy_py_c::CUT_TYPE_CUT_EXB || - player->getCutType() == daPy_py_c::CUT_TYPE_CUT_EXMJ || + if (player->getCutType() == daPy_py_c::CUT_TYPE_CUT_EA || player->getCutType() == daPy_py_c::CUT_TYPE_CUT_EB || + player->getCutType() == daPy_py_c::CUT_TYPE_CUT_TURN || player->getCutType() == daPy_py_c::CUT_TYPE_CUT_ROLL || + player->getCutType() == daPy_py_c::CUT_TYPE_JUMPCUT_SWORD || player->getCutType() == daPy_py_c::CUT_TYPE_JUMPCUT_STICK || + player->getCutType() == daPy_py_c::CUT_TYPE_JUMPCUT_MACHETE || player->getCutType() == daPy_py_c::CUT_TYPE_BT_JUMPCUT || + player->getCutType() == daPy_py_c::CUT_TYPE_BT_ROLLCUT || player->getCutType() == daPy_py_c::CUT_TYPE_BT_VERTICALJUMPCUT || + player->getCutType() == daPy_py_c::CUT_TYPE_JUMPCUT_CLUB || player->getCutType() == daPy_py_c::CUT_TYPE_JUMPCUT_DN_SWORD || + player->getCutType() == daPy_py_c::CUT_TYPE_JUMPCUT_SPEAR || player->getCutType() == daPy_py_c::CUT_TYPE_CUT_EXA || + player->getCutType() == daPy_py_c::CUT_TYPE_CUT_EXB || player->getCutType() == daPy_py_c::CUT_TYPE_CUT_EXMJ || player->getCutType() == daPy_py_c::CUT_TYPE_CUT_KESA) { - i_this->m3DF = 2; + i_this->mHitType = 2; anm_init(i_this, BPW_BCK_BOYON_L1, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); } else { anm_init(i_this, BPW_BCK_BOYON_S1, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); @@ -467,19 +472,19 @@ BOOL body_atari_check(bpw_class* i_this) { break; case AT_TYPE_HOOKSHOT: fopAcM_seStart(actor, JA_SE_LK_MS_WEP_HIT, 0x44); - i_this->m3DF = 0xc; + i_this->mHitType = 0xc; anm_init(i_this, BPW_BCK_BOYON_S1, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); break; case AT_TYPE_WIND: bVar2 = true; - i_this->m3DF = 4; + i_this->mHitType = 4; break; case AT_TYPE_LIGHT: bVar2 = true; - i_this->m3DF = 10; + i_this->mHitType = 10; break; case AT_TYPE_BOOMERANG: - i_this->m3DF = 5; + i_this->mHitType = 5; // fallthrough case AT_TYPE_STALFOS_MACE: case AT_TYPE_BOKO_STICK: @@ -488,42 +493,40 @@ BOOL body_atari_check(bpw_class* i_this) { break; case AT_TYPE_SKULL_HAMMER: fopAcM_seStart(actor, JA_SE_LK_HAMMER_HIT, 0x44); - i_this->m3DF = 8; + i_this->mHitType = 8; if (player->getCutType() == daPy_py_c::CUT_TYPE_HAMMER_SIDESWING) { - i_this->m3DF = 9; + i_this->mHitType = 9; } anm_init(i_this, BPW_BCK_BOYON_L1, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); break; case AT_TYPE_BOMB: - i_this->m3DF = 7; + i_this->mHitType = 7; anm_init(i_this, BPW_BCK_BOYON_L1, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); break; case AT_TYPE_ICE_ARROW: - i_this->m3DF = 6; + i_this->mHitType = 6; fopAcM_seStart(actor, JA_SE_LK_MS_WEP_HIT, 0x44); anm_init(i_this, BPW_BCK_BOYON_S1, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); break; case AT_TYPE_LIGHT_ARROW: - i_this->m3DF = 0xb; + i_this->mHitType = 11; fopAcM_seStart(actor, JA_SE_LK_MS_WEP_HIT, 0x44); anm_init(i_this, BPW_BCK_BOYON_S1, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); break; case AT_TYPE_FIRE_ARROW: case AT_TYPE_FIRE: case AT_TYPE_NORMAL_ARROW: - i_this->m3DF = 6; + i_this->mHitType = 6; // fallthrough default: - i_this->m3DF = 0; + i_this->mHitType = 0; fopAcM_seStart(actor, JA_SE_LK_MS_WEP_HIT, 0x44); anm_init(i_this, BPW_BCK_BOYON_S1, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); break; } if (!bVar2) { local_4c = *i_this->mBodyCoSph.GetTgHitPosP(); - local_58.x = 2.0f; - local_58.y = 2.0f; - local_58.z = 2.0f; + local_58.setall(2.0f); dComIfGp_particle_set(dPa_name::ID_AK_JN_NG, &local_4c, &player->shape_angle, &local_58); } return FALSE; @@ -666,17 +669,20 @@ void noroi_check(bpw_class* i_this) { if ((i_this->mAttWaitTimer != 1) && (i_this->mAttWaitTimer != 2 && (i_this->mAttWaitTimer != 0))) { return; } - if ((((i_this->m3F6 != 0) && (i_this->m3E6 == 0)) && (i_this->mBodyAction != bpw_class::Action_BODY_DOWN_KARADA_TAORE_e)) && + if ((((i_this->m3F6 != 0) && (i_this->m3E6 == 0)) && (i_this->mBodyAction != ACTION_BODY_DOWN_KARADA_TAORE)) && ((i_this->mActionState != 10 && (i_this->mActionState != 0xb)) && (i_this->mActionState != 0xc && (i_this->mActionState != 0xd)))) { - if ((((i_this->m3F8 == 0x2a) || (i_this->m3F8 == 0x1d)) || (i_this->m3F8 == 0x1c || (i_this->m3F8 == 0x2b))) && - (fopAcM_searchActorDistance(actor, player) < 530.0f)) - { - i_this->mBodyAction = bpw_class::Action_BODY_DOWN_KARADA_TAORE_e; - i_this->mActionState = 0x4d; + if (((i_this->m3F8 == 0x2a) || (i_this->m3F8 == 0x1d)) || (i_this->m3F8 == 0x1c || (i_this->m3F8 == 0x2b))) { + f32 f31 = 530.0f; + if (fopAcM_searchPlayerDistance(actor) < f31) { + i_this->mBodyAction = ACTION_BODY_DOWN_KARADA_TAORE; + i_this->mActionState = 0x4d; + } } - } else if ((((i_this->mActionState == 5) || (i_this->mActionState == 6)) || (i_this->mBodyAction == bpw_class::Action_BODY_DOWN_KARADA_TAORE_e)) && - (i_this->mSomeCountdownTimers[3] == 0 && (i_this->mBodyAtSph.ChkAtHit()))) + } else if ( + (((i_this->mActionState == 5) || (i_this->mActionState == 6)) || (i_this->mBodyAction == ACTION_BODY_DOWN_KARADA_TAORE)) && + (i_this->mSomeCountdownTimers[3] == 0 && (i_this->mBodyAtSph.ChkAtHit())) + ) { pdVar4 = i_this->mBodyAtSph.GetAtHitAc(); if ((pdVar4 != NULL) && (pdVar4 == player)) { @@ -685,13 +691,15 @@ void noroi_check(bpw_class* i_this) { i_this->mBodyCoSph.OffTgSetBit(); i_this->mBodyCoSph.ClrTgHit(); player2->onConfuse(); - i_this->mSomeCountdownTimers[3] = 0x14; + i_this->mSomeCountdownTimers[3] = DEMO_SELECT(REG11_F(17) + 0x14, 0x14); + s32 r31 = ACTOR_TYPE_BODY; csXyz local_28 = actor->shape_angle; camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); i_this->mFire1DousaPos = player2->getHeadTopPos(); dComIfGp_particle_set(dPa_name::ID_IT_JN_PIYOHIT00, &i_this->mFire1DousaPos); - local_28.y = camera->mAngle.y; - fopAcM_create(PROC_BPW, bpw_class::Actor_Type_TORITUKI_e, &i_this->mFire1DousaPos, fopAcM_GetRoomNo(actor), &local_28); + r31 |= ACTOR_TYPE_TORITUKI; + local_28.y = fopCamM_GetAngleY(camera); + fopAcM_create(PROC_BPW, r31, &i_this->mFire1DousaPos, fopAcM_GetRoomNo(actor), &local_28); } } } @@ -703,7 +711,7 @@ void fire_and_emitter_clear(bpw_class* i_this) { if (i_this->m400 != fpcM_ERROR_PROCESS_ID_e) { pfVar1 = (bpw_class*)fopAcM_SearchByID(i_this->m400); - if ((pfVar1 != NULL) && (pfVar1->mUnknownParam2 == bpw_class::Damage_Action_LINE_e)) { + if ((pfVar1 != NULL) && (pfVar1->mUnknownParam2 == DAMAGE_ACTION_LINE)) { fopAcM_delete(&pfVar1->actor); i_this->m400 = fpcM_ERROR_PROCESS_ID_e; } @@ -749,29 +757,28 @@ void fire_and_emitter_clear(bpw_class* i_this) { /* 00001DA0-00001F40 .text noroi_brk_check__FP9bpw_classUc */ void noroi_brk_check(bpw_class* i_this, u8 param_2) { - J3DAnmTevRegKey* pJVar1; - J3DModel* pJVar2; + J3DAnmTevRegKey* pBrk; - pJVar2 = i_this->mpAnim->getModel(); + J3DModel* model = i_this->mpMorf->getModel(); switch (param_2) { case 0: if (i_this->m3E2 != 2) { i_this->m3E2 = 2; - pJVar1 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_NOROI_S1); - i_this->m2C8->init(pJVar2->getModelData(), pJVar1, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, 0); + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_NOROI_S1); + i_this->mpCurseStartBrkAnm->init(model->getModelData(), pBrk, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, 0); } break; case 1: if (i_this->m3E2 == 2) { i_this->m3E2 = 1; - pJVar1 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_NOROI_E1); - i_this->m2CC->init(pJVar2->getModelData(), pJVar1, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, 0); + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_NOROI_E1); + i_this->mpCurseEndBrkAnm->init(model->getModelData(), pBrk, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, 0); } break; case 2: i_this->m3E2 = 0; - pJVar1 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_DEFAULT); - i_this->m2D0->init(pJVar2->getModelData(), pJVar1, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, 0); + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_DEFAULT); + i_this->mpDefaultBrkAnm->init(model->getModelData(), pBrk, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, 0); break; } } @@ -780,13 +787,13 @@ void noroi_brk_check(bpw_class* i_this, u8 param_2) { BOOL next_att_wait_check(bpw_class* i_this) { if (i_this->mAttWaitTimer != 1) { if ((i_this->mAttWaitTimer != 2) && (i_this->mAttWaitTimer != 0)) { - i_this->mBodyAction = bpw_class::Action_MOVE_DOUSA_e; + i_this->mBodyAction = ACTION_MOVE_DOUSA; i_this->mActionState = 10; return TRUE; } } i_this->mAttWaitTimer = 1; - i_this->mBodyAction = bpw_class::Action_MOVE_DOUSA_e; + i_this->mBodyAction = ACTION_MOVE_DOUSA; i_this->mActionState = 0; return FALSE; } @@ -794,8 +801,6 @@ BOOL next_att_wait_check(bpw_class* i_this) { /* 00001F90-00002114 .text next_status_clear__FP9bpw_classUc */ void next_status_clear(bpw_class* i_this, u8 param_2) { fopAc_ac_c* actor = &i_this->actor; - J3DAnmTevRegKey* pJVar1; - J3DModel* pJVar2; actor->gravity = 0.0f; actor->speed.setall(0.0f); @@ -803,7 +808,7 @@ void next_status_clear(bpw_class* i_this, u8 param_2) { i_this->m490 = 0.0f; i_this->m3E6 = 0; i_this->m3E5 = 0; - i_this->m4A8 = REG8_F(0x10) + 220.0f; + i_this->m4A8 = REG8_F(16) + 220.0f; i_this->m3AC.y = 340.0f; noroi_brk_check(i_this, 1); actor->shape_angle.x = 0; @@ -814,20 +819,20 @@ void next_status_clear(bpw_class* i_this, u8 param_2) { i_this->m3E0 = 0; } if (i_this->m3E1 != 0) { - pJVar2 = i_this->mpAnim->getModel(); + J3DModel* model = i_this->mpMorf->getModel(); i_this->m3E1 = 0; - pJVar1 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_DEFAULT); - i_this->m2D0->init(pJVar2->getModelData(), pJVar1, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, 0); + J3DAnmTevRegKey* pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_DEFAULT); + i_this->mpDefaultBrkAnm->init(model->getModelData(), pBrk, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, 0); } if (i_this->mAttWaitTimer == 0) { i_this->mAttWaitTimer = 1; } i_this->m47A = 0x500; i_this->mBodyCoSph.OffTgShield(); - i_this->mBodyAtSph.OnAtSetBit(); + i_this->mBodyAtSph.OnAtSPrmBit(cCcD_AtSPrm_Set_e); i_this->mBodyAtSph.OnAtHitBit(); i_this->mBodyCoSph.OnTgSetBit(); - i_this->mBodyCoSph.OffCoSetBit(); + i_this->mBodyCoSph.ClrCoSet(); i_this->m498 = 350.0f; i_this->m49C = 400.0f; } @@ -838,24 +843,28 @@ void light_on_off(bpw_class* i_this) { fopAc_ac_c* actor = &i_this->actor; s16 sVar1; int iVar2; - s32 iVar3; - u8 switchNo; - iVar3 = cM_rndF(2.99f); + s32 iVar3 = cM_rndF(2.99f); sVar1 = i_this->m3F6; if (sVar1 != 0) { - switchNo = i_this->mLightState; + u8 switchNo = i_this->mLightState; if (sVar1 == 3) { dComIfGs_onSwitch(switchNo, fopAcM_GetRoomNo(actor)); - dComIfGs_onSwitch(switchNo + 1, fopAcM_GetRoomNo(actor)); - dComIfGs_onSwitch(switchNo + 2, fopAcM_GetRoomNo(actor)); + s32 r28 = switchNo; + r28++; + dComIfGs_onSwitch(r28, fopAcM_GetRoomNo(actor)); + r28++; + dComIfGs_onSwitch(r28, fopAcM_GetRoomNo(actor)); } else if (sVar1 == 4) { dComIfGs_offSwitch(switchNo, fopAcM_GetRoomNo(actor)); - dComIfGs_offSwitch(switchNo + 1, fopAcM_GetRoomNo(actor)); - dComIfGs_offSwitch(switchNo + 2, fopAcM_GetRoomNo(actor)); + s32 r28 = switchNo; + r28++; + dComIfGs_offSwitch(r28, fopAcM_GetRoomNo(actor)); + r28++; + dComIfGs_offSwitch(r28, fopAcM_GetRoomNo(actor)); } else if (i_this->mSomeCountdownTimers[7] == 0) { iVar3 *= 3.0f; - iVar2 = switchNo + (int)light_on_dt[(s32)iVar3]; + iVar2 = i_this->mLightState + light_on_dt[iVar3]; if (sVar1 == 2) { dComIfGs_onSwitch(iVar2, fopAcM_GetRoomNo(actor)); } else { @@ -864,7 +873,8 @@ void light_on_off(bpw_class* i_this) { if (REG0_S(1) != 0) { dComIfGs_offSwitch(iVar2, fopAcM_GetRoomNo(actor)); } - iVar2 = (uint)i_this->mLightState + (int)light_on_dt[(s32)(iVar3 + 1)]; + iVar3++; + iVar2 = i_this->mLightState + light_on_dt[iVar3]; if (i_this->m3F6 == 2) { dComIfGs_onSwitch(iVar2, fopAcM_GetRoomNo(actor)); } else { @@ -873,7 +883,8 @@ void light_on_off(bpw_class* i_this) { if (REG0_S(1) != 0) { dComIfGs_offSwitch(iVar2, fopAcM_GetRoomNo(actor)); } - iVar3 = (uint)i_this->mLightState + (int)light_on_dt[(s32)(iVar3 + 2)]; + iVar3++; + iVar3 = i_this->mLightState + light_on_dt[iVar3]; if (i_this->m3F6 == 2) { dComIfGs_offSwitch(iVar3, fopAcM_GetRoomNo(actor)); } else { @@ -882,8 +893,8 @@ void light_on_off(bpw_class* i_this) { if (REG0_S(1) != 0) { dComIfGs_offSwitch(iVar3, fopAcM_GetRoomNo(actor)); } - i_this->mSomeCountdownTimers[7] = REG0_S(4) + 0xf0; - i_this->mSomeCountdownTimers[7] += (int)cM_rndF((s32)(REG0_S(5) + 0x78U)); + i_this->mSomeCountdownTimers[7] = REG0_S(4) + DEMO_SELECT(180, 240); + i_this->mSomeCountdownTimers[7] += (int)cM_rndF((s32)(REG0_S(5) + DEMO_SELECT(90, 120))); } } } @@ -893,7 +904,7 @@ void* skull_search_sub(void* param_1, void* param_2) { UNUSED(param_2); fopAc_ac_c* actor = (fopAc_ac_c*)param_1; - if ((get_check_count < 100) && (fopAc_IsActor(actor))) { + if ((get_check_count < 100) && (fopAcM_IsActor(actor))) { if ((fopAcM_GetName(actor) == PROC_BL) && (actor->health > 0)) { check_info[get_check_count] = actor; get_check_count++; @@ -904,50 +915,49 @@ void* skull_search_sub(void* param_1, void* param_2) { /* 000024B0-000026F8 .text search_get_skull__FP9bpw_classUc */ void search_get_skull(bpw_class* i_this, u8 param_2) { - /* Nonmatching - regalloc */ fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* actor2; - f32 dVar5; get_check_count = 0; fpcM_Search(skull_search_sub, i_this); if (get_check_count != 0) { - for (s32 i = 0; i < get_check_count; actor2 = check_info[i], i++) { - if (!fopAcM_CheckStatus(actor2, fopAcStts_CARRY_e)) { - switch (param_2) { - case 0: - dVar5 = fopAcM_searchActorDistance(actor, actor2); - if (dVar5 > 300.0f) { - if ((s16)cLib_distanceAngleS(actor->current.angle.y, fopAcM_searchActorAngleY(actor, actor2)) < 22000) { - actor2->current.angle.y = fopAcM_searchActorAngleY(actor2, actor); - actor2->speedF = cM_rndFX(5.0f) + 10.0f; - actor2->shape_angle.x -= (s16)((fopAcM_GetID(actor2) & 3) * 0x300 + 0x1000); - actor2->speed.y = 0.0f; - } - } else { - actor2->speedF = 0.0f; - } - break; - case 1: + for (s32 i = 0; i < get_check_count; i++) { + actor2 = check_info[i]; + if (fopAcM_checkCarryNow(actor2)) { + return; + } + switch (param_2) { + case 0: + if (fopAcM_searchActorDistance(actor, actor2) > 300.0f) { if ((s16)cLib_distanceAngleS(actor->current.angle.y, fopAcM_searchActorAngleY(actor, actor2)) < 22000) { - if (i_this->mActionState == 0x35) { - actor2->speedF = cM_rndFX(3.0f) + 3.0f; - } else { - actor2->speedF = cM_rndFX(5.0f) + 20.0f; - actor2->speed.y += cM_rndF(5.0f) + 5.0f; - } - if (actor2->speed.y > 20.0f) { - actor2->speed.y = 20.0f; - } - actor2->current.angle.y = fopAcM_searchActorAngleY(actor, actor2); - actor2->current.angle.y += (int)cM_rndFX(4096.0f); - actor2->shape_angle.x += -0x2000; + actor2->current.angle.y = fopAcM_searchActorAngleY(actor2, actor); + actor2->speedF = cM_rndFX(5.0f) + 10.0f; + actor2->shape_angle.x -= (s16)((fopAcM_GetID(actor2) & 3) * 0x300 + 0x1000); + actor2->speed.y = 0.0f; } - break; - case 2: + } else { actor2->speedF = 0.0f; - break; } + break; + case 1: + if ((s16)cLib_distanceAngleS(actor->current.angle.y, fopAcM_searchActorAngleY(actor, actor2)) < 22000) { + if (i_this->mActionState == 0x35) { + actor2->speedF = cM_rndFX(3.0f) + 3.0f; + } else { + actor2->speedF = cM_rndFX(5.0f) + 20.0f; + actor2->speed.y += cM_rndF(5.0f) + 5.0f; + } + if (actor2->speed.y > 20.0f) { + actor2->speed.y = 20.0f; + } + actor2->current.angle.y = fopAcM_searchActorAngleY(actor, actor2); + actor2->current.angle.y += (int)cM_rndFX(4096.0f); + actor2->shape_angle.x += -0x2000; + } + break; + case 2: + actor2->speedF = 0.0f; + break; } } } @@ -961,7 +971,7 @@ void maai_sub(bpw_class* i_this) { daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); fopAc_ac_c* actor = &i_this->actor; - dVar4 = std::fabsf(player->speedF); + dVar4 = std::fabsf(player->getSpeedF()); if (!(fopAcM_searchPlayerDistance(actor) > 500.0f)) { cMtx_YrotS(*calc_mtx, fopAcM_searchPlayerAngleY(actor)); local_2c.x = 0.0f; @@ -1054,16 +1064,10 @@ s32 kantera_pos_search(bpw_class* i_this) { void action_dousa(bpw_class* i_this) { /* Nonmatching - regalloc */ fopAc_ac_c* actor = &i_this->actor; - f32 fVar3; - bool bVar9; - bpw_class* pfVar6; - s16 sVar7; - f32 dVar14; - f32 fVar15; cXyz local_c0; daPy_py_c* player = daPy_getPlayerActorClass(); - dBgS_LinChk local_b4; + dBgS_LinChk linChk; switch (i_this->mActionState) { case 0: i_this->m488 = 1.0f; @@ -1072,19 +1076,19 @@ void action_dousa(bpw_class* i_this) { i_this->mSomeCountdownTimers[i + 10] = 0; } if (i_this->m3F8 != 0x2a) { - anm_init(i_this, BPW_BCK_WAIT1, 15.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + anm_init(i_this, BPW_BCK_WAIT1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_LOOP, 1.0f, -1); } i_this->mSomeCountdownTimers[0] = 10; i_this->mSomeCountdownTimers[0] += (int)cM_rndF(i_this->mSomeCountdownTimers[0]); switch (i_this->m3F6) { case 0: - i_this->m47A = 0x100; + i_this->m47A = DEMO_SELECT(REG11_F(1) + 0x100, 0x100); break; case 1: - i_this->m47A = 0x300; + i_this->m47A = DEMO_SELECT(REG11_F(2) + 0x300, 0x300); break; case 2: - i_this->m47A = 0x500; + i_this->m47A = DEMO_SELECT(REG11_F(3) + 0x500, 0x500); break; } i_this->mActionState++; @@ -1099,11 +1103,11 @@ void action_dousa(bpw_class* i_this) { i_this->mSomeCountdownTimers[0] += (int)cM_rndF(i_this->mSomeCountdownTimers[0]); i_this->m488 = 1.0f; if (i_this->m3F6 == 2) { - i_this->m490 = i_this->m490 * (REG8_F(0) + 1.35f); + i_this->m490 = i_this->m490 * DEMO_SELECT(REG11_F(4) + 1.75f, REG8_F(0) + 1.35f); i_this->m488 = 5.0f; } if (i_this->m3F8 != 0x1d) { - anm_init(i_this, BPW_BCK_MOVEF1, 15.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + anm_init(i_this, BPW_BCK_MOVEF1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_LOOP, 1.0f, -1); } i_this->mActionState++; case 3: @@ -1111,35 +1115,33 @@ void action_dousa(bpw_class* i_this) { i_this->m490 = 0.0f; switch (i_this->m3F6) { case 0: - i_this->mBodyAction = bpw_class::Action_ATTACK_KOUGEKI_e; + i_this->mBodyAction = ACTION_ATTACK_KOUGEKI; i_this->mActionState = 0x14; break; case 1: case 2: if (dComIfGp_getDetect().chk_light(&player->current.pos)) { - i_this->mBodyAction = bpw_class::Action_ATTACK_KOUGEKI_e; + i_this->mBodyAction = ACTION_ATTACK_KOUGEKI; i_this->mActionState = 0x28; + } else if (REG12_S(9) != 0) { + i_this->mActionState = 4; } else { - if (REG12_S(9) != 0) { - i_this->mActionState = 4; - } else { - dVar14 = cM_rnd(); - if (dVar14 < 0.5f) { - fVar15 = i_this->mBodyPos.x - actor->current.pos.x; - fVar3 = i_this->mBodyPos.z - actor->current.pos.z; - if (std::sqrtf(fVar15 * fVar15 + fVar3 * fVar3) < 1100.0f) { - i_this->mBodyAction = bpw_class::Action_BODY_DOWN_KARADA_TAORE_e; - i_this->mActionState = 0x46; - break; - } + if (cM_rnd() < 0.5f) { + f32 f5 = 1100.0f; + f32 fVar15 = i_this->mBodyPos.x - actor->current.pos.x; + f32 fVar3 = i_this->mBodyPos.z - actor->current.pos.z; + if (std::sqrtf(SQUARE(fVar15) + SQUARE(fVar3)) < f5) { + i_this->mBodyAction = ACTION_BODY_DOWN_KARADA_TAORE; + i_this->mActionState = 0x46; + break; } - i_this->mActionState = 4; } + i_this->mActionState = 4; } } break; case 4: - anm_init(i_this, BPW_BCK_MOVEB1, (REG12_F(0) + 15.0f), J3DFrameCtrl::EMode_NONE, 1.0f, -1); + anm_init(i_this, BPW_BCK_MOVEB1, REG12_F(0) + 15.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->mSomeCountdownTimers[0] = (s16)(int)(REG12_F(1) + 40.0f); noroi_brk_check(i_this, 0); fopAcM_monsSeStart(actor, JA_SE_CV_BPW_CURSE, 0); @@ -1148,10 +1150,10 @@ void action_dousa(bpw_class* i_this) { maai_sub(i_this); if (i_this->mSomeCountdownTimers[0] == 0) { i_this->m3E6 = 1; - actor->speedF = REG8_F(0xc) + 75.0f; - i_this->m488 = REG8_F(0xd) + 2.0f; + actor->speedF = REG8_F(12) + 75.0f; + i_this->m488 = REG8_F(13) + 2.0f; i_this->m490 = 0.0f; - anm_init(i_this, BPW_BCK_MOVES1, 15.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + anm_init(i_this, BPW_BCK_MOVES1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->mActionState++; // fallthrough @@ -1159,7 +1161,7 @@ void action_dousa(bpw_class* i_this) { if (actor->speedF < 1.0f) { actor->speedF = 0.0f; } - cMtx_YrotS(*calc_mtx, (int)actor->current.angle.y); + cMtx_YrotS(*calc_mtx, actor->current.angle.y); local_c0.x = 0.0f; local_c0.y = 0.0f; local_c0.z = 500.0f; @@ -1168,18 +1170,19 @@ void action_dousa(bpw_class* i_this) { i_this->m328[0].y += 400.0f; i_this->m304[0] = actor->current.pos; i_this->m304[0].y += 400.0f; - local_b4.Set(i_this->m304, i_this->m328, actor); - bVar9 = dComIfG_Bgsp()->LineCross(&local_b4); - if (bVar9) { + linChk.Set(i_this->m304, i_this->m328, actor); + if (dComIfG_Bgsp()->LineCross(&linChk)) { actor->speedF = 0.0f; } - f32 f1 = actor->speedF; - f32 f0 = 0.0f; + f32 f0; + f32 f1; + f1 = actor->speedF; + f0 = 0.0f; if (f1 == f0) { noroi_brk_check(i_this, 1); next_status_clear(i_this, 1); if (player->checkConfuse()) { - i_this->mBodyAction = bpw_class::Action_ATTACK_KOUGEKI_e; + i_this->mBodyAction = ACTION_ATTACK_KOUGEKI; i_this->mActionState = 0x14; } else { i_this->mActionState = 0; @@ -1193,7 +1196,7 @@ void action_dousa(bpw_class* i_this) { i_this->mSomeCountdownTimers[i + 10] = 0; } if (i_this->m3F8 != 0x2a) { - anm_init(i_this, BPW_BCK_WAIT1, 15.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + anm_init(i_this, BPW_BCK_WAIT1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_LOOP, 1.0f, -1); } i_this->mActionState++; case 0xb: @@ -1210,7 +1213,7 @@ void action_dousa(bpw_class* i_this) { if (i_this->m47E >= 0x95) { i_this->m47E = 0x96; i_this->m480 = 0x96; - anm_init(i_this, BPW_BCK_HIROU1, 15.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + anm_init(i_this, BPW_BCK_HIROU1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_NONE, 1.0f, -1); kantera_pos_search(i_this); i_this->mActionState++; } @@ -1219,10 +1222,10 @@ void action_dousa(bpw_class* i_this) { if (i_this->m462 == 0) { kantera_pos_search(i_this); } - if (i_this->mpAnim->checkFrame(12.0f)) { + if (i_this->mpMorf->checkFrame(12.0f)) { fopAcM_seStart(actor, JA_SE_CM_BPW_GET_KANTERA, 0); if (i_this->m3FC != fpcM_ERROR_PROCESS_ID_e) { - pfVar6 = (bpw_class*)fopAcM_SearchByID(i_this->m3FC); + bpw_class* pfVar6 = (bpw_class*)fopAcM_SearchByID(i_this->m3FC); if (pfVar6 != NULL) { pfVar6->actor.gravity = 0.0f; pfVar6->actor.speedF = 0.0f; @@ -1238,10 +1241,12 @@ void action_dousa(bpw_class* i_this) { i_this->m390 = 0.0f; i_this->mAttWaitTimer = 1; } - if (i_this->mpAnim->isStop()) { + if (i_this->mpMorf->isStop()) { next_status_clear(i_this, 1); +#if VERSION > VERSION_DEMO i_this->mSomeCountdownTimers[2] = 0; - i_this->mBodyAction = bpw_class::Action_ATTACK_KOUGEKI_e; +#endif + i_this->mBodyAction = ACTION_ATTACK_KOUGEKI; i_this->mActionState = 0x14; } // fallthrough @@ -1254,8 +1259,7 @@ void action_dousa(bpw_class* i_this) { cLib_addCalc0(&i_this->m48C, 1.0f, 10.0f); if ((((i_this->mActionState != 10) && (i_this->mActionState != 0xb)) && (i_this->mActionState != 0xc)) && (i_this->mActionState != 0xd)) { if (i_this->mActionState != 6) { - sVar7 = fopAcM_searchPlayerAngleY(actor); - i_this->m476 = sVar7; + i_this->m476 = fopAcM_searchPlayerAngleY(actor); } alpha_anime(i_this); fuwafuwa_calc(i_this); @@ -1266,19 +1270,8 @@ void action_dousa(bpw_class* i_this) { /* 00003A30-00004870 .text action_kougeki__FP9bpw_class */ void action_kougeki(bpw_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - f32 fVar1; - bpw_class* pfVar6; - bpw_class* pfVar5; - bpw_class* pfVar8; - s16 sVar8; - bpw_class* pfVar7; - JPABaseEmitter* pJVar11; - f32 dVar14; - f32 fVar15; - cXyz local_38; - cXyz cStack_44; - daPy_py_c* player = daPy_getPlayerActorClass(); + switch (i_this->mActionState) { case 0x14: if (i_this->mSomeCountdownTimers[2] != 0) @@ -1287,7 +1280,7 @@ void action_kougeki(bpw_class* i_this) { i_this->mSomeCountdownTimers[i + 10] = 0; } if (i_this->m3F8 != 0x2b) { - anm_init(i_this, BPW_BCK_WARAU1, 15.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + anm_init(i_this, BPW_BCK_WARAU1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_LOOP, 1.0f, -1); } i_this->m47A = 0x500; i_this->m4A0 = 0.0f; @@ -1295,8 +1288,7 @@ void action_kougeki(bpw_class* i_this) { i_this->mActionState++; // fallthrough case 0x15: - sVar8 = fopAcM_searchPlayerAngleY(actor); - i_this->m476 = sVar8; + i_this->m476 = fopAcM_searchPlayerAngleY(actor); maai_sub(i_this); if (i_this->mSomeCountdownTimers[0] != 0) { break; @@ -1311,8 +1303,8 @@ void action_kougeki(bpw_class* i_this) { // Fall-through case 0: i_this->mActionState = 0x28; - dVar14 = fopAcM_searchPlayerDistance(actor); - if (dVar14 < 1050.0f) { + f32 f31 = 1050.0f; + if (fopAcM_searchPlayerDistance(actor) < f31) { i_this->mActionState = 0x3c; } break; @@ -1325,86 +1317,113 @@ void action_kougeki(bpw_class* i_this) { case 0x28: if (i_this->mSomeCountdownTimers[2] != 0) break; - anm_init(i_this, BPW_BCK_SUIKOMU1, 15.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + anm_init(i_this, BPW_BCK_SUIKOMU1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->mSomeCountdownTimers[0] = 30; i_this->mSomeCountdownTimers[0] += (int)cM_rndF(i_this->mSomeCountdownTimers[0]); #if VERSION == VERSION_DEMO i_this->m508_demo = dComIfGp_particle_set(dPa_name::ID_AK_SN_BPWINHALE01, &i_this->m394); #else if (i_this->m540.getEmitter() != NULL) { - dComIfGp_particle_set(dPa_name::ID_AK_SN_BPWINHALE01, &i_this->m394, NULL, NULL, 0xff, &i_this->m540); + dComIfGp_particle_set(dPa_name::ID_AK_SN_BPWINHALE01, &i_this->m394, NULL, NULL, 0xFF, &i_this->m540); } #endif i_this->mActionState++; // fallthrough - case 0x29: + case 0x29: { +#if VERSION == VERSION_DEMO + cXyz local_68 = actor->eyePos; + actor->eyePos = i_this->m3C4; + fopAcM_seStart(actor, JA_SE_OBJ_BPW_BREATH_IN, 0); + actor->eyePos = local_68; +#else mDoAud_seStart(JA_SE_OBJ_BPW_BREATH_IN, &i_this->m3C4, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); +#endif i_this->m476 = fopAcM_searchPlayerAngleY(actor); search_get_skull(i_this, 0); #if VERSION == VERSION_DEMO if (i_this->m508_demo != NULL) { - i_this->m508_demo->setGlobalSRTMatrix(i_this->mpAnim->getModel()->getAnmMtx(2)); + i_this->m508_demo->setGlobalSRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(2)); } #else if (i_this->m540.getEmitter() != NULL) { - i_this->m540.getEmitter()->setGlobalSRTMatrix(i_this->mpAnim->getModel()->getAnmMtx(2)); + i_this->m540.getEmitter()->setGlobalSRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(2)); } #endif if (i_this->mSomeCountdownTimers[1] == 0) { - pJVar11 = dComIfGp_particle_set(dPa_name::ID_AK_SN_BPWINHALE00, &i_this->m394, &actor->shape_angle); - if (pJVar11 != NULL) { - pJVar11->setGlobalSRTMatrix(i_this->mpAnim->getModel()->getAnmMtx(2)); + JPABaseEmitter* emitter = dComIfGp_particle_set(dPa_name::ID_AK_SN_BPWINHALE00, &i_this->m394, &actor->shape_angle); + if (emitter != NULL) { + emitter->setGlobalSRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(2)); } i_this->mSomeCountdownTimers[1] = 6; } if (i_this->mSomeCountdownTimers[0] != 0) { - dVar14 = fopAcM_searchPlayerDistance(actor); - if (dVar14 > 300.0f) { + if (fopAcM_searchPlayerDistance(actor) > 300.0f) { player->setOutPower(10.0f, fopAcM_searchPlayerAngleY(actor) + 0x8000, 1); } } else { -#if VERSION > VERSION_DEMO +#if VERSION == VERSION_DEMO + if (i_this->m508_demo) { + i_this->m508_demo->becomeInvalidEmitter(); + i_this->m508_demo = NULL; + } +#else i_this->m540.remove(); #endif - anm_init(i_this, BPW_BCK_IKI1, 15.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + anm_init(i_this, BPW_BCK_IKI1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->mActionState++; } break; + } case 0x2a: i_this->m476 = fopAcM_searchPlayerAngleY(actor); search_get_skull(i_this, 2); - if (i_this->mpAnim->isStop()) { + if (i_this->mpMorf->isStop()) { i_this->mSomeCountdownTimers[0] = 0x5a; i_this->mSomeCountdownTimers[0] += (int)cM_rndF(i_this->mSomeCountdownTimers[0]); -#if VERSION > VERSION_DEMO - if (i_this->m52C.getEmitter() == NULL) -#endif - { - dComIfGp_particle_set(dPa_name::ID_AK_SN_BPWBLOW00, &i_this->m394, NULL, NULL, 0xff, DEMO_SELECT(NULL, &i_this->m52C)); +#if VERSION == VERSION_DEMO + i_this->m50C_demo = dComIfGp_particle_set(dPa_name::ID_AK_SN_BPWBLOW00, &i_this->m394, NULL, NULL, 0xFF, DEMO_SELECT(NULL, &i_this->m52C)); +#else + if (i_this->m52C.getEmitter() == NULL) { + dComIfGp_particle_set(dPa_name::ID_AK_SN_BPWBLOW00, &i_this->m394, NULL, NULL, 0xFF, DEMO_SELECT(NULL, &i_this->m52C)); } +#endif i_this->mFire1DousaPos = actor->current.pos; i_this->mFire1DousaPos.y = i_this->mAcch.GetGroundH(); i_this->mFire1DousaRot = actor->shape_angle; +#if VERSION == VERSION_DEMO + i_this->m50C.remove(); + i_this->m510_demo = dComIfGp_particle_setToon( + dPa_name::ID_AK_ST_BPWBLOWSMOKE00, &i_this->mFire1DousaPos, &i_this->mFire1DousaRot, NULL, 0xa0, &i_this->m50C, fopAcM_GetRoomNo(actor) + ); +#else if (i_this->m50C.getEmitter() == NULL) { dComIfGp_particle_setToon( dPa_name::ID_AK_ST_BPWBLOWSMOKE00, &i_this->mFire1DousaPos, &i_this->mFire1DousaRot, NULL, 0xa0, &i_this->m50C, fopAcM_GetRoomNo(actor) ); } +#endif anm_init(i_this, BPW_BCK_IKI_WAIT1, 0.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->mActionState++; } break; - case 0x2b: + case 0x2b: { +#if VERSION == VERSION_DEMO + cXyz local_5c = actor->eyePos; + actor->eyePos = i_this->m3C4; + fopAcM_seStart(actor, JA_SE_OBJ_BPW_BREATH_OUT, 0); + actor->eyePos = local_5c; +#else mDoAud_seStart(JA_SE_OBJ_BPW_BREATH_OUT, &i_this->m3C4, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); +#endif i_this->m476 = fopAcM_searchPlayerAngleY(actor); search_get_skull(i_this, 1); #if VERSION == VERSION_DEMO if (i_this->m50C_demo != NULL) { - i_this->m50C_demo->setGlobalSRTMatrix(i_this->mpAnim->getModel()->getAnmMtx(2)); + i_this->m50C_demo->setGlobalSRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(2)); } #else if (i_this->m52C.getEmitter() != NULL) { - i_this->m52C.getEmitter()->setGlobalSRTMatrix(i_this->mpAnim->getModel()->getAnmMtx(2)); + i_this->m52C.getEmitter()->setGlobalSRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(2)); } #endif i_this->mFire1DousaPos = actor->current.pos; @@ -1419,39 +1438,47 @@ void action_kougeki(bpw_class* i_this) { i_this->mSomeCountdownTimers[2] = (s16)(int)(REG12_F(7) + 90.0f); } break; + } case 0x32: - anm_init(i_this, BPW_BCK_SUIKOMU1, 15.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + anm_init(i_this, BPW_BCK_SUIKOMU1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->mSomeCountdownTimers[0] = 0x4b; i_this->mSomeCountdownTimers[1] = (s16)(int)(REG8_F(2) + 20.0f); i_this->mKankyouHendouState = 2; i_this->mActionState++; // fallthrough - case 0x33: + case 0x33: { +#if VERSION == VERSION_DEMO + cXyz local_50 = actor->eyePos; + actor->eyePos = i_this->m3C4; + fopAcM_seStart(actor, JA_SE_OBJ_BPW_BREATH_IN, 0); + actor->eyePos = local_50; +#else mDoAud_seStart(JA_SE_OBJ_BPW_BREATH_IN, &i_this->m3C4, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); +#endif if (i_this->mSomeCountdownTimers[1] != 0) { i_this->m476 = fopAcM_searchPlayerAngleY(actor); } i_this->m47A = (s16)(int)(REG21_F(2) + 140.0f); search_get_skull(i_this, 0); if (i_this->mSomeCountdownTimers[0] != 0) { - dVar14 = fopAcM_searchPlayerDistance(actor); - if (dVar14 > 300.0f) { + if (fopAcM_searchPlayerDistance(actor) > 300.0f) { player->setOutPower(10.0f, fopAcM_searchPlayerAngleY(actor) + 0x8000, 1); } } else { - anm_init(i_this, BPW_BCK_HONOO1, 15.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + anm_init(i_this, BPW_BCK_HONOO1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->mActionState++; } break; + } case 0x34: i_this->m476 = fopAcM_searchPlayerAngleY(actor); i_this->m47A = (s16)(int)(REG21_F(2) + 140.0f); search_get_skull(i_this, 2); - if (i_this->mpAnim->isStop()) { - pfVar6 = (bpw_class*)fopAcM_SearchByID(i_this->m3FC); + if (i_this->mpMorf->isStop()) { + bpw_class* pfVar6 = (bpw_class*)fopAcM_SearchByID(i_this->m3FC); if (pfVar6 != NULL) { - u32 params = bpw_class::Actor_Type_DAMAGE_BALL_e; - params |= bpw_class::Damage_Action_LINE_e << 8; + u32 params = ACTOR_TYPE_DAMAGE_BALL; + params |= DAMAGE_ACTION_LINE << 8; i_this->m400 = fopAcM_create(PROC_BPW, params, &pfVar6->m358, fopAcM_GetRoomNo(actor), &actor->current.angle); i_this->mSomeCountdownTimers[0] = 0x46; i_this->mSomeCountdownTimers[0] += (int)cM_rndF(i_this->mSomeCountdownTimers[0]); @@ -1463,26 +1490,33 @@ void action_kougeki(bpw_class* i_this) { } } break; - case 0x35: + case 0x35: { +#if VERSION == VERSION_DEMO + cXyz local_44 = actor->eyePos; + actor->eyePos = i_this->m3C4; + fopAcM_seStart(actor, JA_SE_OBJ_BPW_FIREBLAST, 0); + actor->eyePos = local_44; +#else mDoAud_seStart(JA_SE_OBJ_BPW_FIREBLAST, &i_this->m3C4, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); +#endif i_this->m476 = fopAcM_searchPlayerAngleY(actor); gouen_maai_sub(i_this); - pfVar5 = (bpw_class*)fopAcM_SearchByID(i_this->m3FC); + bpw_class* pfVar5 = (bpw_class*)fopAcM_SearchByID(i_this->m3FC); if (pfVar5 != NULL) { - pfVar8 = (bpw_class*)fopAcM_SearchByID(i_this->m400); + bpw_class* pfVar8 = (bpw_class*)fopAcM_SearchByID(i_this->m400); if (pfVar8 != NULL) { pfVar8->actor.current.pos = pfVar5->m358; pfVar8->actor.current.angle = actor->shape_angle; pfVar8->actor.shape_angle.y = actor->shape_angle.y; - fVar15 = player->current.pos.x - pfVar8->actor.current.pos.x; - dVar14 = player->current.pos.y - pfVar8->actor.current.pos.y; - fVar1 = player->current.pos.z - pfVar8->actor.current.pos.z; - fVar15 = std::sqrtf(fVar15 * fVar15 + fVar1 * fVar1); + f32 fVar15 = player->current.pos.x - pfVar8->actor.current.pos.x; + f32 dVar14 = player->current.pos.y - pfVar8->actor.current.pos.y; + f32 fVar1 = player->current.pos.z - pfVar8->actor.current.pos.z; + fVar15 = std::sqrtf(SQUARE(fVar15) + SQUARE(fVar1)); pfVar8->actor.shape_angle.x = -cM_atan2s(dVar14, fVar15); } } i_this->m47A = (s16)(int)(REG21_F(2) + 140.0f); - if ((REG8_S(4) == 0) && (GOUEN_FIRE_HIT != 0 || (i_this->mSomeCountdownTimers[0] == 0))) { + if ((DEMO_SELECT(REG8_S(5), REG8_S(4)) == 0) && (GOUEN_FIRE_HIT != 0 || (i_this->mSomeCountdownTimers[0] == 0))) { fire_and_emitter_clear(i_this); next_status_clear(i_this, 1); next_att_wait_check(i_this); @@ -1491,6 +1525,7 @@ void action_kougeki(bpw_class* i_this) { i_this->mSomeCountdownTimers[5] = REG21_S(0) + 10; } break; + } case 0x3c: i_this->mSomeCountdownTimers[0] = 0x28; i_this->mSomeCountdownTimers[0] += (int)cM_rndF(i_this->mSomeCountdownTimers[0]); @@ -1498,7 +1533,7 @@ void action_kougeki(bpw_class* i_this) { i_this->mSomeCountdownTimers[5] = 0; i_this->mAttWaitTimer = 2; if (i_this->m3F8 != 5) { - anm_init(i_this, BPW_BCK_ATTACK_KAN1, 15.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + anm_init(i_this, BPW_BCK_ATTACK_KAN1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_LOOP, 1.0f, -1); fopAcM_monsSeStart(actor, JA_SE_CV_BPW_ATTACK, 0); } i_this->mActionState++; @@ -1509,14 +1544,16 @@ void action_kougeki(bpw_class* i_this) { fopAcM_seStart(actor, JA_SE_CM_BPW_SWING_KANTERA, 0); if (i_this->mSomeCountdownTimers[1] == 0) { fopAcM_seStart(actor, JA_SE_OBJ_BPW_FIRE_OUT, 0); - pfVar7 = (bpw_class*)fopAcM_SearchByID(i_this->m3FC); + bpw_class* pfVar7 = (bpw_class*)fopAcM_SearchByID(i_this->m3FC); if (pfVar7 != NULL) { - u32 params = bpw_class::Actor_Type_DAMAGE_BALL_e; - params |= bpw_class::Damage_Action_DAMAGE_BALL_e << 8; - cMtx_YrotS(*calc_mtx, (int)actor->shape_angle.y); + u32 params = ACTOR_TYPE_DAMAGE_BALL; + params |= DAMAGE_ACTION_DAMAGE_BALL << 8; + cMtx_YrotS(*calc_mtx, actor->shape_angle.y); + cXyz local_38; local_38.x = 0.0f; local_38.y = 0.0f; local_38.z = 20.0f; + cXyz cStack_44; MtxPosition(&local_38, &cStack_44); cStack_44 += pfVar7->m358; i_this->m400 = fopAcM_create(PROC_BPW, params, &cStack_44, fopAcM_GetRoomNo(actor), &actor->current.angle); @@ -1545,7 +1582,7 @@ void action_kougeki(bpw_class* i_this) { /* 00004870-000051E0 .text action_karada_taore__FP9bpw_class */ void action_karada_taore(bpw_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - JPABaseEmitter* pJVar4; + JPABaseEmitter* emitter; GXColor local_24; GXColor local_28; @@ -1556,7 +1593,7 @@ void action_karada_taore(bpw_class* i_this) { i_this->mSomeCountdownTimers[i + 10] = 0; } if (i_this->m3F8 != 0x28) { - anm_init(i_this, BPW_BCK_TAME1, 15.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + anm_init(i_this, BPW_BCK_TAME1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_NONE, 1.0f, -1); } fopAcM_monsSeStart(actor, JA_SE_CV_BPW_CURSE, 0); noroi_brk_check(i_this, 0); @@ -1566,28 +1603,28 @@ void action_karada_taore(bpw_class* i_this) { // fallthrough case 0x47: i_this->m476 = fopAcM_searchPlayerAngleY(actor); - if (i_this->mpAnim->checkFrame(26.0f)) { + if (i_this->mpMorf->checkFrame(DEMO_SELECT(REG11_F(15) + 26.0f, 26.0f))) { i_this->mFire1DousaPos = actor->current.pos; i_this->mFire1DousaPos.y = i_this->mAcch.GetGroundH(); i_this->m5E0[1].remove(); - pJVar4 = dComIfGp_particle_setToon( + emitter = dComIfGp_particle_setToon( dPa_name::ID_AK_ST_BPWJUMPSMOKE00, &i_this->mFire1DousaPos, &actor->shape_angle, NULL, 0xb9, &i_this->m5E0[1], fopAcM_GetRoomNo(actor) ); - if (pJVar4 != NULL) { + if (emitter != NULL) { dKy_get_seacolor(&local_24, &local_28); - pJVar4->setGlobalPrmColor(local_24.r, local_24.g, local_24.b); - pJVar4->setGlobalEnvColor(local_28.r, local_28.g, local_28.b); + emitter->setGlobalPrmColor(local_24.r, local_24.g, local_24.b); + emitter->setGlobalEnvColor(local_28.r, local_28.g, local_28.b); } fopAcM_seStart(actor, JA_SE_CM_BPW_J_BPRESS_JUMP, 0); actor->speed.y = REG8_F(6) + 100.0f; actor->gravity = -(REG8_F(7) + 6.0f); actor->speedF = REG8_F(8) + 30.0f; - i_this->m4A8 = 500.0f; + i_this->m4A8 = DEMO_SELECT(REG11_F(16) + 500.0f, 500.0f); i_this->mActionState++; } break; case 0x48: - if ((i_this->mpAnim->isStop()) && (i_this->m3F8 != 0x19)) { + if ((i_this->mpMorf->isStop()) && (i_this->m3F8 != 0x19)) { anm_init(i_this, BPW_BCK_JUMP1, 0.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->mAttWaitTimer = 0; i_this->mActionState++; @@ -1613,13 +1650,13 @@ void action_karada_taore(bpw_class* i_this) { i_this->mFire1DousaPos = actor->current.pos; i_this->mFire1DousaPos.y = i_this->mAcch.GetGroundH(); i_this->m5E0[2].remove(); - pJVar4 = dComIfGp_particle_setToon( + emitter = dComIfGp_particle_setToon( dPa_name::ID_AK_ST_BPWPRESSSMOKE00, &i_this->mFire1DousaPos, &actor->shape_angle, NULL, 0xb9, &i_this->m5E0[2], fopAcM_GetRoomNo(actor) ); - if (pJVar4 != NULL) { + if (emitter != NULL) { dKy_get_seacolor(&local_24, &local_28); - pJVar4->setGlobalPrmColor(local_24.r, local_24.g, local_24.b); - pJVar4->setGlobalEnvColor(local_28.r, local_28.g, local_28.b); + emitter->setGlobalPrmColor(local_24.r, local_24.g, local_24.b); + emitter->setGlobalEnvColor(local_28.r, local_28.g, local_28.b); } i_this->mActionState++; break; @@ -1636,19 +1673,19 @@ void action_karada_taore(bpw_class* i_this) { i_this->mActionState++; case 0x4c: if (i_this->m3F8 == 0x23) { - if ((i_this->mpAnim->getFrame() >= REG8_F(1) + 40.0f) && (i_this->mAttWaitTimer == 0)) { + if ((i_this->mpMorf->getFrame() >= DEMO_SELECT(40.0f, REG8_F(1) + 40.0f)) && (i_this->mAttWaitTimer == 0)) { i_this->mAttWaitTimer = 1; } cLib_addCalc2(&i_this->m3AC.y, 340.0f, 1.0f, 10.0f); - } else if (((i_this->m3F8 == 0x25) && (i_this->mpAnim->getFrame() >= REG8_F(1) + 30.0f)) && (i_this->mAttWaitTimer == 0)) { + } else if (((i_this->m3F8 == 0x25) && (i_this->mpMorf->getFrame() >= DEMO_SELECT(40.0f, REG8_F(1) + 30.0f))) && (i_this->mAttWaitTimer == 0)) { i_this->mAttWaitTimer = 1; } - if (i_this->mpAnim->isStop()) { + if (i_this->mpMorf->isStop()) { i_this->m3AC.y = 340.0f; noroi_brk_check(i_this, 1); next_status_clear(i_this, 1); if ((!next_att_wait_check(i_this)) && (player->checkConfuse())) { - i_this->mBodyAction = bpw_class::Action_ATTACK_KOUGEKI_e; + i_this->mBodyAction = ACTION_ATTACK_KOUGEKI; i_this->mActionState = 0x14; } } @@ -1658,51 +1695,54 @@ void action_karada_taore(bpw_class* i_this) { i_this->m47E = 200; i_this->m480 = 200; i_this->m4A4 = 100.0f; - i_this->m4A8 = REG8_F(0x10) + 220.0f; + i_this->m4A8 = REG8_F(16) + 220.0f; search_get_skull(i_this, 2); actor->speed.setall(0.0f); actor->speedF = 0.0f; noroi_brk_check(i_this, 0); - anm_init(i_this, BPW_BCK_SONOBA_PRESS1, (REG12_F(2) + 1.0f), J3DFrameCtrl::EMode_NONE, 1.0f, -1); + anm_init(i_this, BPW_BCK_SONOBA_PRESS1, REG12_F(2) + 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); fopAcM_monsSeStart(actor, JA_SE_CV_BPW_CURSE, 0); - actor->speedF = 14.75f; + actor->speedF = DEMO_SELECT(REG11_F(12) + 14.75f, 14.75f); i_this->mAttWaitTimer = 0; i_this->mActionState++; break; case 0x4e: cLib_addCalc2(&i_this->m3AC.y, 240.0f, 1.0f, 10.0f); - if (i_this->mpAnim->getFrame() <= 20.0f) { + if (i_this->mpMorf->getFrame() <= DEMO_SELECT(REG11_F(11) + 20.0f, 20.0f)) { i_this->m476 = fopAcM_searchPlayerAngleY(actor); } - if (i_this->mpAnim->getFrame() >= 40.0f) { - cLib_addCalc0(&actor->speedF, 1.0f, 0.55f); + if (i_this->mpMorf->getFrame() >= DEMO_SELECT(REG11_F(13) + 40.0f, 40.0f)) { + cLib_addCalc0(&actor->speedF, 1.0f, DEMO_SELECT(REG11_F(14) + 0.55f, 0.55f)); } - if (i_this->mpAnim->checkFrame(40.0f)) { + if (i_this->mpMorf->checkFrame(40.0f)) { i_this->mFire1DousaPos = actor->current.pos; i_this->mFire1DousaPos.y = i_this->mAcch.GetGroundH(); i_this->m5E0[3].remove(); - pJVar4 = dComIfGp_particle_setToon( + emitter = dComIfGp_particle_setToon( dPa_name::ID_AK_ST_BPWPRESSSMOKE01, &i_this->mFire1DousaPos, &actor->shape_angle, NULL, 0xb9, &i_this->m5E0[3], fopAcM_GetRoomNo(actor) ); - if (pJVar4 != NULL) { + if (emitter != NULL) { dKy_get_seacolor(&local_24, &local_28); - pJVar4->setGlobalPrmColor(local_24.r, local_24.g, local_24.b); - pJVar4->setGlobalEnvColor(local_28.r, local_28.g, local_28.b); + emitter->setGlobalPrmColor(local_24.r, local_24.g, local_24.b); + emitter->setGlobalEnvColor(local_28.r, local_28.g, local_28.b); } actor->gravity = -3.0f; fopAcM_seStart(actor, JA_SE_CM_BPW_BODY_PRESS, 0); i_this->m3E8 = 1; i_this->mSomeCountdownTimers[6] = (s16)(int)(REG21_F(1) + 20.0f); - i_this->m4A8 = REG8_F(0x11) + 400.0f; + i_this->m4A8 = REG8_F(17) + 400.0f; } - if (i_this->mpAnim->isStop()) { + if (i_this->mpMorf->isStop()) { i_this->mSomeCountdownTimers[0] = 5; +#if VERSION == VERSION_DEMO + i_this->mAttWaitTimer = 1; +#endif i_this->mActionState++; } break; case 0x4f: if (i_this->mSomeCountdownTimers[0] == 0) { - anm_init(i_this, BPW_BCK_SONOBA_PRESS2, (REG12_F(2) + 1.0f), J3DFrameCtrl::EMode_NONE, 1.0f, -1); + anm_init(i_this, BPW_BCK_SONOBA_PRESS2, REG12_F(2) + 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->mActionState = 0x4c; } // fallthrough @@ -1715,24 +1755,10 @@ void action_karada_taore(bpw_class* i_this) { /* 000051E0-000062D8 .text action_damage__FP9bpw_class */ void action_damage(bpw_class* i_this) { - /* Nonmatching - regalloc */ fopAc_ac_c* actor = &i_this->actor; - u32 uVar2; - J3DAnmTevRegKey* pJVar5; - JPABaseEmitter* pJVar7; - int childPoeId; - u32 uVar14; - int iVar15; - int currRandomAngle; - f32 maxPoeSpread; - GXColor local_64; - GXColor local_68; - cXyz local_58; - int pwSpreadAmount; - + J3DAnmTevRegKey* pBrk; daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); - mDoExt_McaMorf* pmVar12 = i_this->mpAnim; - J3DModel* pJVar16 = pmVar12->getModel(); + J3DModel* model = i_this->mpMorf->getModel(); switch (i_this->mActionState) { case 0x50: search_get_skull(i_this, 2); @@ -1758,16 +1784,15 @@ void action_damage(bpw_class* i_this) { i_this->m480 = 200; actor->speedF = 0.0f; i_this->m490 = 0.0f; - anm_init(i_this, BPW_BCK_HIT1, 15.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + anm_init(i_this, BPW_BCK_HIT1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->mSomeCountdownTimers[9] = 0; i_this->m476 = fopAcM_searchPlayerAngleY(actor); actor->current.angle.y = i_this->m476; actor->shape_angle.y = i_this->m476; i_this->mActionState++; case 0x51: - uVar2 = i_this->m3DF; - if ((uVar2 == 10) || (uVar2 == 0xb)) { - if (uVar2 == 0xb) { + if ((i_this->mHitType == 10) || (i_this->mHitType == 0xb)) { + if (i_this->mHitType == 0xb) { fopAcM_seStart(actor, JA_SE_CM_BPW_SOLID_END, 0); i_this->m47E = 0xFF; } else { @@ -1780,8 +1805,8 @@ void action_damage(bpw_class* i_this) { if (i_this->m3E1 == 0) { i_this->m3E1 = 1; i_this->m3E2 = 0; - pJVar5 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_HIT); - i_this->m2C4->init(pJVar16->getModelData(), pJVar5, true, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, 0); + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_HIT); + i_this->mpLightStunBrkAnm->init(model->getModelData(), pBrk, true, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, 0); } } if (i_this->m47E >= 0xFF) { @@ -1793,33 +1818,32 @@ void action_damage(bpw_class* i_this) { if (((i_this->mAttWaitTimer == 1) || (i_this->mAttWaitTimer == 2)) || (i_this->mAttWaitTimer == 0)) { i_this->mAttWaitTimer = 3; } - pJVar5 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_HIRARU1); - i_this->mBrkAnim->init(pJVar16->getModelData(), pJVar5, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, 0); + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_HIRARU1); + i_this->mpLightFreezeBrkAnm->init(model->getModelData(), pBrk, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, 0); anm_init(i_this, BPW_BCK_DOSUN1, 0.0f, J3DFrameCtrl::EMode_NONE, 0.0f, -1); i_this->m4A0 = 50.0f; - i_this->mBodyAtSph.OffAtSetBit(); - i_this->mBodyAtSph.OffAtSetBit(); + i_this->mBodyAtSph.ClrAtSet(); + i_this->mBodyAtSph.ClrAtSet(); i_this->mActionState++; } } else { i_this->mSomeCountdownTimers[2] = (s16)(int)(REG12_F(7) + 90.0f); - pwSpreadAmount = next_att_wait_check(i_this); - if (pwSpreadAmount == 0) { - i_this->mBodyAction = bpw_class::Action_ATTACK_KOUGEKI_e; + if (!next_att_wait_check(i_this)) { + i_this->mBodyAction = ACTION_ATTACK_KOUGEKI; i_this->mActionState = 0x14; } if (i_this->m3F8 != 0x2a) { - anm_init(i_this, BPW_BCK_WAIT1, 15.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + anm_init(i_this, BPW_BCK_WAIT1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_LOOP, 1.0f, -1); } if (i_this->m3E1 != 0) { i_this->m3E1 = 0; - pJVar5 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_DEFAULT); - i_this->m2D0->init(pJVar16->getModelData(), pJVar5, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, 0); + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_DEFAULT); + i_this->mpDefaultBrkAnm->init(model->getModelData(), pBrk, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, 0); } } break; case 0x52: - if (i_this->mBrkAnim->isStop()) { + if (i_this->mpLightFreezeBrkAnm->isStop()) { fopAcM_monsSeStart(actor, JA_SE_CV_BPW_BECOME_SOLID, 0); } if (i_this->mSomeCountdownTimers[0] == 0) { @@ -1829,14 +1853,16 @@ void action_damage(bpw_class* i_this) { actor->gravity = 0.0f; actor->speed.setall(0.0f); i_this->mBodyCoSph.OnTgShield(); - i_this->mSomeCountdownTimers[6] = (s16)(int)(REG21_F(1) + 20.0f); + i_this->mSomeCountdownTimers[6] = REG21_F(1) + 20.0f; i_this->m3E8 = 1; i_this->mBodyCoSph.OnCoSetBit(); i_this->m48C = -120.0f; i_this->mActionState = 0x53; fopAcM_seStart(actor, JA_SE_CM_BPW_SOLID_FALL, 0); fopAcM_monsSeStart(actor, JA_SE_CV_BPW_LANDING, 0); +#if VERSION > VERSION_DEMO i_this->mSomeCountdownTimers[1] = 0; +#endif anm_init(i_this, BPW_BCK_DOSUN1, 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); actor->gravity = 0.0f; } @@ -1844,16 +1870,16 @@ void action_damage(bpw_class* i_this) { break; case 0x53: if (i_this->m3F8 != 0xc) { - if (pmVar12->isStop()) { - anm_init(i_this, BPW_BCK_DOSUN_WAIT1, 15.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); - i_this->mSomeCountdownTimers[1] = 0x1c2; + if (i_this->mpMorf->isStop()) { + anm_init(i_this, BPW_BCK_DOSUN_WAIT1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + i_this->mSomeCountdownTimers[1] = DEMO_SELECT(240, 450); cLib_onBit(actor->attention_info.flags, fopAc_Attn_ACTION_CARRY_e); i_this->m684 = actor->shape_angle.y; } } - if (fopAcM_CheckStatus(actor, fopAcStts_CARRY_e)) { - anm_init(i_this, BPW_BCK_JITA1, 15.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); - i_this->mBodyCoSph.OffCoSetBit(); + if (fopAcM_checkCarryNow(actor)) { + anm_init(i_this, BPW_BCK_JITA1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + i_this->mBodyCoSph.ClrCoSet(); i_this->m3AC.y = 300.0f; actor->current.angle.y = player->shape_angle.y; i_this->m47A = 0; @@ -1868,9 +1894,9 @@ void action_damage(bpw_class* i_this) { next_att_wait_check(i_this); } break; - case bpw_class::Action_State_DAMAGE_CARRIED_e: + case ACTION_STATE_DAMAGE_CARRIED: if (REG8_S(3) != 0) { - i_this->m684 = i_this->m684 + (player->shape_angle.y - actor->current.angle.y); + i_this->m684 += player->shape_angle.y - actor->current.angle.y; actor->shape_angle.y = i_this->m684; actor->current.angle.y = player->shape_angle.y; } else { @@ -1881,7 +1907,7 @@ void action_damage(bpw_class* i_this) { fopAcM_monsSeStart(actor, JA_SE_CV_BPW_JITABATA, 0); i_this->mSomeCountdownTimers[9] = 0x20; } - if (!fopAcM_CheckStatus(actor, fopAcStts_CARRY_e)) { + if (!fopAcM_checkCarryNow(actor)) { actor->gravity = -3.0f; actor->speed.y = 10.0f; i_this->m490 = 120.0f; @@ -1901,7 +1927,7 @@ void action_damage(bpw_class* i_this) { i_this->mBodyCoSph.OnCoSetBit(); fopAcM_monsSeStart(actor, JA_SE_CV_BPW_THROWN, 0); anm_init(i_this, BPW_BCK_TAMA1, 0.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); - i_this->mActionState = bpw_class::Action_State_DAMAGE_THROWN_e; + i_this->mActionState = ACTION_STATE_DAMAGE_THROWN; } else if (i_this->mSomeCountdownTimers[1] == 1) { fopAcM_cancelCarryNow(actor); cLib_offBit(actor->attention_info.flags, fopAc_Attn_ACTION_CARRY_e); @@ -1910,23 +1936,22 @@ void action_damage(bpw_class* i_this) { next_att_wait_check(i_this); } break; - case bpw_class::Action_State_DAMAGE_THROWN_e: + case ACTION_STATE_DAMAGE_THROWN: { fopAcM_seStart(actor, JA_SE_CM_BPW_ROLLING, 0); if (REG8_S(3) != 0) { i_this->m3D6 = i_this->m3D6 + 5000; } else { actor->shape_angle.x = actor->shape_angle.x + 0x1000; } - pwSpreadAmount = wall_HIT_check(i_this); - if (pwSpreadAmount != 0) { + int r25 = wall_HIT_check(i_this); + if (r25 != 0) { i_this->m3E5 = 0; i_this->m3D6 = 0; i_this->m3D8 = 0; i_this->m3DA = 0; dComIfGp_getCamera(0)->mCamera.ForceLockOff(fopAcM_GetID(i_this)); - currRandomAngle = cM_atan2s(i_this->mBodyPos.x - actor->current.pos.x, i_this->mBodyPos.z - actor->current.pos.z); - actor->current.angle.y = (short)currRandomAngle; - if (pwSpreadAmount == 2) { + actor->current.angle.y = cM_atan2s(i_this->mBodyPos.x - actor->current.pos.x, i_this->mBodyPos.z - actor->current.pos.z); + if (r25 == 2) { fopAcM_seStart(actor, JA_SE_CM_BPW_DAMAGE_TOGE, 0); fopAcM_monsSeStart(actor, JA_SE_CV_BPW_DAMAGE, 0); i_this->mSomeCountdownTimers[6] = (s16)(int)(REG21_F(0) + 20.0f); @@ -1942,6 +1967,7 @@ void action_damage(bpw_class* i_this) { } } break; + } case 0x5a: actor->speed.y = REG12_F(4) + 30.0f; actor->gravity = -(REG12_F(5) + 3.0f); @@ -1958,9 +1984,11 @@ void action_damage(bpw_class* i_this) { i_this->mActionState++; case 0x5c: cLib_addCalcAngleS2(&actor->shape_angle.x, 0, 10, 0x2000); - if (i_this->mpAnim->isStop()) { + if (i_this->mpMorf->isStop()) { +#if VERSION > VERSION_DEMO i_this->mSomeCountdownTimers[0] = 0; i_this->mSomeCountdownTimers[1] = 0; +#endif next_status_clear(i_this, 0); next_att_wait_check(i_this); } @@ -1971,10 +1999,10 @@ void action_damage(bpw_class* i_this) { i_this->m47A = 0; actor->gravity = -3.0f; actor->speed.y = 70.0f; - anm_init(i_this, BPW_BCK_DAMAGE1, 15.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + anm_init(i_this, BPW_BCK_DAMAGE1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->mActionState++; break; - case bpw_class::Action_State_DAMAGE_HIT_e: + case ACTION_STATE_DAMAGE_HIT: actor->shape_angle.y = actor->shape_angle.y + 0x1500; cLib_addCalcAngleS2(&actor->shape_angle.x, 0, 10, 0x2000); if (i_this->mAcch.ChkGroundHit()) { @@ -1983,44 +2011,49 @@ void action_damage(bpw_class* i_this) { i_this->mFire1DousaPos = actor->current.pos; i_this->mFire1DousaPos.y = i_this->mAcch.GetGroundH(); i_this->m5E0[0].remove(); - pJVar7 = dComIfGp_particle_setToon( + JPABaseEmitter* emitter = dComIfGp_particle_setToon( dPa_name::ID_AK_ST_BPWSIRIMOTISMOKE00, &i_this->mFire1DousaPos, &actor->shape_angle, NULL, 0xb9, &i_this->m5E0[0], fopAcM_GetRoomNo(actor) ); - if (pJVar7 != NULL) { + if (emitter != NULL) { + GXColor local_64; + GXColor local_68; dKy_get_seacolor(&local_64, &local_68); - pJVar7->setGlobalPrmColor(local_64.r, local_64.g, local_64.b); - pJVar7->setGlobalEnvColor(local_68.r, local_68.g, local_68.b); + emitter->setGlobalPrmColor(local_64.r, local_64.g, local_64.b); + emitter->setGlobalEnvColor(local_68.r, local_68.g, local_68.b); } fopAcM_seStart(actor, JA_SE_CM_BPW_DAMAGE_EXPLODE, 0); dComIfGp_particle_set(dPa_name::ID_AK_SN_BPWBUNRETUSMOKE00, &actor->current.pos); +#if VERSION > VERSION_DEMO + u32 uVar14; + s32 i; + cXyz local_58; csXyz pwAngle = actor->shape_angle; local_58 = actor->current.pos; - pwSpreadAmount = (int)(65536.0f / actor->health); + int currRandomAngle; + int pwSpreadAmount = (int)(65536.0f / actor->health); local_58.y = i_this->mAcch.GetGroundH() + 20.0f; - currRandomAngle = 0; i_this->m3E9 = 0; - for (s32 i = 0; i < 0xF; i++) { - i_this->mChildPoeIds[currRandomAngle] = fpcM_ERROR_PROCESS_ID_e; - currRandomAngle++; + for (i = 0; i < 15; i++) { + i_this->mChildPoeIds[i] = fpcM_ERROR_PROCESS_ID_e; } currRandomAngle = (int)cM_rndFX(32768.0f); uVar14 = (s16)cM_rndF(4.99f); - uVar2 = uVar14 << 9 | 0xff000003; - for (iVar15 = 0; iVar15 < actor->health; iVar15++) { - maxPoeSpread = ((s16)pwSpreadAmount * 0.25f); - childPoeId = fopAcM_createChild(PROC_PW, fopAcM_GetID(i_this), uVar2, &local_58, fopAcM_GetRoomNo(actor), &pwAngle); - i_this->mChildPoeIds[iVar15] = childPoeId; + u32 uVar2 = uVar14 << 9 | 0xFF000003; + for (i = 0; i < actor->health; i++) { + f32 maxPoeSpread = ((s16)pwSpreadAmount * 0.25f); + i_this->mChildPoeIds[i] = fopAcM_createChild(PROC_PW, fopAcM_GetID(i_this), uVar2, &local_58, fopAcM_GetRoomNo(actor), &pwAngle); currRandomAngle += pwSpreadAmount; - pwAngle.y = (short)currRandomAngle; + pwAngle.y = (s16)currRandomAngle; pwAngle.y += (int)cM_rndFX((f32)maxPoeSpread); uVar14++; if (uVar14 > 5) { uVar14 = 0; } - uVar2 = uVar14 << 9 | 0xff000003; + uVar2 = uVar14 << 9 | 0xFF000003; } - i_this->mBodyAction = bpw_class::Action_SEPARATION_BUNRI_DOUSA_e; - i_this->mActionState = bpw_class::Action_State_SEPARATE_BUNRI_DOUSA_INIT_e; +#endif + i_this->mBodyAction = ACTION_SEPARATION_BUNRI_DOUSA; + i_this->mActionState = ACTION_STATE_SEPARATE_BUNRI_DOUSA_INIT; } } cLib_addCalc2(&actor->speedF, i_this->m490, 1.0f, 1.0f); @@ -2028,25 +2061,17 @@ void action_damage(bpw_class* i_this) { /* 000062D8-00008BAC .text action_bunri_dousa__FP9bpw_class */ void action_bunri_dousa(bpw_class* i_this) { - /* Nonmatching - "cLib_addCalc2" */ + /* Nonmatching - weird issue with inlines */ fopAc_ac_c* actor = &i_this->actor; f32 fVar2; pw_class* childPoe; - pw_class* childPoe2; - fopAc_ac_c* i_actor; - pw_class* childPoe3; - pw_class* childPoe4; - pw_class* childPoe5; - JPABaseEmitter* unk2; - int iVar5; s8 hpAmountToEndPhaseAt; - int iVar6; f32 dVar7; f32 dVar8; f32 fVar9; - cXyz sp70; - cXyz local_74; cXyz local_68; + cXyz local_74; + cXyz sp70; s8 currHp; f32 f1; f32 f2; @@ -2055,7 +2080,7 @@ void action_bunri_dousa(bpw_class* i_this) { daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); camera_class* camera = (camera_class*)dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); switch (i_this->mActionState) { - case bpw_class::Action_State_SEPARATE_BUNRI_DOUSA_INIT_e: + case ACTION_STATE_SEPARATE_BUNRI_DOUSA_INIT: { for (s32 i = 0; i < 10; i++) { i_this->mSomeCountdownTimers[i + 10] = 0; } @@ -2064,9 +2089,41 @@ void action_bunri_dousa(bpw_class* i_this) { i_this->mSomeCountdownTimers[0] = 0; i_this->mSomeCountdownTimers[1] = 0; i_this->mSomeCountdownTimers[2] = 0; +#if VERSION > VERSION_DEMO i_this->m47C = 0; - anm_init(i_this, BPW_BCK_CORE1, 0.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); - i_this->mBodyAtSph.OffAtSetBit(); +#endif +#if VERSION == VERSION_DEMO + u32 uVar14; + s32 i; + cXyz local_58; + csXyz pwAngle = actor->shape_angle; + local_58 = actor->current.pos; + int currRandomAngle; + int pwSpreadAmount = (int)(65536.0f / actor->health); + local_58.y = i_this->mAcch.GetGroundH() + 20.0f; + i_this->m3E9 = 0; + for (i = 0; i < 15; i++) { + i_this->mChildPoeIds[i] = fpcM_ERROR_PROCESS_ID_e; + } + currRandomAngle = (int)cM_rndFX(32768.0f); + uVar14 = (s16)cM_rndF(4.99f); + u32 uVar2 = uVar14 << 9 | 0xFF000003; + for (i = 0; i < actor->health; i++) { + f32 maxPoeSpread = ((s16)pwSpreadAmount * 0.25f); + i_this->mChildPoeIds[i] = fopAcM_createChild(PROC_PW, fopAcM_GetID(i_this), uVar2, &local_58, fopAcM_GetRoomNo(actor), &pwAngle); + currRandomAngle += pwSpreadAmount; + pwAngle.y = (s16)currRandomAngle; + pwAngle.y += (int)cM_rndFX((f32)maxPoeSpread); + uVar14++; + if (uVar14 > 5) { + uVar14 = 0; + } + uVar2 = uVar14 << 9 | 0xFF000003; + } + i_this->m47C = 0; +#endif + anm_init(i_this, BPW_BCK_CORE1, DEMO_SELECT(REG11_F(0), 0.0f), J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + i_this->mBodyAtSph.OffAtSPrmBit(cCcD_TgSPrm_Set_e); i_this->mBodyAtSph.ClrAtSet(); i_this->mBodyCoSph.OffTgSetBit(); i_this->mBodyCoSph.ClrCoSet(); @@ -2080,9 +2137,10 @@ void action_bunri_dousa(bpw_class* i_this) { i_this->m3E5 = 0; actor->scale.setall(0.0f); actor->current.pos = i_this->mBodyPos; - i_this->mSomeCountdownTimers[0] = 0x1a4; + i_this->mSomeCountdownTimers[0] = DEMO_SELECT(0x186, 0x1A4); i_this->mActionState++; - case bpw_class::Action_State_SEPARATE_BUNRI_DOUSA_EXECUTE_e: + } + case ACTION_STATE_SEPARATE_BUNRI_DOUSA_EXECUTE: switch (i_this->m3F6) { case 0: hpAmountToEndPhaseAt = 10; @@ -2110,7 +2168,7 @@ void action_bunri_dousa(bpw_class* i_this) { } break; } - if ((i_this->mSomeCountdownTimers[0] != 0) && (currHp >= (char)hpAmountToEndPhaseAt)) { + if ((i_this->mSomeCountdownTimers[0] != 0) && (currHp > hpAmountToEndPhaseAt)) { break; } i_this->mBodyCoSph.OnCoSetBit(); @@ -2118,8 +2176,8 @@ void action_bunri_dousa(bpw_class* i_this) { i_this->mActionState++; // fallthrough case 0x70: - for (iVar5 = 0; iVar5 < actor->health; iVar5++) { - childPoe = (pw_class*)fopAcM_SearchByID(i_this->mChildPoeIds[iVar5]); + for (s32 i = 0; i < actor->health; i++) { + childPoe = (pw_class*)fopAcM_SearchByID(i_this->mChildPoeIds[i]); if ((childPoe != NULL) && (0 < childPoe->health)) { childPoe->health = 0x14; } @@ -2127,7 +2185,7 @@ void action_bunri_dousa(bpw_class* i_this) { i_this->m47E = 0; i_this->mActionState++; case 0x71: - if (actor->eventInfo.checkCommandDemoAccrpt()) { + if (!actor->eventInfo.checkCommandDemoAccrpt()) { dComIfGp_event_onEventFlag(1); fopAcM_orderPotentialEvent(actor, dEvtFlag_STAFF_ALL_e, 0xFFFF, 0); actor->eventInfo.onCondition(dEvtCnd_UNK2_e); @@ -2135,7 +2193,7 @@ void action_bunri_dousa(bpw_class* i_this) { } player->changeOriginalDemo(); player->changeDemoMode(daPy_demo_c::DEMO_N_WAIT_e); - anm_init(i_this, BPW_BCK_CORE1, 0.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + anm_init(i_this, BPW_BCK_CORE1, DEMO_SELECT(REG11_F(0), 0.0f), J3DFrameCtrl::EMode_LOOP, 1.0f, -1); camera->mCamera.Stop(); camera->mCamera.SetTrimSize(2); i_this->m440 = 50.0f; @@ -2148,7 +2206,7 @@ void action_bunri_dousa(bpw_class* i_this) { sp70.z = 1625.0f; player->setPlayerPosAndAngle(&sp70, fopAcM_searchActorAngleY(player, actor)); i_this->mActionState++; - case bpw_class::Action_State_SEPARATE_BUNRI_DOUSA_END_INIT_e: + case ACTION_STATE_SEPARATE_BUNRI_DOUSA_END_INIT: i_this->m40C.x = 156.0f; i_this->m40C.y = 515.0f; i_this->m40C.z = 1001.0f; @@ -2178,16 +2236,16 @@ void action_bunri_dousa(bpw_class* i_this) { i_this->m3E9 = 1; i_this->mSomeCountdownTimers[5] = REG21_S(2) + 10; i_this->mSomeCountdownTimers[1] = 300; - for (iVar6 = 0; iVar6 < actor->health; iVar6++) { - childPoe2 = (pw_class*)fopAcM_SearchByID(i_this->mChildPoeIds[iVar6]); - if (childPoe2 != NULL) { - fopAcM_OnStatus(childPoe2, fopAcStts_UNK4000_e); + for (s32 i = 0; i < actor->health; i++) { + childPoe = (pw_class*)fopAcM_SearchByID(i_this->mChildPoeIds[i]); + if (childPoe != NULL) { + fopAcM_OnStatus(childPoe, fopAcStts_UNK4000_e); } } } if (i_this->m3F8 == 9) { - if (i_this->mpAnim->isStop()) { - anm_init(i_this, BPW_BCK_CORE1, 15.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + if (i_this->mpMorf->isStop()) { + anm_init(i_this, BPW_BCK_CORE1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_LOOP, 1.0f, -1); } fopAcM_seStart(actor, JA_SE_OBJ_BPW_MASK_LAUGH, 0); } @@ -2199,7 +2257,7 @@ void action_bunri_dousa(bpw_class* i_this) { anm_init(i_this, BPW_BCK_CORE_NIGE1, 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->m464 = 0; } - if ((i_this->mSomeCountdownTimers[1] == 1) || (i_this->m462 >= (int)actor->health)) { + if ((i_this->mSomeCountdownTimers[1] == 1) || (i_this->m462 >= actor->health)) { anm_init(i_this, BPW_BCK_CORE_NIGE1, 0.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->mSomeCountdownTimers[0] = 30; i_this->mActionState++; @@ -2207,7 +2265,7 @@ void action_bunri_dousa(bpw_class* i_this) { i_this->m3AC.y = 140.0f; fuwafuwa_calc(i_this); break; - case bpw_class::Action_State_SEPARATE_BUNRI_DOUSA_END_GATHER_e: + case ACTION_STATE_SEPARATE_BUNRI_DOUSA_END_GATHER: if (i_this->mSomeCountdownTimers[0] == 0) { if (REG20_S(1) == 0) { REG20_S(0) = 1; @@ -2216,29 +2274,39 @@ void action_bunri_dousa(bpw_class* i_this) { break; } REG20_S(0) = 0; - anm_init(i_this, BPW_BCK_HUKKATU1, 15.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + anm_init(i_this, BPW_BCK_HUKKATU1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_NONE, 1.0f, -1); fopAcM_seStart(actor, JA_SE_CM_BPW_MASK_TO_BPW, 0); i_this->mActionState++; +#if VERSION > VERSION_DEMO i_this->m43C = 0.0f; +#endif } break; - case bpw_class::Action_State_SEPARATE_BUNRI_DOUSA_END_GROW_e: - fVar2 = i_this->m40C.x - (REG20_F(0xc) + 152.0f); - cLib_addCalc2(&i_this->m40C.x, fVar2, 1.0f, std::fabsf(fVar2) * (REG20_F(0x12) + 0.08f) * i_this->m43C); - fVar2 = i_this->m40C.y - (REG20_F(0xd) + 498.0f); - cLib_addCalc2(&i_this->m40C.y, fVar2, 1.0f, std::fabsf(fVar2) * (REG20_F(0x12) + 0.08f) * i_this->m43C); - fVar2 = i_this->m40C.z - (REG20_F(0xe) + 983.0f); - cLib_addCalc2(&i_this->m40C.z, fVar2, 1.0f, std::fabsf(fVar2) * (REG20_F(0x12) + 0.08f) * i_this->m43C); - fVar2 = i_this->m418.x - (REG20_F(0xf) + 181.0f); - cLib_addCalc2(&i_this->m418.x, fVar2, 1.0f, std::fabsf(fVar2) * (REG20_F(0x12) + 0.08f) * i_this->m43C); - fVar2 = i_this->m418.y - (REG20_F(0x10) + 504.0f); - cLib_addCalc2(&i_this->m418.y, fVar2, 1.0f, std::fabsf(fVar2) * (REG20_F(0x12) + 0.08f) * i_this->m43C); - fVar2 = i_this->m418.z - (REG20_F(0x11) + 1196.0f); - cLib_addCalc2(&i_this->m418.z, fVar2, 1.0f, std::fabsf(fVar2) * (REG20_F(0x12) + 0.08f) * i_this->m43C); + case ACTION_STATE_SEPARATE_BUNRI_DOUSA_END_GROW: + fVar2 = std::fabsf(i_this->m40C.x - (REG20_F(12) + 152.0f)); + fVar9 = fVar2 * (REG20_F(18) + 0.08f); + cLib_addCalc2(&i_this->m40C.x, fVar2, 1.0f, DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m40C.y - (REG20_F(13) + 498.0f)); + fVar9 = fVar2 * (REG20_F(18) + 0.08f); + cLib_addCalc2(&i_this->m40C.y, fVar2, 1.0f, DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m40C.z - (REG20_F(14) + 983.0f)); + fVar9 = fVar2 * (REG20_F(18) + 0.08f); + cLib_addCalc2(&i_this->m40C.z, fVar2, 1.0f, DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m418.x - (REG20_F(15) + 181.0f)); + fVar9 = fVar2 * (REG20_F(18) + 0.08f); + cLib_addCalc2(&i_this->m418.x, fVar2, 1.0f, DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m418.y - (REG20_F(16) + 504.0f)); + fVar9 = fVar2 * (REG20_F(18) + 0.08f); + cLib_addCalc2(&i_this->m418.y, fVar2, 1.0f, DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m418.z - (REG20_F(17) + 1196.0f)); + fVar9 = fVar2 * (REG20_F(18) + 0.08f); + cLib_addCalc2(&i_this->m418.z, fVar2, 1.0f, DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); +#if VERSION > VERSION_DEMO cLib_addCalc2(&i_this->m43C, 1.0f, 1.0f, 0.04f); +#endif cLib_addCalc0(&i_this->m48C, 1.0f, 10.0f); cLib_addCalc2(&i_this->m3AC.y, 340.0f, 1.0f, 10.0f); - if (i_this->mpAnim->isStop()) { + if (i_this->mpMorf->isStop()) { if (REG20_S(1) == 0) { REG20_S(0) = 1; } @@ -2246,12 +2314,12 @@ void action_bunri_dousa(bpw_class* i_this) { break; } REG20_S(0) = 0; - anm_init(i_this, BPW_BCK_WAIT1, 15.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); - i_this->mSomeCountdownTimers[0] = 0x14; + anm_init(i_this, BPW_BCK_WAIT1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + i_this->mSomeCountdownTimers[0] = DEMO_SELECT(REG11_F(10) + 20.0f, 0x14); i_this->mActionState++; } break; - case bpw_class::Action_State_SEPARATE_BUNRI_DOUSA_END_FINISH_e: + case ACTION_STATE_SEPARATE_BUNRI_DOUSA_END_FINISH: if (REG20_S(1) == 0) { REG20_S(0) = 1; } @@ -2280,7 +2348,7 @@ void action_bunri_dousa(bpw_class* i_this) { fopAcM_OffStatus(actor, fopAcStts_UNK4000_e); break; case 0x78: - if (actor->eventInfo.checkCommandDemoAccrpt()) { + if (!actor->eventInfo.checkCommandDemoAccrpt()) { dComIfGp_event_onEventFlag(1); fopAcM_orderPotentialEvent(actor, dEvtFlag_STAFF_ALL_e, 0xFFFF, 0); actor->eventInfo.onCondition(dEvtCnd_UNK2_e); @@ -2299,19 +2367,19 @@ void action_bunri_dousa(bpw_class* i_this) { i_this->m3E6 = 0; i_this->m3E5 = 0; actor->scale.setall(0.0f); - anm_init(i_this, BPW_BCK_CORE1, 15.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + anm_init(i_this, BPW_BCK_CORE1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_LOOP, 1.0f, -1); if (i_this->m3FC != fpcM_ERROR_PROCESS_ID_e) { - i_actor = fopAcM_SearchByID(i_this->m3FC); + fopAc_ac_c* i_actor = fopAcM_SearchByID(i_this->m3FC); fopAcM_createDisappear(i_actor, &i_actor->current.pos, 5, daDisItem_NONE3_e, 0xFF); fopAcM_delete(i_actor); } - for (iVar6 = 0; iVar6 < (char)actor->max_health; iVar6++) { - childPoe3 = (pw_class*)fopAcM_SearchByID(i_this->mChildPoeIds[iVar6]); - if ((childPoe3 != NULL) && (childPoe3->m344 != 0)) { - fopAcM_OnStatus(childPoe3, fopAcStts_UNK4000_e); - i_this->m462 = (s16)iVar6; - i_this->m424 = childPoe3->current.pos; - i_this->m464 = fopAcM_searchPlayerAngleY(childPoe3); + for (s32 i = 0; i < actor->max_health; i++) { + childPoe = (pw_class*)fopAcM_SearchByID(i_this->mChildPoeIds[i]); + if ((childPoe != NULL) && (childPoe->m344 != 0)) { + fopAcM_OnStatus(childPoe, fopAcStts_UNK4000_e); + i_this->m462 = i; + i_this->m424 = childPoe->current.pos; + i_this->m464 = fopAcM_searchPlayerAngleY(childPoe); } } i_this->m47E = 0; @@ -2324,31 +2392,50 @@ void action_bunri_dousa(bpw_class* i_this) { i_this->m474 = 1; i_this->mSomeCountdownTimers[0] = (s16)(int)(REG20_F(0) + 135.0f); i_this->mActionState++; - childPoe4 = (pw_class*)fopAcM_SearchByID(i_this->mChildPoeIds[i_this->m462]); - if (childPoe4 != NULL) { - i_this->m40C = childPoe4->current.pos; + childPoe = (pw_class*)fopAcM_SearchByID(i_this->mChildPoeIds[i_this->m462]); + if (childPoe != NULL) { +#if VERSION == VERSION_DEMO + i_this->m424 = childPoe->current.pos; + i_this->m464 = fopAcM_searchPlayerAngleY(childPoe); +#else + i_this->m40C = childPoe->current.pos; +#endif } case 0x79: - childPoe5 = (pw_class*)fopAcM_SearchByID(i_this->mChildPoeIds[i_this->m462]); - if (childPoe5 != NULL) { - i_this->m424 = childPoe5->current.pos; - i_this->m464 = fopAcM_searchPlayerAngleY(childPoe5); +#if VERSION > VERSION_DEMO + childPoe = (pw_class*)fopAcM_SearchByID(i_this->mChildPoeIds[i_this->m462]); + if (childPoe != NULL) { + i_this->m424 = childPoe->current.pos; + i_this->m464 = fopAcM_searchPlayerAngleY(childPoe); } +#endif i_this->m440 = 50.0f; +#if VERSION == VERSION_DEMO + i_this->m40C = i_this->m424; + i_this->m40C.y += 150.0f + REG12_F(17); +#else i_this->m40C.x = i_this->m424.x; i_this->m40C.z = i_this->m424.z; - cLib_addCalc2(&i_this->m40C.y, i_this->m424.y + 150.0f + REG12_F(0x11), 0.1f, 10.0f); + cLib_addCalc2(&i_this->m40C.y, i_this->m424.y + 150.0f + REG12_F(17), 0.1f, 10.0f); +#endif cMtx_YrotS(*calc_mtx, (int)i_this->m464); local_68.x = 0.0f; local_68.y = 0.0f; local_68.z = 800.0f; MtxPosition(&local_68, &local_74); +#if VERSION == VERSION_DEMO + local_74 += i_this->m424; + i_this->m418.x = local_74.x; + i_this->m418.y = local_74.y + 100.0f; + i_this->m418.z = local_74.z; +#else local_74.x += i_this->m424.x; local_74.z += i_this->m424.z; local_74.y += i_this->m424.y * 0.3f; i_this->m418.x = local_74.x; i_this->m418.y = local_74.y + 100.0f; i_this->m418.z = local_74.z; +#endif if (i_this->mSomeCountdownTimers[0] == 0) { i_this->mSomeCountdownTimers[0] = (s16)(int)(REG20_F(1) + 25.0f); if (REG20_S(1) == 0) { @@ -2362,8 +2449,7 @@ void action_bunri_dousa(bpw_class* i_this) { sp70.x = -36.0f; sp70.y = player->current.pos.y; sp70.z = -777.0f; - iVar5 = cM_atan2s(player->current.pos.x - i_this->m424.x, player->current.pos.z - i_this->m424.z); - player->setPlayerPosAndAngle(&sp70, (int)(short)iVar5); + player->setPlayerPosAndAngle(&sp70, (s16)cM_atan2s(player->current.pos.x - i_this->m424.x, player->current.pos.z - i_this->m424.z)); i_this->mActionState++; } break; @@ -2407,38 +2493,48 @@ void action_bunri_dousa(bpw_class* i_this) { actor->scale.setall(1.0f); i_this->mSomeCountdownTimers[0] = (s16)(int)(REG20_F(9) + 10.0f); i_this->mSomeCountdownTimers[1] = (s16)(int)(REG20_F(10) + 100.0f); - i_this->mSomeCountdownTimers[4] = (s16)(int)(REG12_F(0xc) + 30.0f); + i_this->mSomeCountdownTimers[4] = (s16)(int)(REG12_F(12) + 30.0f); i_this->mActionState++; +#if VERSION > VERSION_DEMO i_this->m43C = 0.0f; +#endif // Fall-through case 0x7b: if (i_this->mSomeCountdownTimers[0] != 0) { i_this->mSomeCountdownTimers[1] = (s16)(int)(REG20_F(10) + 100.0f); - i_this->mSomeCountdownTimers[4] = (s16)(int)(REG12_F(0xc) + 30.0f); + i_this->mSomeCountdownTimers[4] = (s16)(int)(REG12_F(12) + 30.0f); break; } - cLib_addCalc2(&i_this->m440, REG20_F(0xb) + 50.0f, 1.0f, 0.5f); - fVar2 = i_this->m40C.x - (REG20_F(0xc) + -114.0f); - cLib_addCalc2(&i_this->m40C.x, fVar2, 0.1f, std::fabsf(fVar2) * (REG20_F(0x12) + 0.02f) * i_this->m43C); - fVar2 = i_this->m40C.y - (REG20_F(0xd) + 95.0f); - cLib_addCalc2(&i_this->m40C.y, fVar2, 0.1f, std::fabsf(fVar2) * (REG20_F(0x12) + 0.02f) * i_this->m43C); - fVar2 = i_this->m40C.z - (REG20_F(0xe) + -293.0f); - cLib_addCalc2(&i_this->m40C.z, fVar2, 0.1f, std::fabsf(fVar2) * (REG20_F(0x12) + 0.02f) * i_this->m43C); - fVar2 = i_this->m418.x - (REG20_F(0xf) + -169.0f); - cLib_addCalc2(&i_this->m418.x, fVar2, 1.0f, std::fabsf(fVar2) * (REG20_F(0x12) + 0.02f) * i_this->m43C); - fVar2 = i_this->m418.y - (REG20_F(0x10) + 98.0f); - cLib_addCalc2(&i_this->m418.y, fVar2, 1.0f, std::fabsf(fVar2) * (REG20_F(0x12) + 0.02f) * i_this->m43C); - fVar2 = i_this->m418.z - (REG20_F(0x11) + -462.0f); - cLib_addCalc2(&i_this->m418.z, fVar2, 1.0f, std::fabsf(fVar2) * (REG20_F(0x12) + 0.02f) * i_this->m43C); + cLib_addCalc2(&i_this->m440, REG20_F(11) + 50.0f, 1.0f, 0.5f); + fVar2 = std::fabsf(i_this->m40C.x - (REG20_F(12) + -114.0f)); + fVar9 = fVar2 * (REG20_F(18) + 0.02f); + cLib_addCalc2(&i_this->m40C.x, fVar2, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m40C.y - (REG20_F(13) + 95.0f)); + fVar9 = fVar2 * (REG20_F(18) + 0.02f); + cLib_addCalc2(&i_this->m40C.y, fVar2, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m40C.z - (REG20_F(14) + -293.0f)); + fVar9 = fVar2 * (REG20_F(18) + 0.02f); + cLib_addCalc2(&i_this->m40C.z, fVar2, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m418.x - (REG20_F(15) + -169.0f)); + fVar9 = fVar2 * (REG20_F(18) + 0.02f); + cLib_addCalc2(&i_this->m418.x, fVar2, 1.0f, DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m418.y - (REG20_F(16) + 98.0f)); + fVar9 = fVar2 * (REG20_F(18) + 0.02f); + cLib_addCalc2(&i_this->m418.y, fVar2, 1.0f, DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m418.z - (REG20_F(17) + -462.0f)); + fVar9 = fVar2 * (REG20_F(18) + 0.02f); + cLib_addCalc2(&i_this->m418.z, fVar2, 1.0f, DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); +#if VERSION > VERSION_DEMO cLib_addCalc2(&i_this->m43C, 1.0f, 1.0f, 0.04f); +#endif if (i_this->m3F8 == 0x1b) { - if (i_this->mpAnim->checkFrame(1.0f)) { + if (i_this->mpMorf->checkFrame(1.0f)) { fopAcM_monsSeStart(actor, JA_SE_CV_BPW_LOOK_RIGHT, 0); } - if (i_this->mpAnim->checkFrame(41.0f)) { + if (i_this->mpMorf->checkFrame(41.0f)) { fopAcM_monsSeStart(actor, JA_SE_CV_BPW_LOOK_LEFT, 0); } - if (i_this->mpAnim->checkFrame(76.0f)) { + if (i_this->mpMorf->checkFrame(76.0f)) { fopAcM_monsSeStart(actor, JA_SE_CV_BPW_SURPRISE, 0); } } @@ -2459,17 +2555,17 @@ void action_bunri_dousa(bpw_class* i_this) { // fallthrough case 0x7c: if (i_this->m3F8 == 0x1b) { - if (i_this->mpAnim->checkFrame(1.0f)) { + if (i_this->mpMorf->checkFrame(1.0f)) { fopAcM_monsSeStart(actor, JA_SE_CV_BPW_LOOK_RIGHT, 0); } - if (i_this->mpAnim->checkFrame(41.0f)) { + if (i_this->mpMorf->checkFrame(41.0f)) { fopAcM_monsSeStart(actor, JA_SE_CV_BPW_LOOK_LEFT, 0); } - if (i_this->mpAnim->checkFrame(76.0f)) { + if (i_this->mpMorf->checkFrame(76.0f)) { fopAcM_monsSeStart(actor, JA_SE_CV_BPW_SURPRISE, 0); } } - if (!i_this->mpAnim->isStop()) { + if (!i_this->mpMorf->isStop()) { break; } i_this->mSomeCountdownTimers[0] = (s16)(int)(REG19_F(0) + 60.0f); @@ -2496,28 +2592,38 @@ void action_bunri_dousa(bpw_class* i_this) { anm_init(i_this, BPW_BCK_CORE_NIGE1, 8.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->mSomeCountdownTimers[0] = 4; i_this->mActionState++; +#if VERSION > VERSION_DEMO i_this->m43C = 0.0f; +#endif // fallthrough case 0x7e: if (i_this->mSomeCountdownTimers[0] == 0) { fopAcM_seStart(actor, JA_SE_CM_BPW_MASK_RUN_AWAY, 0); } cLib_addCalc2(&i_this->m440, REG19_F(9) + 50.0f, 1.0f, 0.5f); - fVar2 = i_this->m40C.x - (REG19_F(10) + -471.0f); - cLib_addCalc2(&i_this->m40C.x, fVar2, 0.1f, std::fabsf(fVar2) * (REG19_F(0xc) + 0.05f) * i_this->m43C); - fVar2 = i_this->m40C.y - (REG19_F(10) + 120.0f); - cLib_addCalc2(&i_this->m40C.y, fVar2, 0.1, std::fabsf(fVar2) * (REG19_F(0xc) + 0.05f) * i_this->m43C); - fVar2 = i_this->m40C.z - (REG19_F(0xb) + -498.0f); - cLib_addCalc2(&i_this->m40C.z, fVar2, 0.1f, std::fabsf(fVar2) * (REG19_F(0xc) + 0.05f) * i_this->m43C); - fVar2 = i_this->m418.x - (REG20_F(0xf) + 115.0f); - cLib_addCalc2(&i_this->m418.x, fVar2, 1.0f, std::fabsf(fVar2) * (REG19_F(0xc) + 0.05f) * i_this->m43C); - fVar2 = i_this->m418.y - (REG20_F(0x10) + 58.0f); - cLib_addCalc2(&i_this->m418.y, fVar2, 1.0f, std::fabsf(fVar2) * (REG19_F(0xc) + 0.05f) * i_this->m43C); - fVar2 = i_this->m418.z - (REG20_F(0x11) + -1062.0f); - cLib_addCalc2(&i_this->m418.z, fVar2, 1.0f, std::fabsf(fVar2) * (REG19_F(0xc) + 0.05f) * i_this->m43C); + fVar2 = std::fabsf(i_this->m40C.x - (REG19_F(10) + -471.0f)); + fVar9 = fVar2 * (REG19_F(12) + 0.05f); + cLib_addCalc2(&i_this->m40C.x, fVar2, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m40C.y - (REG19_F(10) + 120.0f)); + fVar9 = fVar2 * (REG19_F(12) + 0.05f); + cLib_addCalc2(&i_this->m40C.y, fVar2, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m40C.z - (REG19_F(11) + -498.0f)); + fVar9 = fVar2 * (REG19_F(12) + 0.05f); + cLib_addCalc2(&i_this->m40C.z, fVar2, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m418.x - (REG20_F(15) + 115.0f)); + fVar9 = fVar2 * (REG19_F(12) + 0.05f); + cLib_addCalc2(&i_this->m418.x, fVar2, 1.0f, DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m418.y - (REG20_F(16) + 58.0f)); + fVar9 = fVar2 * (REG19_F(12) + 0.05f); + cLib_addCalc2(&i_this->m418.y, fVar2, 1.0f, DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m418.z - (REG20_F(17) + -1062.0f)); + fVar9 = fVar2 * (REG19_F(12) + 0.05f); + cLib_addCalc2(&i_this->m418.z, fVar2, 1.0f, DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); +#if VERSION > VERSION_DEMO cLib_addCalc2(&i_this->m43C, 1.0f, 1.0f, 0.04f); - cLib_addCalc2(&actor->current.pos.x, -1130.0f, 1.0f, REG19_F(0xd) + 20.0f); - cLib_addCalc2(&actor->current.pos.z, 30.0f, 1.0f, REG19_F(0xd) + 20.0f); +#endif + cLib_addCalc2(&actor->current.pos.x, -1130.0f, 1.0f, REG19_F(13) + 20.0f); + cLib_addCalc2(&actor->current.pos.z, 30.0f, 1.0f, REG19_F(13) + 20.0f); dVar7 = actor->current.pos.x - -1130.0f; dVar8 = actor->current.pos.z - 30.0f; i_this->m476 = cM_atan2s(dVar7, dVar8) + 0x8000; @@ -2525,8 +2631,7 @@ void action_bunri_dousa(bpw_class* i_this) { sp70.y = player->current.pos.y; sp70.z = -777.0f; player->setPlayerPosAndAngle(&sp70, fopAcM_searchPlayerAngleY(actor) + 0x8000); - fVar9 = std::sqrtf((f32)(dVar7 * dVar7) + (f32)(dVar8 * dVar8)); - if (fVar9 < 5.0f) { + if (std::sqrtf(SQUARE(dVar7) + SQUARE(dVar8)) < 5.0f) { actor->gravity = 0.0f; actor->speed.setall(0.0f); actor->speedF = 0.0f; @@ -2543,7 +2648,9 @@ void action_bunri_dousa(bpw_class* i_this) { i_this->mSomeCountdownTimers[1] = (s16)(int)(REG18_F(6) + 75.0f); mDoAud_bgmStreamPrepare(JA_STRM_BOSS_CLEAR); i_this->mActionState++; +#if VERSION > VERSION_DEMO i_this->m43C = 0.0f; +#endif } break; case 0x7f: @@ -2559,24 +2666,26 @@ void action_bunri_dousa(bpw_class* i_this) { dVar7 = cM_ssin((int)i_this->m47C); i_this->m3AC.z = (f32)((REG18_F(4) + 30.0f) * dVar7); cLib_addCalcAngleS2(&i_this->m476, -0x8000, 1, 0x2000); - actor->speed.y = REG19_F(0xe) + 30.0f; - cLib_addCalc2(&i_this->m440, REG19_F(0xf) + 50.0f, 1.0f, 0.5f); - cLib_addCalc2( - &i_this->m40C.x, REG19_F(0x10) + -538.0f, 0.1f, std::fabsf(i_this->m40C.x - (REG19_F(0x10) + -538.0f)) * (REG19_F(0x13) + 0.04f) * i_this->m43C - ); - cLib_addCalc2( - &i_this->m40C.y, REG19_F(0x11) + 748.0f, 0.1f, std::fabsf(i_this->m40C.y - (REG19_F(0x11) + 748.0f)) * (REG19_F(0x13) + 0.04f) * i_this->m43C - ); - cLib_addCalc2( - &i_this->m40C.z, REG19_F(0x12) + -567.0f, 0.1f, std::fabsf(i_this->m40C.z - (REG19_F(0x12) + -567.0f)) * (REG19_F(0x13) + 0.04f) * i_this->m43C - ); + actor->speed.y = REG19_F(14) + 30.0f; + cLib_addCalc2(&i_this->m440, REG19_F(15) + 50.0f, 1.0f, 0.5f); + fVar2 = std::fabsf(i_this->m40C.x - (REG19_F(16) + -538.0f)); + fVar9 = fVar2 * (REG19_F(19) + 0.04f); + cLib_addCalc2(&i_this->m40C.x, fVar2, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m40C.y - (REG19_F(17) + 748.0f)); + fVar9 = fVar2 * (REG19_F(19) + 0.04f); + cLib_addCalc2(&i_this->m40C.y, fVar2, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m40C.z - (REG19_F(18) + -567.0f)); + fVar9 = fVar2 * (REG19_F(19) + 0.04f); + cLib_addCalc2(&i_this->m40C.z, fVar2, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); +#if VERSION > VERSION_DEMO cLib_addCalc2(&i_this->m43C, 1.0f, 1.0f, 0.04f); +#endif if (i_this->mSomeCountdownTimers[0] == 1) { i_this->m3F6 = 4; fopAcM_seStart(actor, JA_SE_OBJ_BPW_LIGHT_ON, 0); i_this->mKankyouHendouState = 3; i_this->mSomeCountdownTimers[5] = 0; - anm_init(i_this, BPW_BCK_GATAGATA1, (REG12_F(10) + 8.0f), J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + anm_init(i_this, BPW_BCK_GATAGATA1, REG12_F(10) + 8.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); } if (actor->current.pos.y > 2000.0f) { actor->speedF = 0.0f; @@ -2632,20 +2741,20 @@ void action_bunri_dousa(bpw_class* i_this) { REG20_S(0) = 0; i_this->m3E0 = 1; i_this->m47E = 0xFF; - i_this->mpAnim->setPlaySpeed(0.0f); - i_this->mSomeCountdownTimers[0] = (s16)(int)(REG18_F(0x11) + 40.0f); + i_this->mpMorf->setPlaySpeed(0.0f); + i_this->mSomeCountdownTimers[0] = (s16)(int)(REG18_F(17) + 40.0f); i_this->mActionState++; // fallthrough case 0x82: if (i_this->mSomeCountdownTimers[0] != 0) { break; } - i_this->mSomeCountdownTimers[0] = (s16)(int)(REG18_F(0x12) + 20.0f); + i_this->mSomeCountdownTimers[0] = (s16)(int)(REG18_F(18) + 20.0f); actor->gravity = -1.0f; i_this->mActionState++; // fallthrough case 0x83: - cLib_addCalcAngleS2(&actor->shape_angle.x, REG18_F(0x13) + 49152.0f, 1, 0x300); + cLib_addCalcAngleS2(&actor->shape_angle.x, REG18_F(19) + 49152.0f, 1, 0x300); if (i_this->mSomeCountdownTimers[0] != 0) { break; } @@ -2669,26 +2778,33 @@ void action_bunri_dousa(bpw_class* i_this) { REG20_S(0) = 0; player->changeDemoMode(daPy_demo_c::DEMO_UNK_029_e); i_this->mActionState++; +#if VERSION > VERSION_DEMO i_this->m43C = 0.0f; +#endif // fallthrough case 0x85: - cLib_addCalcAngleS2(&actor->shape_angle.x, REG18_F(0x13) + 49152.0f, 1, 0x300); + cLib_addCalcAngleS2(&actor->shape_angle.x, REG18_F(19) + 49152.0f, 1, 0x300); cLib_addCalcAngleS2(&actor->shape_angle.z, 0, 1, 0x300); cLib_addCalc2(&i_this->m440, REG6_F(7) + 50.0f, 1.0f, 0.5f); - fVar2 = i_this->m40C.x - (REG6_F(8) + -1352.0f); - cLib_addCalc2(&i_this->m40C.x, fVar2, 0.1f, std::fabsf(fVar2) * (REG6_F(6) + 0.05f) * i_this->m43C); - fVar2 = i_this->m40C.y - (REG6_F(9) + 174.0f); - cLib_addCalc2(&i_this->m40C.y, fVar2, 0.1f, std::fabsf(fVar2) * (REG6_F(6) + 0.05f) * i_this->m43C); - fVar2 = i_this->m40C.z - (REG6_F(10) + 680.0f); - cLib_addCalc2(&i_this->m40C.z, fVar2, 0.1f, std::fabsf(fVar2) * (REG6_F(6) + 0.05f) * i_this->m43C); + fVar2 = std::fabsf(i_this->m40C.x - (REG6_F(8) + -1352.0f)); + fVar9 = fVar2 * (REG6_F(6) + 0.05f); + cLib_addCalc2(&i_this->m40C.x, fVar2, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m40C.y - (REG6_F(9) + 174.0f)); + fVar9 = fVar2 * (REG6_F(6) + 0.05f); + cLib_addCalc2(&i_this->m40C.y, fVar2, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m40C.z - (REG6_F(10) + 680.0f)); + fVar9 = fVar2 * (REG6_F(6) + 0.05f); + cLib_addCalc2(&i_this->m40C.z, fVar2, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); +#if VERSION > VERSION_DEMO cLib_addCalc2(&i_this->m43C, 1.0f, 1.0f, 0.04f); +#endif cLib_addCalc0(&i_this->m3AC.y, 1.0f, 3.0f); cLib_addCalc2(&i_this->m48C, -120.0f, 1.0f, 3.0f); sp70.x = -36.0f; sp70.y = player->current.pos.y; sp70.z = -777.0f; - player->setPlayerPosAndAngle(&sp70, (fopAcM_searchPlayerAngleY(actor) + 0x8000)); - if (REG6_F(0x13) + (i_this->mAcch.GetGroundH() + 1350.0f) < actor->current.pos.y) { + player->setPlayerPosAndAngle(&sp70, fopAcM_searchPlayerAngleY(actor) + 0x8000); + if (REG6_F(19) + (i_this->mAcch.GetGroundH() + 1350.0f) < actor->current.pos.y) { break; } if (REG20_S(1) == 0) { @@ -2699,26 +2815,36 @@ void action_bunri_dousa(bpw_class* i_this) { } REG20_S(0) = 0; i_this->mActionState++; +#if VERSION > VERSION_DEMO i_this->m43C = 0.0f; +#endif // fallthrough - case 0x86: - cLib_addCalc2(&i_this->m440, REG6_F(0xb) + 50.0f, 1.0f, 0.5f); - fVar2 = i_this->m40C.x - (REG6_F(0xc) + -2340.0f); - cLib_addCalc2(&i_this->m40C.x, fVar2, 0.1f, std::fabsf(fVar2) * (REG6_F(0x12) + 0.1f) * i_this->m43C); - fVar2 = i_this->m40C.y - (REG6_F(0xd) + 36.0f); - cLib_addCalc2(&i_this->m40C.y, REG12_F(0xd) + 186.0f, 0.5f, std::fabsf(fVar2) * (REG6_F(0x12) + 0.1f) * i_this->m43C); - fVar2 = i_this->m40C.z - (REG6_F(0xe) + 1442.0f); - cLib_addCalc2(&i_this->m40C.z, fVar2, 0.1f, std::fabsf(fVar2) * (REG6_F(0x12) + 0.1f) * i_this->m43C); - fVar2 = i_this->m418.x - (REG6_F(0xf) + -744.0f); - cLib_addCalc2(&i_this->m418.x, fVar2, 1.0f, std::fabsf(fVar2) * (REG6_F(0x12) + 0.1f) * i_this->m43C); - fVar2 = i_this->m418.y - (REG6_F(0x10) + 74.0f); - cLib_addCalc2(&i_this->m418.y, fVar2, 1.0f, std::fabsf(fVar2) * (REG6_F(0x12) + 0.1f) * i_this->m43C); - fVar2 = i_this->m418.z - (REG6_F(0x11) + -432.0f); - cLib_addCalc2(&i_this->m418.z, fVar2, 1.0f, std::fabsf(fVar2) * (REG6_F(0x12) + 0.1f) * i_this->m43C); + case 0x86: { + cLib_addCalc2(&i_this->m440, REG6_F(11) + 50.0f, 1.0f, 0.5f); + fVar2 = std::fabsf(i_this->m40C.x - (REG6_F(12) + -2340.0f)); + fVar9 = fVar2 * (REG6_F(18) + 0.1f); + cLib_addCalc2(&i_this->m40C.x, fVar2, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m40C.y - (REG6_F(13) + 36.0f)); + fVar9 = fVar2 * (REG6_F(18) + 0.1f); + cLib_addCalc2(&i_this->m40C.y, DEMO_SELECT(fVar2, REG12_F(13) + 186.0f), DEMO_SELECT(1.0f, 0.5f), DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m40C.z - (REG6_F(14) + 1442.0f)); + fVar9 = fVar2 * (REG6_F(18) + 0.1f); + cLib_addCalc2(&i_this->m40C.z, fVar2, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m418.x - (REG6_F(15) + -744.0f)); + fVar9 = fVar2 * (REG6_F(18) + 0.1f); + cLib_addCalc2(&i_this->m418.x, fVar2, 1.0f, DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m418.y - (REG6_F(16) + 74.0f)); + fVar9 = fVar2 * (REG6_F(18) + 0.1f); + cLib_addCalc2(&i_this->m418.y, fVar2, 1.0f, DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); + fVar2 = std::fabsf(i_this->m418.z - (REG6_F(17) + -432.0f)); + fVar9 = fVar2 * (REG6_F(18) + 0.1f); + cLib_addCalc2(&i_this->m418.z, fVar2, 1.0f, DEMO_SELECT(fVar9, fVar9 * i_this->m43C)); +#if VERSION > VERSION_DEMO cLib_addCalc2(&i_this->m43C, 1.0f, 1.0f, 0.04f); +#endif cLib_addCalc0(&i_this->m3AC.y, 1.0f, 3.0f); cLib_addCalc2(&i_this->m48C, -120.0f, 1.0f, 3.0f); - if (REG12_F(0xe) + i_this->mAcch.GetGroundH() < actor->current.pos.y) { + if (REG12_F(14) + i_this->mAcch.GetGroundH() < actor->current.pos.y) { break; } if (REG20_S(1) == 0) { @@ -2728,9 +2854,9 @@ void action_bunri_dousa(bpw_class* i_this) { break; } REG20_S(0) = 0; - unk2 = dComIfGp_particle_set(dPa_name::ID_AK_SN_BPWBREAKMASK00, &actor->current.pos, &actor->shape_angle); - if (unk2 != NULL) { - unk2->setGlobalPrmColor(g_env_light.mBG0_K0.r, g_env_light.mBG0_K0.g, g_env_light.mBG0_K0.b); + JPABaseEmitter* emitter = dComIfGp_particle_set(dPa_name::ID_AK_SN_BPWBREAKMASK00, &actor->current.pos, &actor->shape_angle); + if (emitter != NULL) { + emitter->setGlobalPrmColor(dKy_getEnvlight().mBG0_K0.r, dKy_getEnvlight().mBG0_K0.g, dKy_getEnvlight().mBG0_K0.b); } fopAcM_seStart(actor, JA_SE_CM_BOSS_EXPLODE, 0); sp70 = actor->current.pos; @@ -2739,11 +2865,14 @@ void action_bunri_dousa(bpw_class* i_this) { fopAcM_seStart(actor, JA_SE_CM_BPW_MASK_BREAK, 0); actor->scale.setall(0.0f); i_this->mActionState++; - i_this->mSomeCountdownTimers[0] = (s16)(int)(REG12_F(0x10) + 120.0f); + i_this->mSomeCountdownTimers[0] = (s16)(int)(REG12_F(16) + 120.0f); // fallthrough + } case 0x87: if (i_this->mSomeCountdownTimers[0] != 0) { - cLib_addCalc2(&i_this->m40C.y, REG12_F(0xd) + 186.0f, 0.3f, REG12_F(0xe) + 100.0f); +#if VERSION > VERSION_DEMO + cLib_addCalc2(&i_this->m40C.y, REG12_F(13) + 186.0f, 0.3f, REG12_F(14) + 100.0f); +#endif break; } f1 = player->current.pos.x - i_this->mBodyPos.x; @@ -2802,19 +2931,20 @@ void action_bunri_dousa(bpw_class* i_this) { cLib_addCalc2(&i_this->m3F0, REG9_F(8) + 600.0f, 1.0f, REG9_F(9) + 2.0f); dVar7 = cM_ssin((int)i_this->m3F4); i_this->m418.x = (f32)(i_this->m3F0 * dVar7); - cLib_addCalc2(&i_this->m418.y, REG9_F(10) + 900.0f, 1.0f, REG9_F(0xb) + 10.0f); + cLib_addCalc2(&i_this->m418.y, REG9_F(10) + 900.0f, 1.0f, REG9_F(11) + 10.0f); dVar7 = cM_scos((int)i_this->m3F4); i_this->m418.z = (f32)(i_this->m3F0 * dVar7); break; } - if (REG9_F(0xd) != 0.0f) { + fVar2 = 0.0f; + if (REG9_F(13) != fVar2) { i_this->mActionState = 0x87; i_this->mSomeCountdownTimers[0] = 0; break; } - if (REG9_F(0xc) != 0.0f) { + if (REG9_F(12) != fVar2) { i_this->mActionState = 0x87; - REG9_F(0xc) = 0.0f; + REG9_F(12) = 0.0f; i_this->mSomeCountdownTimers[0] = 0; break; } @@ -2848,8 +2978,6 @@ void action_bunri_dousa(bpw_class* i_this) { void action_start_demo(bpw_class* i_this) { fopAc_ac_c* actor = &i_this->actor; f32 fVar1; - bpw_class* pbVar3; - bpw_class* pfVar5; daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); @@ -2954,9 +3082,11 @@ void action_start_demo(bpw_class* i_this) { REG20_S(0) = 0; i_this->mSomeCountdownTimers[0] = (s16)(int)(REG18_F(0) + 40.0f); i_this->mSomeCountdownTimers[1] = (s16)(int)(REG18_F(1) + 110.0f); - i_this->mSomeCountdownTimers[2] = (s16)(int)(REG18_F(0xb) + 20.0f); + i_this->mSomeCountdownTimers[2] = (s16)(int)(REG18_F(11) + 20.0f); i_this->mActionState++; +#if VERSION > VERSION_DEMO i_this->m43C = 0.0f; +#endif // Fall-through case 0xce: if (i_this->mSomeCountdownTimers[2] == 1) { @@ -2968,26 +3098,28 @@ void action_start_demo(bpw_class* i_this) { f32 f3; f3 = std::fabsf(i_this->m440 - (REG6_F(3) + 55.0f)); f3 *= REG18_F(2) + 0.05f; - cLib_addCalc2(&i_this->m440, REG6_F(3) + 55.0f, 1.0f, f3 * i_this->m43C); + cLib_addCalc2(&i_this->m440, REG6_F(3) + 55.0f, 1.0f, DEMO_SELECT(f3, f3 * i_this->m43C)); f3 = std::fabsf(i_this->m40C.x); f3 *= REG18_F(2) + 0.05f; - cLib_addCalc2(&i_this->m40C.x, 0.0f, 0.1f, f3 * i_this->m43C); + cLib_addCalc2(&i_this->m40C.x, 0.0f, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(f3, f3 * i_this->m43C)); f3 = std::fabsf(i_this->m40C.y - 233.0f); f3 *= REG18_F(2) + 0.05f; - cLib_addCalc2(&i_this->m40C.y, 233.0f, 0.1f, f3 * i_this->m43C); + cLib_addCalc2(&i_this->m40C.y, 233.0f, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(f3, f3 * i_this->m43C)); f3 = std::fabsf(i_this->m40C.z - 552.0f); f3 *= REG18_F(2) + 0.05f; - cLib_addCalc2(&i_this->m40C.z, 552.0f, 0.1f, f3 * i_this->m43C); + cLib_addCalc2(&i_this->m40C.z, 552.0f, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(f3, f3 * i_this->m43C)); f3 = std::fabsf(i_this->m418.x); f3 *= REG18_F(2) + 0.05f; - cLib_addCalc2(&i_this->m418.x, 0.0f, 1.0f, f3 * i_this->m43C); + cLib_addCalc2(&i_this->m418.x, 0.0f, 1.0f, DEMO_SELECT(f3, f3 * i_this->m43C)); f3 = std::fabsf(i_this->m418.y - 270.0f); f3 *= REG18_F(2) + 0.05f; - cLib_addCalc2(&i_this->m418.y, 270.0f, 1.0f, f3 * i_this->m43C); + cLib_addCalc2(&i_this->m418.y, 270.0f, 1.0f, DEMO_SELECT(f3, f3 * i_this->m43C)); f3 = std::fabsf(i_this->m418.z - 722.0f); f3 *= REG18_F(2) + 0.05f; - cLib_addCalc2(&i_this->m418.z, 722.0f, 1.0f, f3 * i_this->m43C); + cLib_addCalc2(&i_this->m418.z, 722.0f, 1.0f, DEMO_SELECT(f3, f3 * i_this->m43C)); +#if VERSION > VERSION_DEMO cLib_addCalc2(&i_this->m43C, 1.0f, 1.0f, 0.04f); +#endif i_this->m3EA = 4; if (i_this->mSomeCountdownTimers[1] != 0) { break; @@ -3027,13 +3159,13 @@ void action_start_demo(bpw_class* i_this) { break; case 0xd0: if (i_this->m3F8 == 9) { - if (i_this->mpAnim->isStop()) { - anm_init(i_this, BPW_BCK_CORE1, 15.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + if (i_this->mpMorf->isStop()) { + anm_init(i_this, BPW_BCK_CORE1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_LOOP, 1.0f, -1); } - cLib_addCalc2(&i_this->m3AC.y, REG18_F(0xc) + 100.0f, 1.0f, REG18_F(0xd) + 10.0f); + cLib_addCalc2(&i_this->m3AC.y, REG18_F(12) + 100.0f, 1.0f, REG18_F(13) + 10.0f); fopAcM_seStart(actor, JA_SE_OBJ_BPW_MASK_LAUGH, 0); } else { - cLib_addCalc2(&i_this->m3AC.y, 140.0f, 1.0f, REG18_F(0xd) + 10.0f); + cLib_addCalc2(&i_this->m3AC.y, 140.0f, 1.0f, REG18_F(13) + 10.0f); } if (i_this->m464 != 0) { anm_init(i_this, BPW_BCK_CORE_NIGE1, 0.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); @@ -3060,26 +3192,28 @@ void action_start_demo(bpw_class* i_this) { f32 f3; f3 = std::fabsf(i_this->m440 - (REG6_F(4) + 65.0f)); f3 *= REG18_F(8) + 0.08f; - cLib_addCalc2(&i_this->m440, REG6_F(4) + 65.0f, 1.0f, f3 * i_this->m43C); + cLib_addCalc2(&i_this->m440, REG6_F(4) + 65.0f, 1.0f, DEMO_SELECT(f3, f3 * i_this->m43C)); f3 = std::fabsf(i_this->m40C.x - 281.0f); f3 *= REG18_F(8) + 0.08f; - cLib_addCalc2(&i_this->m40C.x, 281.0f, 0.1f, f3 * i_this->m43C); + cLib_addCalc2(&i_this->m40C.x, 281.0f, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(f3, f3 * i_this->m43C)); f3 = std::fabsf(i_this->m40C.y - 93.0f); f3 *= REG18_F(8) + 0.08f; - cLib_addCalc2(&i_this->m40C.y, 93.0f, 0.1f, f3 * i_this->m43C); + cLib_addCalc2(&i_this->m40C.y, 93.0f, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(f3, f3 * i_this->m43C)); f3 = std::fabsf(i_this->m40C.z - 725.0f); f3 *= REG18_F(8) + 0.08f; - cLib_addCalc2(&i_this->m40C.z, 725.0f, 0.1f, f3 * i_this->m43C); + cLib_addCalc2(&i_this->m40C.z, 725.0f, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(f3, f3 * i_this->m43C)); f3 = std::fabsf(i_this->m418.x - 336.0f); f3 *= REG18_F(8) + 0.08f; - cLib_addCalc2(&i_this->m418.x, 336.0f, 1.0f, f3 * i_this->m43C); + cLib_addCalc2(&i_this->m418.x, 336.0f, 1.0f, DEMO_SELECT(f3, f3 * i_this->m43C)); f3 = std::fabsf(i_this->m418.y - 30.0f); f3 *= REG18_F(8) + 0.08f; - cLib_addCalc2(&i_this->m418.y, 30.0f, 1.0f, f3 * i_this->m43C); + cLib_addCalc2(&i_this->m418.y, 30.0f, 1.0f, DEMO_SELECT(f3, f3 * i_this->m43C)); f3 = std::fabsf(i_this->m418.z - 877.0f); f3 *= REG18_F(8) + 0.08f; - cLib_addCalc2(&i_this->m418.z, 877.0f, 1.0f, f3 * i_this->m43C); + cLib_addCalc2(&i_this->m418.z, 877.0f, 1.0f, DEMO_SELECT(f3, f3 * i_this->m43C)); +#if VERSION > VERSION_DEMO cLib_addCalc2(&i_this->m43C, 1.0f, 1.0f, 0.04f); +#endif if (REG20_S(1) == 0) { REG20_S(0) = 1; } @@ -3090,48 +3224,55 @@ void action_start_demo(bpw_class* i_this) { if (i_this->mSomeCountdownTimers[0] != 0) { break; } - anm_init(i_this, BPW_BCK_OPENING1, (REG18_F(7) + 10.0f), J3DFrameCtrl::EMode_NONE, 1.0f, -1); - pbVar3 = (bpw_class*)fopAcM_SearchByID(i_this->m3FC); - if (pbVar3 != NULL) { - anm_init(pbVar3, BPW_BCK_OPENING_KAN1, (REG18_F(7) + 10.0f), J3DFrameCtrl::EMode_NONE, 1.0f, -1); + anm_init(i_this, BPW_BCK_OPENING1, REG18_F(7) + 10.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + bpw_class* lantern = (bpw_class*)fopAcM_SearchByID(i_this->m3FC); + if (lantern != NULL) { + anm_init(lantern, BPW_BCK_OPENING_KAN1, REG18_F(7) + 10.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); } i_this->mFire1DousaPos = i_this->m3B8; i_this->mFire1DousaRot = actor->shape_angle; +#if VERSION == VERSION_DEMO + i_this->m540_demo = + dComIfGp_particle_set(dPa_name::ID_AK_SN_BPWOPENINGSMOKE00, &i_this->mFire1DousaPos, &i_this->mFire1DousaRot, NULL, 0xFF, &i_this->m554); +#else if (i_this->m554.getEmitter() == NULL) { - dComIfGp_particle_set(dPa_name::ID_AK_SN_BPWOPENINGSMOKE00, &i_this->mFire1DousaPos, &i_this->mFire1DousaRot, NULL, 0xff, &i_this->m554); + dComIfGp_particle_set(dPa_name::ID_AK_SN_BPWOPENINGSMOKE00, &i_this->mFire1DousaPos, &i_this->mFire1DousaRot, NULL, 0xFF, &i_this->m554); } +#endif fopAcM_seStart(actor, JA_SE_CM_BPW_MASK_TO_BPW, 0); i_this->mActionState++; // Fall-through } case 0xd2: { - if (i_this->m554.getEmitter() != NULL) { + if (DEMO_SELECT(i_this->m540_demo, i_this->m554.getEmitter()) != NULL) { i_this->mFire1DousaPos = i_this->m3B8; i_this->mFire1DousaRot = actor->shape_angle; } f32 f3; f3 = std::fabsf(i_this->m440 - (REG6_F(4) + 65.0f)); f3 *= REG18_F(8) + 0.08f; - cLib_addCalc2(&i_this->m440, REG6_F(4) + 65.0f, 1.0f, f3 * i_this->m43C); + cLib_addCalc2(&i_this->m440, REG6_F(4) + 65.0f, 1.0f, DEMO_SELECT(f3, f3 * i_this->m43C)); f3 = std::fabsf(i_this->m40C.x - 281.0f); f3 *= REG18_F(8) + 0.08f; - cLib_addCalc2(&i_this->m40C.x, 281.0f, 0.1f, f3 * i_this->m43C); + cLib_addCalc2(&i_this->m40C.x, 281.0f, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(f3, f3 * i_this->m43C)); f3 = std::fabsf(i_this->m40C.y - 93.0f); f3 *= REG18_F(8) + 0.08f; - cLib_addCalc2(&i_this->m40C.y, 93.0f, 0.1f, f3 * i_this->m43C); + cLib_addCalc2(&i_this->m40C.y, 93.0f, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(f3, f3 * i_this->m43C)); f3 = std::fabsf(i_this->m40C.z - 725.0f); f3 *= REG18_F(8) + 0.08f; - cLib_addCalc2(&i_this->m40C.z, 725.0f, 0.1f, f3 * i_this->m43C); + cLib_addCalc2(&i_this->m40C.z, 725.0f, DEMO_SELECT(1.0f, 0.1f), DEMO_SELECT(f3, f3 * i_this->m43C)); f3 = std::fabsf(i_this->m418.x - 336.0f); f3 *= REG18_F(8) + 0.08f; - cLib_addCalc2(&i_this->m418.x, 336.0f, 1.0f, f3 * i_this->m43C); + cLib_addCalc2(&i_this->m418.x, 336.0f, 1.0f, DEMO_SELECT(f3, f3 * i_this->m43C)); f3 = std::fabsf(i_this->m418.y - 30.0f); f3 *= REG18_F(8) + 0.08f; - cLib_addCalc2(&i_this->m418.y, 30.0f, 1.0f, f3 * i_this->m43C); + cLib_addCalc2(&i_this->m418.y, 30.0f, 1.0f, DEMO_SELECT(f3, f3 * i_this->m43C)); f3 = std::fabsf(i_this->m418.z - 877.0f); f3 *= REG18_F(8) + 0.08f; - cLib_addCalc2(&i_this->m418.z, 877.0f, 1.0f, f3 * i_this->m43C); + cLib_addCalc2(&i_this->m418.z, 877.0f, 1.0f, DEMO_SELECT(f3, f3 * i_this->m43C)); +#if VERSION > VERSION_DEMO cLib_addCalc2(&i_this->m43C, 1.0f, 1.0f, 0.04f); +#endif cLib_addCalc2(&i_this->m3AC.y, 340.0f, 1.0f, 5.0f); if (REG20_S(1) == 0) { REG20_S(0) = 1; @@ -3140,15 +3281,23 @@ void action_start_demo(bpw_class* i_this) { break; } REG20_S(0) = 0; - if (!i_this->mpAnim->isStop()) { + if (!i_this->mpMorf->isStop()) { break; } +#if VERSION == VERSION_DEMO + if (i_this->m540_demo != NULL) { + i_this->m540_demo->becomeInvalidEmitter(); + i_this->m554.remove(); + i_this->m540_demo = NULL; + } +#else i_this->m554.remove(); +#endif i_this->mSomeCountdownTimers[0] = (s16)(int)(REG6_F(5) + 40.0f); anm_init(i_this, BPW_BCK_OPENING2, 0.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); - pbVar3 = (bpw_class*)fopAcM_SearchByID(i_this->m3FC); - if (pbVar3 != NULL) { - anm_init(pbVar3, BPW_BCK_OPENING_KAN2, 0.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + bpw_class* lantern = (bpw_class*)fopAcM_SearchByID(i_this->m3FC); + if (lantern != NULL) { + anm_init(lantern, BPW_BCK_OPENING_KAN2, 0.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); } i_this->mActionState++; // Fall-through @@ -3169,9 +3318,9 @@ void action_start_demo(bpw_class* i_this) { case 0xd4: if (i_this->mSomeCountdownTimers[0] == 0) { dComIfGp_getVibration().StopQuake(0x20); - pbVar3 = (bpw_class*)fopAcM_SearchByID(i_this->m3FC); - if (pbVar3 != NULL) { - anm_init(pbVar3, BPW_BCK_KAN_DEFAULT1, 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + bpw_class* lantern = (bpw_class*)fopAcM_SearchByID(i_this->m3FC); + if (lantern != NULL) { + anm_init(lantern, BPW_BCK_KAN_DEFAULT1, 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); } i_this->mSomeCountdownTimers[1] = 0; i_this->m3F6 = 4; @@ -3185,31 +3334,31 @@ void action_start_demo(bpw_class* i_this) { dComIfGs_onStageBossDemo(); i_this->m3F6 = 0; fopAcM_OffStatus(actor, fopAcStts_UNK4000_e); - i_this->mBodyAction = bpw_class::Action_MOVE_DOUSA_e; + i_this->mBodyAction = ACTION_MOVE_DOUSA; i_this->mActionState = 0; } default: break; } - if ((i_this->m3F8 == 0x1f) && (i_this->mpAnim->checkFrame(170.0f))) { + if ((i_this->m3F8 == 0x1f) && (i_this->mpMorf->checkFrame(170.0f))) { fopAcM_monsSeStart(actor, JA_SE_CV_BPW_LAUGH_ENTER, 0); } - if (((i_this->m3F8 == 0x1f) && (i_this->mpAnim->getFrame() >= 170.0f)) || (i_this->m3F8 == 0x20)) { + if (((i_this->m3F8 == 0x1f) && (i_this->mpMorf->getFrame() >= 170.0f)) || (i_this->m3F8 == 0x20)) { fopAcM_seStart(actor, JA_SE_CM_BPW_SWING_KANTERA, 0); } - if (((i_this->m3F8 == 0x1f) && (i_this->mpAnim->getFrame() >= 60.0f)) || (i_this->m3F8 == 0x20)) { + if (((i_this->m3F8 == 0x1f) && (i_this->mpMorf->getFrame() >= 60.0f)) || (i_this->m3F8 == 0x20)) { fopAcM_seStart(actor, JA_SE_OBJ_BPW_FLYING, 0); } if (i_this->mActionState >= 0xCA) { camera->mCamera.Set(i_this->m40C, i_this->m418, i_this->m440, 0); } if (i_this->mActionState >= 0xd1) { - pfVar5 = (bpw_class*)fopAcM_SearchByID(i_this->m3FC); - if (pfVar5 != NULL) { - pfVar5->mpAnim->play(NULL, 0, 0); - if (pfVar5->mpAnim->checkFrame(REG8_F(9) + 128.0f)) { + bpw_class* lantern = (bpw_class*)fopAcM_SearchByID(i_this->m3FC); + if (lantern != NULL) { + lantern->mpMorf->play(NULL, 0, 0); + if (lantern->mpMorf->checkFrame(REG8_F(9) + 128.0f)) { fopAcM_seStart(actor, JA_SE_CM_BPW_KANTERA_APPEAR, 0); - pfVar5->m3E7 = 0; + lantern->m3E7 = 0; } } } @@ -3258,7 +3407,7 @@ void kantera_calc(bpw_class* i_this) { cLib_addCalcAngleS2(&pfVar4->mKanteraDousaRot.z, REG12_S(5), 1, 0x1000); break; case 1: - if (i_this->mBodyAction != bpw_class::Action_START_DEMO_e) { + if (i_this->mBodyAction != ACTION_START_DEMO) { cLib_addCalcAngleS2(&i_this->m484, 3000, 1, 100); cLib_addCalc2(&i_this->m388, 2000.0f, 1.0f, 1000.0f); cLib_addCalc2(&i_this->m390, 2000.0f, 1.0f, 1000.0f); @@ -3334,22 +3483,22 @@ void body_execute(bpw_class* i_this) { dComIfG_Ccsp()->Set(&i_this->mBodyAtSph); } else { switch (i_this->mBodyAction) { - case bpw_class::Action_MOVE_DOUSA_e: + case ACTION_MOVE_DOUSA: action_dousa(i_this); break; - case bpw_class::Action_ATTACK_KOUGEKI_e: + case ACTION_ATTACK_KOUGEKI: action_kougeki(i_this); break; - case bpw_class::Action_BODY_DOWN_KARADA_TAORE_e: + case ACTION_BODY_DOWN_KARADA_TAORE: action_karada_taore(i_this); break; - case bpw_class::Action_DAMAGE_e: + case ACTION_DAMAGE: action_damage(i_this); break; - case bpw_class::Action_SEPARATION_BUNRI_DOUSA_e: + case ACTION_SEPARATION_BUNRI_DOUSA: action_bunri_dousa(i_this); break; - case bpw_class::Action_START_DEMO_e: + case ACTION_START_DEMO: action_start_demo(i_this); break; } @@ -3357,26 +3506,26 @@ void body_execute(bpw_class* i_this) { cLib_addCalcAngleS2(&actor->current.angle.y, i_this->m476, 1, i_this->m47A); cLib_addCalcAngleS2(&actor->shape_angle.y, actor->current.angle.y, 1, i_this->m47A); } - i_this->mpAnim->play(NULL, 0, 0); + i_this->mpMorf->play(NULL, 0, 0); if (i_this->m3E0 != 0) { - i_this->mBrkAnim->play(); + i_this->mpLightFreezeBrkAnm->play(); } else { if (i_this->m3E1 != 0) { - i_this->m2C4->play(); + i_this->mpLightStunBrkAnm->play(); } else { if (i_this->m3E2 == 2) { - i_this->m2C8->play(); + i_this->mpCurseStartBrkAnm->play(); fopAcM_seStart(actor, JA_SE_OBJ_BPW_FLYING_CURSE, 0); } else if (i_this->m3E2 == 1) { - if (i_this->m2CC->isStop()) { + if (i_this->mpCurseEndBrkAnm->isStop()) { noroi_brk_check(i_this, 2); } else { - i_this->m2CC->play(); + i_this->mpCurseEndBrkAnm->play(); fopAcM_seStart(actor, JA_SE_OBJ_BPW_FLYING_CURSE, 0); } } else { - i_this->m2D0->play(); - if (i_this->mBodyAction != bpw_class::Action_START_DEMO_e) { + i_this->mpDefaultBrkAnm->play(); + if (i_this->mBodyAction != ACTION_START_DEMO) { fopAcM_seStart(actor, JA_SE_OBJ_BPW_FLYING, 0); } } @@ -3415,9 +3564,9 @@ BOOL kantera_atari_check(bpw_class* i_this) { case AT_TYPE_SKULL_HAMMER: actor->speedF = 60.0f; actor->current.angle.y = player->shape_angle.y; - i_this->m3DF = 8; + i_this->mHitType = 8; if (player->getCutType() == daPy_py_c::CUT_TYPE_HAMMER_SIDESWING) { - i_this->m3DF = 9; + i_this->mHitType = 9; actor->current.angle.y = player->shape_angle.y + -0x4000; } fopAcM_seStart(actor, JA_SE_LK_HAMMER_HIT, 0x42); @@ -3429,7 +3578,7 @@ BOOL kantera_atari_check(bpw_class* i_this) { /* 0000A9DC-0000AD74 .text action_kantera_dousa__FP9bpw_class */ void action_kantera_dousa(bpw_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - short sVar4; + s16 sVar4; fopAc_ac_c* pfVar2; switch (i_this->mActionState) { @@ -3443,7 +3592,7 @@ void action_kantera_dousa(bpw_class* i_this) { i_this->m3AC.z = 0.0f; i_this->m498 = 50.0f; i_this->m49C = 200.0f; - i_this->mKanteraCoSph.OffCoSetBit(); + i_this->mKanteraCoSph.ClrCoSet(); i_this->m48C = 60.0f; i_this->mActionState++; break; @@ -3531,7 +3680,7 @@ void kantera_execute(bpw_class* i_this) { local_28 = i_this->m358; switch (i_this->mBodyAction) { - case bpw_class::Action_MOVE_DOUSA_e: + case ACTION_MOVE_DOUSA: action_kantera_dousa(i_this); } @@ -3539,7 +3688,7 @@ void kantera_execute(bpw_class* i_this) { i_this->mKanteraCoSph.SetR(70.0f); dComIfG_Ccsp()->Set(&i_this->mKanteraCoSph); if (i_this->m3E7 == 0) { - i_this->mKanteraAnim->play(); + i_this->mpLanternGlowBrkAnm->play(); } if (i_this->mKanteraCoSph.ChkTgHit()) { pcVar2 = i_this->mKanteraCoSph.GetTgHitObj(); @@ -3574,14 +3723,11 @@ void kantera_execute(bpw_class* i_this) { /* 0000B004-0000B700 .text action_b_fire_1_dousa__FP9bpw_class */ void action_b_fire_1_dousa(bpw_class* i_this) { - /* Nonmatching - "cLib_addCalc2" */ fopAc_ac_c* actor = &i_this->actor; f32 fVar1; f32 fVar2; - bool bVar8; - cM3dGPla* pcVar7; cXyz local_c4; - dBgS_LinChk local_b8; + dBgS_LinChk linChk; switch (i_this->mActionState) { case 10: @@ -3590,38 +3736,46 @@ void action_b_fire_1_dousa(bpw_class* i_this) { } i_this->m498 = 0.0f; i_this->m49C = 40.0f; +#if VERSION == VERSION_DEMO + i_this->m534_demo = dComIfGp_particle_set( + dPa_name::ID_AK_SN_BPWFLAMETHROWER00, &i_this->mFire1DousaPos, &i_this->mFire1DousaRot, NULL, 0xFF, &i_this->mFire1Dousa_Pa_followEcallBack + ); + i_this->m538_demo = dComIfGp_particle_set( + dPa_name::ID_AK_SN_BPWFLAMETHROWER01, &i_this->mFire1DousaPos, &i_this->mFire1DousaRot, NULL, 0xFF, &i_this->mFire1Dousa_Pa_followEcallBack2 + ); +#else if (i_this->mFire1Dousa_Pa_followEcallBack.getEmitter() == NULL) { dComIfGp_particle_set( - dPa_name::ID_AK_SN_BPWFLAMETHROWER00, &i_this->mFire1DousaPos, &i_this->mFire1DousaRot, NULL, 0xff, &i_this->mFire1Dousa_Pa_followEcallBack + dPa_name::ID_AK_SN_BPWFLAMETHROWER00, &i_this->mFire1DousaPos, &i_this->mFire1DousaRot, NULL, 0xFF, &i_this->mFire1Dousa_Pa_followEcallBack ); } if (i_this->mFire1Dousa_Pa_followEcallBack2.getEmitter() == NULL) { dComIfGp_particle_set( - dPa_name::ID_AK_SN_BPWFLAMETHROWER01, &i_this->mFire1DousaPos, &i_this->mFire1DousaRot, NULL, 0xff, &i_this->mFire1Dousa_Pa_followEcallBack2 + dPa_name::ID_AK_SN_BPWFLAMETHROWER01, &i_this->mFire1DousaPos, &i_this->mFire1DousaRot, NULL, 0xFF, &i_this->mFire1Dousa_Pa_followEcallBack2 ); } +#endif i_this->mSomeCountdownTimers[0] = 5; i_this->m3A0 = actor->current.pos; i_this->mActionState++; // fallthrough case 11: i_this->m462 += (s16)(REG6_S(0) + 0x5dc); - i_this->m494 = (int)(REG6_S(1) + 0x32U); + i_this->m494 = (int)(REG6_S(1) + 0x32); actor->shape_angle.y += (s32)((REG6_S(2) + 2000.0f) * cM_ssin(i_this->m462)); i_this->m304[0] = actor->current.pos; - cMtx_YrotS(*calc_mtx, (int)actor->shape_angle.y); + cMtx_YrotS(*calc_mtx, actor->shape_angle.y); cMtx_XrotM(*calc_mtx, actor->shape_angle.x); local_c4.x = 0.0f; local_c4.y = 0.0f; local_c4.z = 1000.0f; MtxPosition(&local_c4, i_this->m328); i_this->m328[0] += actor->current.pos; - local_b8.Set(i_this->m304, i_this->m328, actor); - bVar8 = dComIfG_Bgsp()->LineCross(&local_b8); - if (bVar8) { - pcVar7 = dComIfG_Bgsp()->GetTriPla(local_b8); - (i_this->m66C) = *local_b8.GetCrossP(); - if (pcVar7->GetNP()->y == 1.0f) { + linChk.Set(i_this->m304, i_this->m328, actor); + if (dComIfG_Bgsp()->LineCross(&linChk)) { + cM3dGPla* pla = dComIfG_Bgsp()->GetTriPla(linChk); + (i_this->m66C) = *linChk.GetCrossP(); + if (pla->GetNP()->y == 1.0f) { i_this->m67E = 0; } else { fVar1 = i_this->m304[0].x - i_this->m66C.x; @@ -3629,11 +3783,26 @@ void action_b_fire_1_dousa(bpw_class* i_this) { i_this->m67E = 0x4000; i_this->m680 = cM_atan2s(fVar1, fVar2); } - if (i_this->m590.getEmitter() == NULL) { - dComIfGp_particle_set(dPa_name::ID_AK_SN_BPWFLAMETHROWER02, &i_this->m66C, (csXyz*)&i_this->m67E, NULL, 0xff, &i_this->m590); +#if VERSION == VERSION_DEMO + if (i_this->m53C_demo == NULL) { + i_this->m53C_demo = + dComIfGp_particle_set(dPa_name::ID_AK_SN_BPWFLAMETHROWER02, &i_this->m66C, (csXyz*)&i_this->m67E, NULL, 0xFF, &i_this->m590); } +#else + if (i_this->m590.getEmitter() == NULL) { + dComIfGp_particle_set(dPa_name::ID_AK_SN_BPWFLAMETHROWER02, &i_this->m66C, (csXyz*)&i_this->m67E, NULL, 0xFF, &i_this->m590); + } +#endif } else { +#if VERSION == VERSION_DEMO + if (i_this->m53C_demo) { + i_this->m53C_demo->becomeInvalidEmitter(); + i_this->m590.remove(); + i_this->m53C_demo = NULL; + } +#else i_this->m590.remove(); +#endif } i_this->mFire1DousaPos = actor->current.pos; i_this->mFire1DousaRot = actor->shape_angle; @@ -3641,9 +3810,12 @@ void action_b_fire_1_dousa(bpw_class* i_this) { if (i_this->m464 != 0) { local_c4 = i_this->m304[0]; } - cLib_addCalc2(&i_this->m3A0.x, local_c4.x, 1.0f, std::fabsf(i_this->m304[0].x - i_this->m328[0].x) * 0.3f); - cLib_addCalc2(&i_this->m3A0.y, local_c4.y, 1.0f, std::fabsf(i_this->m304[0].y - i_this->m328[0].y) * 0.3f); - cLib_addCalc2(&i_this->m3A0.z, local_c4.z, 1.0f, std::fabsf(i_this->m304[0].z - i_this->m328[0].z) * 0.3f); + fVar1 = std::fabsf(i_this->m304[0].x - i_this->m328[0].x) * 0.3f; + cLib_addCalc2(&i_this->m3A0.x, local_c4.x, 1.0f, fVar1); + fVar1 = std::fabsf(i_this->m304[0].y - i_this->m328[0].y) * 0.3f; + cLib_addCalc2(&i_this->m3A0.y, local_c4.y, 1.0f, fVar1); + f32 z = std::fabsf(i_this->m304[0].z - i_this->m328[0].z) * 0.3f; + cLib_addCalc2(&i_this->m3A0.z, local_c4.z, 1.0f, z); f32 fVar_x = i_this->m3A0.x - local_c4.x; f32 fVar_y = i_this->m3A0.y - local_c4.y; f32 fVar_z = i_this->m3A0.z - local_c4.z; @@ -3660,7 +3832,6 @@ void action_b_fire_1_dousa(bpw_class* i_this) { void action_b_fire_2_dousa(bpw_class* i_this) { daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); fopAc_ac_c* actor = &i_this->actor; - int iVar4; cXyz local_30; csXyz local_38 = actor->shape_angle; @@ -3672,19 +3843,27 @@ void action_b_fire_2_dousa(bpw_class* i_this) { } i_this->m498 = 0.0f; i_this->m49C = 40.0f; +#if VERSION == VERSION_DEMO + i_this->m594_demo = dComIfGp_particle_set( + dPa_name::ID_AK_SN_BPWFIRE00, &i_this->mFire1DousaPos, &i_this->mFire1DousaRot, NULL, 0xFF, &i_this->mFireDousa2_Pa_followEcallBack + ); + i_this->m598_demo = dComIfGp_particle_set( + dPa_name::ID_AK_SN_BPWFIRE01, &i_this->mFire1DousaPos, &i_this->mFire1DousaRot, NULL, 0xFF, &i_this->mFireDousa2_Pa_followEcallBack2 + ); +#else if (i_this->mFireDousa2_Pa_followEcallBack.getEmitter() == NULL) { dComIfGp_particle_set( - dPa_name::ID_AK_SN_BPWFIRE00, &i_this->mFire1DousaPos, &i_this->mFire1DousaRot, NULL, 0xff, &i_this->mFireDousa2_Pa_followEcallBack + dPa_name::ID_AK_SN_BPWFIRE00, &i_this->mFire1DousaPos, &i_this->mFire1DousaRot, NULL, 0xFF, &i_this->mFireDousa2_Pa_followEcallBack ); } if (i_this->mFireDousa2_Pa_followEcallBack2.getEmitter() == NULL) { dComIfGp_particle_set( - dPa_name::ID_AK_SN_BPWFIRE01, &i_this->mFire1DousaPos, &i_this->mFire1DousaRot, NULL, 0xff, &i_this->mFireDousa2_Pa_followEcallBack2 + dPa_name::ID_AK_SN_BPWFIRE01, &i_this->mFire1DousaPos, &i_this->mFire1DousaRot, NULL, 0xFF, &i_this->mFireDousa2_Pa_followEcallBack2 ); } - iVar4 = cM_atan2s(player->current.pos.x - actor->current.pos.x, player->current.pos.z - actor->current.pos.z); - actor->current.angle.y = (s16)iVar4; - actor->current.angle.y += (int)cM_rndFX(14384.0f); +#endif + actor->current.angle.y = cM_atan2s(player->current.pos.x - actor->current.pos.x, player->current.pos.z - actor->current.pos.z); + actor->current.angle.y += (int)cM_rndFX(DEMO_SELECT(REG11_F(18) + 14384.0f, 14384.0f)); actor->shape_angle.y = actor->current.angle.y; actor->speedF = 15.0f; actor->speedF += cM_rndFX(20.0f); @@ -3692,7 +3871,7 @@ void action_b_fire_2_dousa(bpw_class* i_this) { actor->speed.y += cM_rndFX(10.0f); actor->gravity = -3.0f; actor->shape_angle.x = -0x2000; - i_this->m494 = (s32)(REG6_S(3) + 0x1eU); + i_this->m494 = (s32)(REG6_S(3) + 0x1e); i_this->mFire1DousaPos = actor->current.pos; i_this->mFire1DousaRot = actor->shape_angle; i_this->mActionState++; @@ -3709,8 +3888,21 @@ void action_b_fire_2_dousa(bpw_class* i_this) { dComIfGp_particle_set(dPa_name::ID_AK_SN_BPWFLOORFIRE01, &local_30, &local_38); dComIfGp_particle_set(dPa_name::ID_AK_SN_BPWFLOORFIRE02, &local_30, &local_38); dComIfGp_particle_set(dPa_name::ID_AK_SN_BPWHITFIRE00, &local_30, &actor->current.angle); +#if VERSION == VERSION_DEMO + if (i_this->m594_demo != NULL) { + i_this->m594_demo->becomeInvalidEmitter(); + i_this->mFireDousa2_Pa_followEcallBack.remove(); + i_this->m594_demo = NULL; + } + if (i_this->m598_demo != NULL) { + i_this->m598_demo->becomeInvalidEmitter(); + i_this->mFireDousa2_Pa_followEcallBack2.remove(); + i_this->m598_demo = NULL; + } +#else i_this->mFireDousa2_Pa_followEcallBack.remove(); i_this->mFireDousa2_Pa_followEcallBack2.remove(); +#endif if (i_this->mSomeCountdownTimers[1] == 0) { i_this->mSomeCountdownTimers[1] = (s16)(int)cM_rndF(5.0f); i_this->m47E = (s16)(int)(cM_rndF(5.0f) + 8.0f); @@ -3719,7 +3911,7 @@ void action_b_fire_2_dousa(bpw_class* i_this) { actor->speedF = 0.0f; actor->gravity = 0.0f; actor->speed.setall(0.0f); - i_this->m494 = (s32)(REG6_S(4) + 0x23U); + i_this->m494 = (s32)(REG6_S(4) + 0x23); i_this->mActionState = 0x16; } else { if ((i_this->mAcch.ChkWallHit()) || (i_this->mDamageBallCoSph.ChkAtHit())) { @@ -3745,8 +3937,21 @@ void action_b_fire_2_dousa(bpw_class* i_this) { } break; case 0x17: +#if VERSION == VERSION_DEMO + if (i_this->m594_demo != NULL) { + i_this->m594_demo->becomeInvalidEmitter(); + i_this->mFireDousa2_Pa_followEcallBack.remove(); + i_this->m594_demo = NULL; + } + if (i_this->m598_demo != NULL) { + i_this->m598_demo->becomeInvalidEmitter(); + i_this->mFireDousa2_Pa_followEcallBack2.remove(); + i_this->m598_demo = NULL; + } +#else i_this->mFireDousa2_Pa_followEcallBack.remove(); i_this->mFireDousa2_Pa_followEcallBack2.remove(); +#endif fopAcM_delete(actor); break; } @@ -3772,14 +3977,14 @@ static void damage_ball_execute(bpw_class* i_this) { case 1: action_b_fire_2_dousa(i_this); local_18 = actor->current.pos; - i_this->m4EC.mPos.x = local_18.x; - i_this->m4EC.mPos.y = actor->current.pos.y; - i_this->m4EC.mPos.z = actor->current.pos.z; - i_this->m4EC.mColor.r = 300; - i_this->m4EC.mColor.g = 0x96; - i_this->m4EC.mColor.b = 0x14; - i_this->m4EC.mPower = 450.0f; - i_this->m4EC.mFluctuation = 250.0f; + i_this->mLightInfluence.mPos.x = local_18.x; + i_this->mLightInfluence.mPos.y = actor->current.pos.y; + i_this->mLightInfluence.mPos.z = actor->current.pos.z; + i_this->mLightInfluence.mColor.r = 300; + i_this->mLightInfluence.mColor.g = 0x96; + i_this->mLightInfluence.mColor.b = 0x14; + i_this->mLightInfluence.mPower = 450.0f; + i_this->mLightInfluence.mFluctuation = 250.0f; break; } i_this->mDamageBallCoSph.SetC(local_18); @@ -3808,8 +4013,8 @@ void torituki_execute(bpw_class* i_this) { actor->scale.z = fVar1; actor->scale.y = fVar1; if (!(actor->scale.x < 0.3f)) { - anm_init(i_this, BPW_BCK_TORITUKI1, 15.0f, 2, 1.0f, -1); - i_this->mSomeCountdownTimers[8] = 0x96; + anm_init(i_this, BPW_BCK_TORITUKI1, DEMO_SELECT(REG11_F(0) + 15.0f, 15.0f), J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + i_this->mSomeCountdownTimers[8] = DEMO_SELECT(0xD2, 0x96); actor->scale.setall(0.4f); i_this->mActionState++; // fallthrough @@ -3843,8 +4048,8 @@ void torituki_execute(bpw_class* i_this) { } break; } - i_this->mpAnim->play(NULL, 0, 0); - cLib_addCalcAngleS2(&i_this->m47E, 0xff, 1, 10); + i_this->mpMorf->play(NULL, 0, 0); + cLib_addCalcAngleS2(&i_this->m47E, 0xFF, 1, 10); if (i_this->mActionState == 2) { actor->current.pos = player->getHeadTopPos(); i_this->m47C = i_this->m47C + 700; @@ -3855,12 +4060,8 @@ void torituki_execute(bpw_class* i_this) { /* 0000C154-0000C5C0 .text daBPW_Execute__FP9bpw_class */ static BOOL daBPW_Execute(bpw_class* i_this) { - /* Nonmatching - "local_1c" sqrtf, regalloc */ + /* Nonmatching - retail-only regalloc */ fopAc_ac_c* actor = &i_this->actor; - f32 fVar2; - f32 fVar3; - f32 fVar5; - JPABaseEmitter* pJVar8; cXyz local_1c; cXyz local_28; @@ -3877,21 +4078,21 @@ static BOOL daBPW_Execute(bpw_class* i_this) { } } switch (i_this->mType) { - case bpw_class::Actor_Type_BODY_e: + case ACTOR_TYPE_BODY: body_execute(i_this); light_on_off(i_this); break; - case bpw_class::Actor_Type_KANTERA_e: + case ACTOR_TYPE_KANTERA: kantera_execute(i_this); break; - case bpw_class::Actor_Type_DAMAGE_BALL_e: + case ACTOR_TYPE_DAMAGE_BALL: damage_ball_execute(i_this); break; - case bpw_class::Actor_Type_TORITUKI_e: + case ACTOR_TYPE_TORITUKI: torituki_execute(i_this); break; } - cMtx_YrotS(*calc_mtx, (int)actor->current.angle.y); + cMtx_YrotS(*calc_mtx, actor->current.angle.y); local_1c.x = 0.0f; local_1c.y = 0.0f; local_1c.z = actor->speedF; @@ -3903,7 +4104,7 @@ static BOOL daBPW_Execute(bpw_class* i_this) { actor->speed.y = -100.0f; } switch (i_this->mType) { - case bpw_class::Actor_Type_BODY_e: + case ACTOR_TYPE_BODY: if (i_this->mBodyCoSph.ChkCoSet()) { fopAcM_posMove(actor, i_this->mStts.GetCCMoveP()); } else { @@ -3912,7 +4113,7 @@ static BOOL daBPW_Execute(bpw_class* i_this) { BG_check(i_this); draw_SUB(i_this); break; - case bpw_class::Actor_Type_KANTERA_e: + case ACTOR_TYPE_KANTERA: if (i_this->mActionState != 1) { fopAcM_posMove(actor, i_this->mStts.GetCCMoveP()); BG_check(i_this); @@ -3920,52 +4121,50 @@ static BOOL daBPW_Execute(bpw_class* i_this) { kantera_draw_SUB(i_this); if (i_this->m3E7 == 0) { if (i_this->m5CC.getEmitter() == NULL) { - dComIfGp_particle_set(dPa_name::ID_AK_JN_TORCH, &i_this->m358, NULL, &actor->scale, 0xff, &i_this->m5CC); + dComIfGp_particle_set(dPa_name::ID_AK_JN_TORCH, &i_this->m358, NULL, &actor->scale, 0xFF, &i_this->m5CC); i_this->mFire1DousaPos = i_this->m358; } - pJVar8 = i_this->m5CC.getEmitter(); - if (pJVar8 != NULL) { - fVar3 = (REG0_F(4) + -0.03f) * (i_this->m358.x - i_this->mFire1DousaPos.x); - fVar2 = 1.0f; - if (fVar3 > 1.0f) { - fVar2 = fVar3; - } else if (fVar3 < -1.0f) { - fVar2 = -1.0f; + JPABaseEmitter* emitter = i_this->m5CC.getEmitter(); + if (emitter != NULL) { + Vec vec1; + vec1.x = (i_this->m358.x - i_this->mFire1DousaPos.x) * (-0.03f + REG0_F(4)); + if (vec1.x > 1.0f) { + vec1.x = 1.0f; + } else if (vec1.x < -1.0f) { + vec1.x = -1.0f; } - fVar5 = (REG0_F(4) + -0.03f) * (i_this->m358.z - i_this->mFire1DousaPos.z); - fVar3 = 1.0f; - if (fVar5 > 1.0f) { - fVar3 = fVar5; - } else if (fVar5 < -1.0f) { - fVar3 = -1.0f; + vec1.z = (i_this->m358.z - i_this->mFire1DousaPos.z) * (-0.03f + REG0_F(4)); + if (vec1.z > 1.0f) { + vec1.z = 1.0f; + } else if (vec1.z < -1.0f) { + vec1.z = -1.0f; } - (pJVar8->mEmitterDir).x = fVar2; - (pJVar8->mEmitterDir).y = 0.1f; - (pJVar8->mEmitterDir).z = fVar3; - local_1c = actor->current.pos - actor->old.pos; - fVar2 = std::sqrtf(local_1c.x * local_1c.x + local_1c.y * local_1c.y + local_1c.z * local_1c.z); - fVar2 = fVar2 * 0.05f + 1.0f; - if (fVar2 > 2.0f) { - fVar2 = 2.0f; + JGeometry::TVec3 dir(vec1.x, 0.1f, vec1.z); + emitter->setDirection(dir); + JGeometry::TVec3 vel = actor->current.pos - actor->old.pos; + Vec vec2; + vec2.x = 1.0f; + vec2.y = 1.0f + std::sqrtf(SQUARE(vel.x) + SQUARE(vel.y) + SQUARE(vel.z)) * 0.05f; + if (vec2.y > 2.0f) { + vec2.y = 2.0f; } - pJVar8->mGlobalParticleScale.x = 1.0f; - pJVar8->mGlobalParticleScale.y = fVar2; - pJVar8->mGlobalParticleScale.z = 1.0f; + JGeometry::TVec3 scale(vec2.x, vec2.y, vec2.x); + emitter->setGlobalParticleScale(scale); i_this->mFire1DousaPos = i_this->m358; mDoAud_seStart(JA_SE_OBJ_TORCH_BURNING, &i_this->m358, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } } break; - case bpw_class::Actor_Type_DAMAGE_BALL_e: + case ACTOR_TYPE_DAMAGE_BALL: fopAcM_posMove(actor, NULL); BG_check(i_this); draw_SUB(i_this); break; - case bpw_class::Actor_Type_TORITUKI_e: + case ACTOR_TYPE_TORITUKI: draw_SUB(i_this); break; } - if (i_this->mType == bpw_class::Actor_Type_BODY_e) { + if (i_this->mType == ACTOR_TYPE_BODY) { kantera_calc(i_this); vib_mode_check(i_this); kankyou_hendou(i_this); @@ -3984,26 +4183,70 @@ static BOOL daBPW_Delete(bpw_class* i_this) { mDoAud_seDeleteObject(&i_this->m358); mDoAud_seDeleteObject(&i_this->m3C4); #endif - dComIfG_resDeleteDemo(&i_this->m2AC, "BPW"); - if (i_this->mType == bpw_class::Actor_Type_KANTERA_e) { + dComIfG_resDeleteDemo(&i_this->mPhase, "BPW"); + if (i_this->mType == ACTOR_TYPE_KANTERA) { i_this->m5CC.remove(); } for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m5E0); i++) { i_this->m5E0[i].remove(); } +#if VERSION == VERSION_DEMO + if (i_this->m534_demo != NULL) { + i_this->m534_demo->becomeInvalidEmitter(); + i_this->mFire1Dousa_Pa_followEcallBack.remove(); + i_this->m534_demo = NULL; + } + if (i_this->m538_demo != NULL) { + i_this->m538_demo->becomeInvalidEmitter(); + i_this->mFire1Dousa_Pa_followEcallBack2.remove(); + i_this->m538_demo = NULL; + } + if (i_this->m53C_demo != NULL) { + i_this->m53C_demo->becomeInvalidEmitter(); + i_this->m590.remove(); + i_this->m53C_demo = NULL; + } + if (i_this->m508_demo != NULL) { + i_this->m508_demo->becomeInvalidEmitter(); + i_this->m508_demo = NULL; + } + if (i_this->m540_demo != NULL) { + i_this->m540_demo->becomeInvalidEmitter(); + i_this->m554.remove(); + i_this->m540_demo = NULL; + } + if (i_this->m50C_demo != NULL) { + i_this->m50C_demo->becomeInvalidEmitter(); + i_this->m50C_demo = NULL; + } + if (i_this->m594_demo != NULL) { + i_this->m594_demo->becomeInvalidEmitter(); + i_this->mFireDousa2_Pa_followEcallBack.remove(); + i_this->m594_demo = NULL; + } + if (i_this->m598_demo != NULL) { + i_this->m598_demo->becomeInvalidEmitter(); + i_this->mFireDousa2_Pa_followEcallBack2.remove(); + i_this->m598_demo = NULL; + } + if (i_this->m510_demo != NULL) { + i_this->m510_demo->becomeInvalidEmitter(); + i_this->m50C.remove(); + i_this->m510_demo = NULL; + } +#else i_this->mFire1Dousa_Pa_followEcallBack.remove(); i_this->mFire1Dousa_Pa_followEcallBack2.remove(); i_this->m590.remove(); i_this->m554.remove(); i_this->mFireDousa2_Pa_followEcallBack.remove(); i_this->mFireDousa2_Pa_followEcallBack2.remove(); -#if VERSION > VERSION_DEMO i_this->m540.remove(); i_this->m52C.remove(); -#endif i_this->m50C.remove(); - if (i_this->mUnknownParam2 == bpw_class::Damage_Action_DAMAGE_BALL_e) { - dKy_plight_cut(&i_this->m4EC); +#endif + if (i_this->mUnknownParam2 == DAMAGE_ACTION_DAMAGE_BALL) { + dKy_plight_cut(&i_this->mLightInfluence); } if (i_this->mSomeCountdownTimers[8] != 0) { daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); @@ -4014,15 +4257,12 @@ static BOOL daBPW_Delete(bpw_class* i_this) { /* 0000C770-0000CC40 .text boss_useHeapInit__FP10fopAc_ac_c */ static BOOL boss_useHeapInit(fopAc_ac_c* a_this) { - /* Nonmatching - regalloc */ - mDoExt_McaMorf* unk1; - J3DModel* pJVar1; - mDoExt_brkAnm* local_r3_312; - J3DAnmTevRegKey* pJVar2; - mDoExt_brkAnm* pmVar4; + /* Nonmatching - retail-only regalloc */ + J3DModel* model; + J3DAnmTevRegKey* pBrk; bpw_class* i_this = (bpw_class*)a_this; - unk1 = new mDoExt_McaMorf( + i_this->mpMorf = new mDoExt_McaMorf( (J3DModelData*)dComIfG_getObjectRes("BPW", BPW_BDL_BPW), NULL, NULL, @@ -4036,61 +4276,55 @@ static BOOL boss_useHeapInit(fopAc_ac_c* a_this) { 0x80000, 0x37441422 ); - i_this->mpAnim = unk1; - if ((i_this->mpAnim == NULL) || (i_this->mpAnim->getModel() == NULL)) { + if ((i_this->mpMorf == NULL) || (i_this->mpMorf->getModel() == NULL)) { return FALSE; } - i_this->mpAnim->getModel()->setUserArea((u32)i_this); - for (u16 uVar6 = 0; uVar6 < i_this->mpAnim->getModel()->getModelData()->getJointNum(); uVar6++) { - i_this->mpAnim->getModel()->getModelData()->getJointNodePointer(uVar6)->setCallBack(body_nodeCallBack); + i_this->mpMorf->getModel()->setUserArea((u32)i_this); + for (u16 i = 0; i < i_this->mpMorf->getModel()->getModelData()->getJointNum(); i++) { + i_this->mpMorf->getModel()->getModelData()->getJointNodePointer(i)->setCallBack(body_nodeCallBack); } - pJVar1 = i_this->mpAnim->getModel(); - local_r3_312 = new mDoExt_brkAnm(); - i_this->mBrkAnim = local_r3_312; - if (i_this->mBrkAnim == NULL) { + model = i_this->mpMorf->getModel(); + i_this->mpLightFreezeBrkAnm = new mDoExt_brkAnm(); + if (i_this->mpLightFreezeBrkAnm == NULL) { return FALSE; } - pJVar2 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_HIRARU1); - if (!i_this->mBrkAnim->init(pJVar1->getModelData(), pJVar2, true, J3DFrameCtrl::EMode_NONE)) { + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_HIRARU1); + if (!i_this->mpLightFreezeBrkAnm->init(model->getModelData(), pBrk, true, J3DFrameCtrl::EMode_NONE)) { return FALSE; } - pmVar4 = new mDoExt_brkAnm(); - i_this->m2C4 = pmVar4; - if (i_this->m2C4 == NULL) { + i_this->mpLightStunBrkAnm = new mDoExt_brkAnm(); + if (i_this->mpLightStunBrkAnm == NULL) { return FALSE; } - pJVar2 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_HIT); - if (!i_this->m2C4->init(pJVar1->getModelData(), pJVar2, true, J3DFrameCtrl::EMode_LOOP)) { + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_HIT); + if (!i_this->mpLightStunBrkAnm->init(model->getModelData(), pBrk, true, J3DFrameCtrl::EMode_LOOP)) { return FALSE; } - pmVar4 = new mDoExt_brkAnm(); - i_this->m2C8 = pmVar4; - if (i_this->m2C8 == NULL) { + i_this->mpCurseStartBrkAnm = new mDoExt_brkAnm(); + if (i_this->mpCurseStartBrkAnm == NULL) { return FALSE; } - pJVar2 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_NOROI_S1); - if (!i_this->m2C8->init(pJVar1->getModelData(), pJVar2, true, J3DFrameCtrl::EMode_NONE)) { + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_NOROI_S1); + if (!i_this->mpCurseStartBrkAnm->init(model->getModelData(), pBrk, true, J3DFrameCtrl::EMode_NONE)) { return FALSE; } - pmVar4 = new mDoExt_brkAnm(); - i_this->m2CC = pmVar4; - if (i_this->m2CC == NULL) { + i_this->mpCurseEndBrkAnm = new mDoExt_brkAnm(); + if (i_this->mpCurseEndBrkAnm == NULL) { return FALSE; } - pJVar2 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_NOROI_E1); - if (!i_this->m2CC->init(pJVar1->getModelData(), pJVar2, true, J3DFrameCtrl::EMode_NONE)) { + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_NOROI_E1); + if (!i_this->mpCurseEndBrkAnm->init(model->getModelData(), pBrk, true, J3DFrameCtrl::EMode_NONE)) { return FALSE; } - pmVar4 = new mDoExt_brkAnm(); - i_this->m2D0 = pmVar4; - if (i_this->m2D0 == NULL) { + i_this->mpDefaultBrkAnm = new mDoExt_brkAnm(); + if (i_this->mpDefaultBrkAnm == NULL) { return FALSE; } - pJVar2 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_DEFAULT); - if (!i_this->m2D0->init(pJVar1->getModelData(), pJVar2, true, J3DFrameCtrl::EMode_LOOP)) { + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_DEFAULT); + if (!i_this->mpDefaultBrkAnm->init(model->getModelData(), pBrk, true, J3DFrameCtrl::EMode_LOOP)) { return FALSE; } - if (!i_this->mD78.create(i_this->mpAnim->getModel())) { + if (!i_this->mInvisibleModel.create(i_this->mpMorf->getModel())) { return FALSE; } return TRUE; @@ -4164,7 +4398,7 @@ void body_create_init(bpw_class* i_this) { i_this->m3F6 = 2; } i_this->mBodyPos = actor->current.pos; - actor->cullMtx = i_this->mpAnim->getModel()->getBaseTRMtx(); + fopAcM_SetMtx(actor, i_this->mpMorf->getModel()->getBaseTRMtx()); fopAcM_setCullSizeBox(actor, -300.0f, -300.0f, -300.0f, 300.0f, 300.0f, 300.0f); actor->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e; actor->attention_info.distances[2] = 4; @@ -4175,36 +4409,34 @@ void body_create_init(bpw_class* i_this) { fopAcM_OnStatus(actor, fopAcStts_UNK10000_e); i_this->mBodyCoSph.Set(body_co_sph_src); i_this->mBodyCoSph.SetStts(&i_this->mStts); - i_this->mBodyCoSph.OffCoSetBit(); + i_this->mBodyCoSph.ClrCoSet(); i_this->mBodyAtSph.Set(body_at_sph_src); i_this->mBodyAtSph.SetStts(&i_this->mStts); i_this->m476 = actor->current.angle.y; - actor->model = i_this->mpAnim->getModel(); + actor->model = i_this->mpMorf->getModel(); } /* 0000CDF0-0000CFCC .text kantera_useHeapInit__FP10fopAc_ac_c */ static BOOL kantera_useHeapInit(fopAc_ac_c* a_this) { - /* Nonmatching - regalloc */ - J3DAnmTevRegKey* pJVar3; bpw_class* i_this = (bpw_class*)a_this; - i_this->mpAnim = new mDoExt_McaMorf( + i_this->mpMorf = new mDoExt_McaMorf( (J3DModelData*)dComIfG_getObjectRes("BPW", BPW_BDL_BPW_KAN1), NULL, NULL, NULL, J3DFrameCtrl::EMode_RESET, 1.0f, 0, -1, 1, NULL, 0x80000, 0x37441422 ); - if ((i_this->mpAnim == NULL) || (i_this->mpAnim->getModel() == NULL)) { + if ((i_this->mpMorf == NULL) || (i_this->mpMorf->getModel() == NULL)) { return FALSE; } - J3DModel* pJVar1 = i_this->mpAnim->getModel(); - i_this->mpAnim->getModel()->setUserArea((u32)i_this); - for (u16 uVar6 = 0; uVar6 < i_this->mpAnim->getModel()->getModelData()->getJointNum(); uVar6++) { - i_this->mpAnim->getModel()->getModelData()->getJointNodePointer(uVar6)->setCallBack(kantera_nodeCallBack); + i_this->mpMorf->getModel()->setUserArea((u32)i_this); + for (u16 i = 0; i < i_this->mpMorf->getModel()->getModelData()->getJointNum(); i++) { + i_this->mpMorf->getModel()->getModelData()->getJointNodePointer(i)->setCallBack(kantera_nodeCallBack); } - i_this->mKanteraAnim = new mDoExt_brkAnm(); - if (i_this->mKanteraAnim == NULL) { + J3DModel* model = i_this->mpMorf->getModel(); + i_this->mpLanternGlowBrkAnm = new mDoExt_brkAnm(); + if (i_this->mpLanternGlowBrkAnm == NULL) { return FALSE; } - pJVar3 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_BPW_KAN1); - if (!i_this->mKanteraAnim->init(pJVar1->getModelData(), pJVar3, true, J3DFrameCtrl::EMode_LOOP)) { + J3DAnmTevRegKey* pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("BPW", BPW_BRK_BPW_KAN1); + if (!i_this->mpLanternGlowBrkAnm->init(model->getModelData(), pBrk, true, J3DFrameCtrl::EMode_LOOP)) { return FALSE; } return TRUE; @@ -4242,14 +4474,14 @@ void kantera_create_init(bpw_class* i_this) { }; fopAc_ac_c* actor = &i_this->actor; - actor->cullMtx = i_this->mpAnim->getModel()->getBaseTRMtx(); + fopAcM_SetMtx(actor, i_this->mpMorf->getModel()->getBaseTRMtx()); fopAcM_setCullSizeBox(actor, -100.0f, -100.0f, -100.0f, 100.0f, 100.0f, 100.0f); i_this->mAcch.Set(fopAcM_GetPosition_p(actor), fopAcM_GetOldPosition_p(actor), actor, 1, &i_this->mAcchCir, fopAcM_GetSpeed_p(actor)); i_this->mStts.Init(100, 1, actor); i_this->mKanteraCoSph.Set(kantera_co_sph_src); i_this->mKanteraCoSph.SetStts(&i_this->mStts); - i_this->mKanteraCoSph.OffCoSetBit(); - i_this->mBodyAction = bpw_class::Action_MOVE_DOUSA_e; + i_this->mKanteraCoSph.ClrCoSet(); + i_this->mBodyAction = ACTION_MOVE_DOUSA; i_this->mActionState = 0; i_this->m404 = actor->parentActorID; if (i_this->m404 == fpcM_ERROR_PROCESS_ID_e) { @@ -4259,14 +4491,12 @@ void kantera_create_init(bpw_class* i_this) { /* 0000D0B8-0000D1A0 .text fire_useHeapInit__FP10fopAc_ac_c */ static BOOL fire_useHeapInit(fopAc_ac_c* a_this) { - mDoExt_McaMorf* morf; bpw_class* i_this = (bpw_class*)a_this; - morf = new mDoExt_McaMorf( + i_this->mpMorf = new mDoExt_McaMorf( (J3DModelData*)dComIfG_getObjectRes("BPW", BPW_BDL_BPW_KAN1), NULL, NULL, NULL, J3DFrameCtrl::EMode_RESET, 1.0f, 0, -1, 1, NULL, 0x80000, 0x37441422 ); - i_this->mpAnim = morf; - if ((i_this->mpAnim == NULL) || (i_this->mpAnim->getModel() == NULL)) { + if ((i_this->mpMorf == NULL) || (i_this->mpMorf->getModel() == NULL)) { return FALSE; } else { return TRUE; @@ -4305,7 +4535,7 @@ void damage_ball_create_init(bpw_class* i_this) { }; fopAc_ac_c* actor = &i_this->actor; - actor->cullMtx = i_this->mpAnim->getModel()->getBaseTRMtx(); + fopAcM_SetMtx(actor, i_this->mpMorf->getModel()->getBaseTRMtx()); fopAcM_setCullSizeBox(actor, -100.0f, -100.0f, -100.0f, 100.0f, 100.0f, 100.0f); i_this->mAcch.Set(fopAcM_GetPosition_p(actor), fopAcM_GetOldPosition_p(actor), actor, 1, &i_this->mAcchCir, fopAcM_GetSpeed_p(actor)); i_this->mStts.Init(0xfe, 1, actor); @@ -4315,10 +4545,9 @@ void damage_ball_create_init(bpw_class* i_this) { /* 0000D254-0000D368 .text tori_useHeapInit__FP10fopAc_ac_c */ static BOOL tori_useHeapInit(fopAc_ac_c* a_this) { - mDoExt_McaMorf* morf; bpw_class* i_this = (bpw_class*)a_this; - morf = new mDoExt_McaMorf( + i_this->mpMorf = new mDoExt_McaMorf( (J3DModelData*)dComIfG_getObjectRes("BPW", BPW_BDL_BPW), NULL, NULL, @@ -4332,10 +4561,9 @@ static BOOL tori_useHeapInit(fopAc_ac_c* a_this) { 0x80000, 0x37441422 ); - i_this->mpAnim = morf; - if ((i_this->mpAnim == NULL) || (i_this->mpAnim->getModel() == NULL)) { + if ((i_this->mpMorf == NULL) || (i_this->mpMorf->getModel() == NULL)) { return FALSE; - } else if (!i_this->mD78.create(i_this->mpAnim->getModel())) { + } else if (!i_this->mInvisibleModel.create(i_this->mpMorf->getModel())) { return FALSE; } return TRUE; @@ -4347,7 +4575,7 @@ void tori_create_init(bpw_class* i_this) { daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); i_this->mBodyPos = actor->current.pos; fopAcM_OnStatus(actor, fopAcStts_UNK4000_e); - actor->cullMtx = i_this->mpAnim->getModel()->getBaseTRMtx(); + fopAcM_SetMtx(actor, i_this->mpMorf->getModel()->getBaseTRMtx()); fopAcM_setCullSizeBox(actor, -300.0f, -300.0f, -300.0f, 300.0f, 300.0f, 300.0f); actor->attention_info.flags = 0; actor->current.pos = player->getHeadTopPos(); @@ -4356,87 +4584,75 @@ void tori_create_init(bpw_class* i_this) { /* 0000D43C-0000DB08 .text daBPW_Create__FP10fopAc_ac_c */ static cPhs_State daBPW_Create(fopAc_ac_c* a_this) { - /* Nonmatching - regalloc */ - cPhs_State res; - int pwID; - int iVar2; - u32 iVar6; - u32 uVar7; - int iVar8; - f32 dVar9; - cXyz local_70; - bpw_class* i_this = (bpw_class*)a_this; - fopAc_ac_c* actor = a_this; - csXyz sp18 = actor->shape_angle; - fopAcM_ct_Retail(actor, bpw_class); - res = dComIfG_resLoad(&i_this->m2AC, "BPW"); + csXyz sp18 = a_this->shape_angle; + fopAcM_ct_Retail(a_this, bpw_class); + cPhs_State res = dComIfG_resLoad(&i_this->mPhase, "BPW"); if (res == cPhs_COMPLEATE_e) { - fopAcM_ct_Demo(actor, bpw_class); - i_this->mType = (bpw_class::Actor_Type_e)fopAcM_GetParam(actor); - i_this->mUnknownParam2 = (bpw_class::Damage_Action_e)((uint)fopAcM_GetParam(actor) >> 8); - i_this->mLightState = (u8)((uint)fopAcM_GetParam(actor) >> 0x10); + fopAcM_ct_Demo(a_this, bpw_class); + i_this->mType = fopAcM_GetParam(a_this); + i_this->mUnknownParam2 = (fopAcM_GetParam(a_this) >> 8); + i_this->mLightState = (fopAcM_GetParam(a_this) >> 0x10); if (i_this->mType == 0xFF) { - i_this->mType = bpw_class::Actor_Type_BODY_e; + i_this->mType = ACTOR_TYPE_BODY; } if (i_this->mUnknownParam2 == 0xFF) { - i_this->mUnknownParam2 = bpw_class::Damage_Action_LINE_e; + i_this->mUnknownParam2 = DAMAGE_ACTION_LINE; } switch (i_this->mType) { - case bpw_class::Actor_Type_BODY_e: + case ACTOR_TYPE_BODY: if (dComIfGs_isStageBossEnemy()) { return cPhs_ERROR_e; } - if (!fopAcM_entrySolidHeap(actor, boss_useHeapInit, 0x36e0)) { + if (!fopAcM_entrySolidHeap(a_this, boss_useHeapInit, 0x36e0)) { return cPhs_ERROR_e; } body_create_init(i_this); - iVar2 = 0; i_this->m5E0[0].setRateOff(0); i_this->m5E0[1].setRateOff(0); i_this->m5E0[2].setRateOff(0); i_this->m5E0[3].setRateOff(0); i_this->m4A4 = 300.0f; i_this->m4A0 = 0.0f; - i_this->m4A8 = REG8_F(0x10) + 220.0f; + i_this->m4A8 = REG8_F(16) + 220.0f; i_this->m3AC.y = 340.0f; i_this->mAttWaitTimer = 1; - i_this->mChildActorPos = actor->current.pos; + i_this->mChildActorPos = a_this->current.pos; for (s32 i = 0; i < 3; i++) { - i_this->m304[i] = actor->current.pos; - i_this->m328[i] = actor->current.pos; + i_this->m304[i] = a_this->current.pos; + i_this->m328[i] = a_this->current.pos; } i_this->m498 = 350.0f; i_this->m49C = 400.0f; - i_this->mpAnim->play(NULL, 0, 0); + i_this->mpMorf->play(NULL, 0, 0); BG_check(i_this); draw_SUB(i_this); sp18.y += 0x4000; - i_this->m3FC = - fopAcM_createChild(PROC_BPW, fopAcM_GetID(i_this), bpw_class::Actor_Type_KANTERA_e, &i_this->mChildActorPos, fopAcM_GetRoomNo(actor), &sp18); + i_this->m3FC = fopAcM_createChild(PROC_BPW, fopAcM_GetID(i_this), ACTOR_TYPE_KANTERA, &i_this->mChildActorPos, fopAcM_GetRoomNo(a_this), &sp18); i_this->mAttWaitTimer = 1; kantera_calc(i_this); if ((dComIfGp_getStartStageName()[0] != 'X') && (REG0_S(9) != 0 || (!dComIfGs_isStageBossDemo()))) { - fopAcM_OnStatus(actor, fopAcStts_UNK4000_e); - csXyz sp10 = actor->shape_angle; - local_70 = actor->current.pos; - iVar2 = (65536.0f / actor->health); - local_70.y = i_this->mAcch.GetGroundH() + 20.0f; - iVar8 = (int)cM_rndFX(32768.0f); - uVar7 = (s16)cM_rndF(4.99f); - iVar6 = uVar7 << 9 | 0xff000004; - for (s32 i = 0; i < 0xF; i++) { - dVar9 = ((s16)iVar2 * 0.25f); - pwID = fopAcM_createChild(PROC_PW, fopAcM_GetID(i_this), iVar6, &local_70, fopAcM_GetRoomNo(actor), &sp10); - i_this->mChildPoeIds[i] = pwID; - iVar8 += iVar2; - sp10.y = (s16)iVar8; - sp10.y += (int)cM_rndFX(dVar9); - uVar7++; - if (uVar7 > 5) { - uVar7 = 0; + fopAcM_OnStatus(a_this, fopAcStts_UNK4000_e); + u32 uVar14; + cXyz local_58; + csXyz pwAngle = a_this->shape_angle; + local_58 = a_this->current.pos; + int currRandomAngle; + int pwSpreadAmount = (int)(65536.0f / a_this->health); + local_58.y = i_this->mAcch.GetGroundH() + 20.0f; + currRandomAngle = (int)cM_rndFX(32768.0f); + uVar14 = (s16)cM_rndF(4.99f); + u32 uVar2 = uVar14 << 9 | 0xFF000004; + for (s32 i = 0; i < 15; i++) { + i_this->mChildPoeIds[i] = fopAcM_createChild(PROC_PW, fopAcM_GetID(i_this), uVar2, &local_58, fopAcM_GetRoomNo(a_this), &pwAngle); + currRandomAngle += pwSpreadAmount; + pwAngle.y = (s16)currRandomAngle; + pwAngle.y += (int)cM_rndFX((s16)pwSpreadAmount * 0.25f); + uVar14++; + if (uVar14 > 5) { + uVar14 = 0; } - iVar6 = uVar7 << 9 | 0xff000004; + uVar2 = uVar14 << 9 | 0xFF000004; } i_this->m3F6 = 3; light_on_off(i_this); @@ -4444,7 +4660,7 @@ static cPhs_State daBPW_Create(fopAc_ac_c* a_this) { i_this->mSomeCountdownTimers[5] = 0; i_this->m3EC = 1.0f; kankyou_hendou(i_this); - i_this->mBodyAction = bpw_class::Action_START_DEMO_e; + i_this->mBodyAction = ACTION_START_DEMO; i_this->mActionState = 200; } else { if (dComIfGp_getStartStageName()[0] == 'X') { @@ -4455,16 +4671,16 @@ static cPhs_State daBPW_Create(fopAc_ac_c* a_this) { #if VERSION > VERSION_DEMO kankyou_hendou(i_this); #endif - i_this->mBodyAction = bpw_class::Action_MOVE_DOUSA_e; + i_this->mBodyAction = ACTION_MOVE_DOUSA; i_this->mActionState = 0; } break; - case bpw_class::Actor_Type_KANTERA_e: - if (!fopAcM_entrySolidHeap(actor, kantera_useHeapInit, 0x14c0)) { + case ACTOR_TYPE_KANTERA: + if (!fopAcM_entrySolidHeap(a_this, kantera_useHeapInit, 0x14c0)) { return cPhs_ERROR_e; } kantera_create_init(i_this); - fopAcM_OnStatus(actor, fopAcStts_UNK4000_e); + fopAcM_OnStatus(a_this, fopAcStts_UNK4000_e); if ((dComIfGp_getStartStageName()[0] != 'X') && (REG0_S(9) != 0 || (!dComIfGs_isStageBossDemo()))) { i_this->m3E7 = 1; anm_init(i_this, BPW_BCK_OPENING_KAN1, REG18_F(4), J3DFrameCtrl::EMode_NONE, 0.0f, -1); @@ -4474,35 +4690,35 @@ static cPhs_State daBPW_Create(fopAc_ac_c* a_this) { BG_check(i_this); kantera_draw_SUB(i_this); break; - case bpw_class::Actor_Type_DAMAGE_BALL_e: - if (!fopAcM_entrySolidHeap(actor, fire_useHeapInit, 0x14c0)) { + case ACTOR_TYPE_DAMAGE_BALL: + if (!fopAcM_entrySolidHeap(a_this, fire_useHeapInit, 0x14c0)) { return cPhs_ERROR_e; } - i_this->m358 = actor->current.pos; + i_this->m358 = a_this->current.pos; damage_ball_create_init(i_this); switch (i_this->mUnknownParam2) { - case bpw_class::Damage_Action_LINE_e: + case DAMAGE_ACTION_LINE: i_this->mDamageBallCoSph.SetAtSpl(dCcG_At_Spl_UNK9); i_this->mDamageBallCoSph.SetAtAtp(6); - i_this->mBodyAction = bpw_class::Action_MOVE_DOUSA_e; + i_this->mBodyAction = ACTION_MOVE_DOUSA; i_this->mActionState = 10; break; - case bpw_class::Damage_Action_DAMAGE_BALL_e: - dKy_plight_set(&i_this->m4EC); + case DAMAGE_ACTION_DAMAGE_BALL: + dKy_plight_set(&i_this->mLightInfluence); i_this->mDamageBallCoSph.SetAtSpl(dCcG_At_Spl_UNK8); - i_this->mBodyAction = bpw_class::Action_ATTACK_KOUGEKI_e; + i_this->mBodyAction = ACTION_ATTACK_KOUGEKI; i_this->mActionState = 0x14; break; } BG_check(i_this); draw_SUB(i_this); break; - case bpw_class::Actor_Type_TORITUKI_e: - if (!fopAcM_entrySolidHeap(actor, tori_useHeapInit, 0x10000)) { + case ACTOR_TYPE_TORITUKI: + if (!fopAcM_entrySolidHeap(a_this, tori_useHeapInit, 0x10000)) { return cPhs_ERROR_e; } i_this->m3E0 = 1; - actor->scale.setall(0.0f); + a_this->scale.setall(0.0f); tori_create_init(i_this); draw_SUB(i_this); break; diff --git a/src/d/actor/d_a_bst.cpp b/src/d/actor/d_a_bst.cpp index cb867c0c9..dfe73d74a 100644 --- a/src/d/actor/d_a_bst.cpp +++ b/src/d/actor/d_a_bst.cpp @@ -475,7 +475,9 @@ static void down_attack(bst_class* i_this) { particle_pos = actor->current.pos; particle_pos.y = 1.0f; dComIfGp_particle_setProjection(dPa_name::ID_AK_SP_BSTSHOCKWAVEH00, &particle_pos); - dComIfGp_particle_setToon(dPa_name::ID_AK_ST_BSTATTACK1HSMOKE00, &particle_pos, NULL, NULL, 0xB9, &i_this->mPa_smokeEcallBack, fopAcM_GetRoomNo(actor)); + dComIfGp_particle_setToon( + dPa_name::ID_AK_ST_BSTATTACK1HSMOKE00, &particle_pos, NULL, NULL, 0xB9, &i_this->mPa_smokeEcallBack, fopAcM_GetRoomNo(actor) + ); } } else { actor->speed.y += REG0_F(14) + 0.5f; @@ -537,7 +539,7 @@ static void paa_attack(bst_class* i_this) { if (local_38.abs() > REG0_F(0xc) + 200.0f) { cLib_addCalc2(&actor->speedF, 40.0f, 1.0f, REG0_F(0xd) + 2.0f); } else { - cLib_addCalc0(&actor->speedF, 1.0f, (REG0_F(0xd) + 2.0f)); + cLib_addCalc0(&actor->speedF, 1.0f, REG0_F(0xd) + 2.0f); } i_this->m10EC.x = REG0_F(5) + 8000.0f; cMtx_YrotS(*calc_mtx, (int)i_this->m111C); @@ -672,7 +674,7 @@ static void kumi_attack(bst_class* i_this) { if (local_38.abs() > REG0_F(0xc) + 200.0f) { cLib_addCalc2(&actor->speedF, 40.0f, 1.0f, REG0_F(0xd) + 2.0f); } else { - cLib_addCalc0(&actor->speedF, 1.0f, (REG0_F(0xd) + 2.0f)); + cLib_addCalc0(&actor->speedF, 1.0f, REG0_F(0xd) + 2.0f); } i_this->m10EC.x = REG0_F(5) + 8000.0f; cMtx_YrotS(*calc_mtx, (int)i_this->m111C); @@ -742,7 +744,9 @@ static void kumi_attack(bst_class* i_this) { local_50 = i_this->mTargetPos; local_50.y = 1.0f; dComIfGp_particle_setProjection(dPa_name::ID_AK_SP_BSTSHOCKWAVEH00, &local_50); - dComIfGp_particle_setToon(dPa_name::ID_AK_ST_BSTATTACK2HSMOKE00, &local_50, NULL, NULL, 0xb9, &i_this->mPa_smokeEcallBack, fopAcM_GetRoomNo(actor)); + dComIfGp_particle_setToon( + dPa_name::ID_AK_ST_BSTATTACK2HSMOKE00, &local_50, NULL, NULL, 0xb9, &i_this->mPa_smokeEcallBack, fopAcM_GetRoomNo(actor) + ); dComIfGp_getVibration().StartShock(REG0_S(2) + 5, -0x21, cXyz(0.0f, 1.0f, 0.0f)); fopAcM_seStartCurrent(actor, JA_SE_CM_BST_2_HAND_ATTACK, 0); } @@ -852,7 +856,7 @@ static void harai_attack(bst_class* i_this) { break; case 3: cVar3 = 1; - cLib_addCalc0(&actor->speedF, 1.0f, (REG0_F(0xd) + 3.0f)); + cLib_addCalc0(&actor->speedF, 1.0f, REG0_F(0xd) + 3.0f); if (i_this->m10FC[0] == 0) { i_this->mActionType = bst_class::ACTION_FLY_e; i_this->mDamage = 0; @@ -1089,7 +1093,12 @@ static void head_damage(bst_class* i_this) { fopAc_ac_c* actor = &i_this->actor; cXyz v; f32 dist; - static u16 bomb_eff_name[] = {dPa_name::ID_AK_SN_BSTBOMBNOSTRILSMOKEL00, dPa_name::ID_AK_SN_BSTBOMBNOSTRILSMOKER00, dPa_name::ID_AK_SN_BSTBOMBEARSMOKEL00, dPa_name::ID_AK_SN_BSTBOMBEARSMOKER00}; + static u16 bomb_eff_name[] = { + dPa_name::ID_AK_SN_BSTBOMBNOSTRILSMOKEL00, + dPa_name::ID_AK_SN_BSTBOMBNOSTRILSMOKER00, + dPa_name::ID_AK_SN_BSTBOMBEARSMOKEL00, + dPa_name::ID_AK_SN_BSTBOMBEARSMOKER00 + }; i_this->mState = 10; i_this->m2E74[0] = 10; @@ -1126,7 +1135,9 @@ static void head_damage(bst_class* i_this) { if (actor->current.pos.y <= REG0_F(14)) { actor->current.pos.y = REG0_F(14); dComIfGp_getVibration().StartShock(REG0_S(2) + 7, -0x21, cXyz(0.0f, 1.0f, 0.0f)); - dComIfGp_particle_setToon(dPa_name::ID_AK_ST_BSTDROPHEADSMOKE00, &actor->current.pos, NULL, NULL, 0xB9, &i_this->mPa_smokeEcallBack, fopAcM_GetRoomNo(actor)); + dComIfGp_particle_setToon( + dPa_name::ID_AK_ST_BSTDROPHEADSMOKE00, &actor->current.pos, NULL, NULL, 0xB9, &i_this->mPa_smokeEcallBack, fopAcM_GetRoomNo(actor) + ); i_this->m112A = REG0_S(7) + 4; mDoAud_seStart(JA_SE_CM_BST_HEAD_FALL, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); mDoAud_seStart(JA_SE_CM_BST_MOUTH_OPEN, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); @@ -1895,14 +1906,14 @@ static void beam_eff_set(cXyz* pos, short y, u8 set_angle) { /* 00006FA4-00007308 .text beam_wall_check__FP4cXyzP4cXyz */ static BOOL beam_wall_check(cXyz* pos_1, cXyz* pos_2) { - dBgS_LinChk chk; + dBgS_LinChk gndChk; cXyz start = *pos_1 - *pos_2; start.y += 50.0f; cXyz end(*pos_1); end.y = start.y; - chk.Set(&start, &end, NULL); - if (dComIfG_Bgsp()->LineCross(&chk)) { - *pos_1 = chk.mLin.GetEnd(); + gndChk.Set(&start, &end, NULL); + if (dComIfG_Bgsp()->LineCross(&gndChk)) { + *pos_1 = gndChk.mLin.GetEnd(); return TRUE; } return FALSE; @@ -1916,7 +1927,7 @@ static void beam_move(bst_class* i_this) { cXyz* pos2; J3DModel* model; s8 beam_set; - dBgS_GndChk chk; + dBgS_GndChk gndChk; for (s32 i = 0; i < 10; i++) { if (i_this->m04E4[i] == 0) { continue; @@ -1933,8 +1944,8 @@ static void beam_move(bst_class* i_this) { cLib_addCalc2(&i_this->m10A8[i], REG0_F(4) + 5.0f, 1.0f, REG0_F(5) + 0.5f); beam_set = FALSE; f32 fVar1 = 500.0f; - chk.m_pos.set(i_this->m03B8[i].x, i_this->m03B8[i].z + fVar1, i_this->m03B8[i].y); - f32 ground_cross = dComIfG_Bgsp()->GroundCross(&chk); + gndChk.m_pos.set(i_this->m03B8[i].x, i_this->m03B8[i].z + fVar1, i_this->m03B8[i].y); + f32 ground_cross = dComIfG_Bgsp()->GroundCross(&gndChk); if (ground_cross >= i_this->m03B8[i].y) { i_this->m03B8[i].y = ground_cross; beam_eff_set(pos1, 0, 0); @@ -2278,7 +2289,7 @@ void demo_camera(bst_class* i_this) { dComIfGp_event_reset(); i_this->m2E9A = 0; i_this->m2E7C = 10; - g_dComIfG_gameInfo.save.getMemory().getBit().onStageBossDemo(); + dComIfGs_onStageBossDemo(); mDoAud_bgmStart(JA_BGM_BST_BATTLE); i_this->m2FE4 = 1; i_this->m2E98 = 1; @@ -2838,9 +2849,7 @@ static BOOL useHeapInit(fopAc_ac_c* a_this) { if (i_this->m2FD4 == NULL) { return FALSE; } - res = i_this->m2FD4->init( - modelData, (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bst", BST_BTK_HBSITA1), TRUE, J3DFrameCtrl::EMode_LOOP - ); + res = i_this->m2FD4->init(modelData, (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bst", BST_BTK_HBSITA1), TRUE, J3DFrameCtrl::EMode_LOOP); if (res == 0) { return FALSE; } @@ -2897,9 +2906,7 @@ static BOOL useHeapInit(fopAc_ac_c* a_this) { if (i_this->mpBrkAnm == NULL) { return FALSE; } - res = i_this->mpBrkAnm->init( - modelData, (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", set_za_brk_d[i_this->mBstPartType]), TRUE, J3DFrameCtrl::EMode_NONE - ); + res = i_this->mpBrkAnm->init(modelData, (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bst", set_za_brk_d[i_this->mBstPartType]), TRUE, J3DFrameCtrl::EMode_NONE); if (res == 0) { return FALSE; } diff --git a/src/d/actor/d_a_btd.cpp b/src/d/actor/d_a_btd.cpp index 63dcd8840..3eee28d0a 100644 --- a/src/d/actor/d_a_btd.cpp +++ b/src/d/actor/d_a_btd.cpp @@ -86,7 +86,7 @@ daBtd_HIO_c::daBtd_HIO_c() { m3C = 0xb6; m3E = 0x9c; m40 = 0x56; - m42 = 0xff; + m42 = 0xFF; m44 = 0x8e; m46 = 0x24; m48 = 12.0f; @@ -106,22 +106,22 @@ static s8 joint_check[] = {-1, 0x05, -1, -1, 0x11, -1, -1, -1, -1, - -1, -1, 0x64, -1, 0x00, 0x01, 0x65, 0x66, -1, -1, 0x07, 0x08, -1, -1, 0x09, 0x0A}; /* 000001C8-0000024C .text wave_set__FP9btd_class */ -void wave_set(btd_class* i_this) { +static void wave_set(btd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; mDoAud_seStart(JA_SE_CM_BTD_MAGMA_MOVE, &static_center_pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); i_this->m6E7C = 0.0f; } /* 0000024C-00000268 .text get_anm__FP9btd_class */ -mDoExt_McaMorf* get_anm(btd_class* i_this) { +static mDoExt_McaMorf* get_anm(btd_class* i_this) { if (i_this->m02E0 != 0) { - return i_this->m02C8; + return i_this->mpPhase2Morf; } - return i_this->m02BC; + return i_this->mpPhase1Morf; } /* 00000268-00000284 .text get_btk__FP9btd_class */ -mDoExt_btkAnm* get_btk(btd_class* i_this) { +static mDoExt_btkAnm* get_btk(btd_class* i_this) { if (i_this->m02E0 != 0) { return i_this->btkS; } @@ -129,7 +129,7 @@ mDoExt_btkAnm* get_btk(btd_class* i_this) { } /* 00000284-000002A0 .text get_brk__FP9btd_class */ -mDoExt_brkAnm* get_brk(btd_class* i_this) { +static mDoExt_brkAnm* get_brk(btd_class* i_this) { if (i_this->m02E0 != 0) { return i_this->brkS; } @@ -137,18 +137,14 @@ mDoExt_brkAnm* get_brk(btd_class* i_this) { } /* 000002A0-000003D4 .text anm_init__FP9btd_classifUcfi */ -void anm_init(btd_class* i_this, int bckFileIdx, f32 morf, u8 loopMode, f32 speed, int soundFileIdx) { - void* pSoundAnimRes; - J3DAnmTransform* pJVar1; - +static void anm_init(btd_class* i_this, int bckFileIdx, f32 morf, u8 loopMode, f32 speed, int soundFileIdx) { mDoExt_McaMorf* btdAnm = get_anm(i_this); if (soundFileIdx >= 0) { - pSoundAnimRes = dComIfG_getObjectRes("Btd", soundFileIdx); - pJVar1 = (J3DAnmTransform*)dComIfG_getObjectRes("Btd", bckFileIdx); - btdAnm->setAnm(pJVar1, loopMode, morf, speed, 0.0f, -1.0f, pSoundAnimRes); + btdAnm->setAnm( + (J3DAnmTransform*)dComIfG_getObjectRes("Btd", bckFileIdx), loopMode, morf, speed, 0.0f, -1.0f, dComIfG_getObjectRes("Btd", soundFileIdx) + ); } else { - pJVar1 = (J3DAnmTransform*)dComIfG_getObjectRes("Btd", bckFileIdx); - btdAnm->setAnm(pJVar1, loopMode, morf, speed, 0.0f, -1.0f, NULL); + btdAnm->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Btd", bckFileIdx), loopMode, morf, speed, 0.0f, -1.0f, NULL); } } @@ -164,7 +160,7 @@ static BOOL nodeCallBack(J3DNode* node, int calcTiming) { if ((i_this != NULL) && (r28 >= 0)) { cXyz local_38; MTXCopy(model->getAnmMtx(jntNo), *calc_mtx); - if (r28 == 100) { + if (r28 == 0x64) { local_38.x = REG0_F(9); local_38.y = REG0_F(10); local_38.z = REG0_F(11); @@ -177,15 +173,15 @@ static BOOL nodeCallBack(J3DNode* node, int calcTiming) { local_38.x = REG0_F(9); local_38.y = REG0_F(10) + -50.0f; local_38.z = REG0_F(11) + 200.0f; - MtxPosition(&local_38, &i_this->m60B0.mPos); - mDoMtx_YrotM(*calc_mtx, i_this->m5E8E); + MtxPosition(&local_38, &i_this->mLightInfluence.mPos); + cMtx_YrotM(*calc_mtx, i_this->m5E8E); model->setAnmMtx(jntNo, *calc_mtx); MTXCopy(*calc_mtx, J3DSys::mCurrentMtx); } else if ((r28 == 0x65) || (r28 == 0x66)) { if (r28 == 0x65) { - mDoMtx_XrotM(*calc_mtx, i_this->m02FA); + cMtx_XrotM(*calc_mtx, i_this->m02FA); } else { - mDoMtx_XrotM(*calc_mtx, i_this->m02FA * -0.6818f); + cMtx_XrotM(*calc_mtx, i_this->m02FA * -0.6818f); } model->setAnmMtx(jntNo, *calc_mtx); MTXCopy(*calc_mtx, J3DSys::mCurrentMtx); @@ -214,9 +210,9 @@ static BOOL nodeCallBack(J3DNode* node, int calcTiming) { MtxPosition(&local_38, &i_this->m02FC[r28]); } if (r28 == 2) { - mDoMtx_YrotM(*calc_mtx, i_this->m5E88); - mDoMtx_XrotM(*calc_mtx, i_this->m5E8A); - mDoMtx_ZrotM(*calc_mtx, i_this->m5E88); + cMtx_YrotM(*calc_mtx, i_this->m5E88); + cMtx_XrotM(*calc_mtx, i_this->m5E8A); + cMtx_ZrotM(*calc_mtx, i_this->m5E88); model->setAnmMtx(jntNo, *calc_mtx); MTXCopy(*calc_mtx, J3DSys::mCurrentMtx); } @@ -226,13 +222,13 @@ static BOOL nodeCallBack(J3DNode* node, int calcTiming) { } /* 000007B4-00000828 .text hahen_draw__FP9btd_class */ -void hahen_draw(btd_class* i_this) { +static void hahen_draw(btd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - btd_hahen_s* pbVar2 = &i_this->hahen[0]; - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->hahen); i++, pbVar2++) { - if (pbVar2->m04 != 0) { - g_env_light.setLightTevColorType(pbVar2->model, &actor->tevStr); - mDoExt_modelUpdate(pbVar2->model); + btd_hahen_s* hahen = &i_this->hahen[0]; + for (s32 i = 0; i < ARRAY_SSIZE(i_this->hahen); i++, hahen++) { + if (hahen->m04 != 0) { + g_env_light.setLightTevColorType(hahen->model, &actor->tevStr); + mDoExt_modelUpdate(hahen->model); } } } @@ -243,6 +239,9 @@ static BOOL daBtd_Draw(btd_class* i_this) { fopAc_ac_c* actor2 = &i_this->actor; J3DModel* model; +#if VERSION == VERSION_DEMO + dSnap_RegistFig(DSNAP_TYPE_BTD, actor2, 1.0f, 1.0f, 1.0f); +#else if (i_this->m6E15 > 1) { mDoGph_gInf_c::setBlureRate(i_this->m6E15); mDoGph_gInf_c::onBlure(); @@ -251,13 +250,14 @@ static BOOL daBtd_Draw(btd_class* i_this) { mDoGph_gInf_c::offBlure(); } dSnap_RegistFig(DSNAP_TYPE_BTD, actor2, actor2->eyePos, actor2->current.angle.y, 1.0f, 1.0f, 1.0f); +#endif if (i_this->m6E4C != 0) { g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &i_this->m6E50, &actor->tevStr); - model = i_this->m02D4->getModel(); + model = i_this->mpDeadHeadMorf->getModel(); g_env_light.setLightTevColorType(model, &actor->tevStr); - i_this->m02D8->entry(model->getModelData()); - i_this->m02DC->entry(model->getModelData()); - i_this->m02D4->entryDL(); + i_this->mpDeadHeadBtkAnm->entry(model->getModelData()); + i_this->mpDeadHeadBrkAnm->entry(model->getModelData()); + i_this->mpDeadHeadMorf->entryDL(); } else { mDoExt_McaMorf* morf = get_anm(i_this); mDoExt_btkAnm* btk = get_btk(i_this); @@ -274,22 +274,19 @@ static BOOL daBtd_Draw(btd_class* i_this) { } /* 000009B4-00000A08 .text player_view_check__FP9btd_class */ -u16 player_view_check(btd_class* i_this) { +static u16 player_view_check(btd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - s16 uVar1; - s16 sVar2; - sVar2 = fopAcM_searchActorAngleY(actor, dComIfGp_getPlayer(0)); - sVar2 = actor->current.angle.y - sVar2; - uVar1 = sVar2; - if (uVar1 < 0) { - uVar1 = -sVar2; + s16 angleToPlayer = fopAcM_searchPlayerAngleY(actor); + s16 angleDiff = actor->current.angle.y - angleToPlayer; + if (angleDiff < 0) { + angleDiff = -angleDiff; } - return uVar1; + return angleDiff; } /* 00000A08-00000A38 .text eff_off__FP9btd_class */ -void eff_off(btd_class* i_this) { +static void eff_off(btd_class* i_this) { for (int i = 0; i < 7; i++) { if (i_this->m6028[i] > 2) { i_this->m6028[i] = 2; @@ -298,7 +295,7 @@ void eff_off(btd_class* i_this) { } /* 00000A38-00000C14 .text hahen_set2__FP9btd_class */ -void hahen_set2(btd_class* i_this) { +static void hahen_set2(btd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; cXyz local_1c; @@ -318,15 +315,14 @@ void hahen_set2(btd_class* i_this) { } /* 00000C14-00000D84 .text hahen_set_s__FP9btd_classP4cXyzP5csXyz */ -void hahen_set_s(btd_class* i_this, cXyz* param_2, csXyz* param_3) { +static void hahen_set_s(btd_class* i_this, cXyz* param_2, csXyz* param_3) { fopAc_ac_c* actor = &i_this->actor; J3DModelData* modelData = static_cast(dComIfG_getObjectRes("Always", ALWAYS_BDL_MPI_KOISHI)); J3DAnmTexPattern* anmTexPattern = static_cast(dComIfG_getObjectRes("Always", ALWAYS_BTP_MPI_KOISHI)); - JPABaseEmitter* emitter = (JPABaseEmitter*)dComIfGp_particle_set(dPa_name::ID_AK_SN_M_BTDMODELROCK00, param_2, param_3); + JPABaseEmitter* emitter = dComIfGp_particle_set(dPa_name::ID_AK_SN_M_BTDMODELROCK00, param_2, param_3); if (emitter != NULL) { - emitter->mGlobalParticleScale.x = 4.0f; - emitter->mGlobalParticleScale.y = 4.0f; - emitter->mGlobalParticleScale.z = 4.0f; + JGeometry::TVec3 scale(4.0f, 4.0f, 4.0f); + emitter->setGlobalParticleScale(scale); dPa_J3DmodelEmitter_c* modelEmitter = new dPa_J3DmodelEmitter_c(emitter, modelData, actor->tevStr, anmTexPattern, 1, 0); if (modelEmitter != NULL) { dComIfGp_particle_addModelEmitter(modelEmitter); @@ -336,14 +332,14 @@ void hahen_set_s(btd_class* i_this, cXyz* param_2, csXyz* param_3) { } /* 00000D84-00000E44 .text smoke_set_s__FP9btd_classP4cXyzP5csXyz */ -void smoke_set_s(btd_class* i_this, cXyz* param_2, csXyz* param_3) { +static void smoke_set_s(btd_class* i_this, cXyz* param_2, csXyz* param_3) { fopAc_ac_c* actor = &i_this->actor; dComIfGp_particle_setToon(dPa_name::ID_AK_ST_BTDSMOKE00, param_2, param_3, NULL, 0xB9, &i_this->mPa_SmokeEcallBack[0], fopAcM_GetRoomNo(actor)); dComIfGp_particle_setToon(dPa_name::ID_AK_ST_BTDSMOKE01, param_2, param_3, NULL, 0xB9, &i_this->mPa_SmokeEcallBack[1], fopAcM_GetRoomNo(actor)); } /* 00000E44-00000F14 .text hahen_set__FP9btd_classSc */ -void hahen_set(btd_class* i_this, s8 param_2) { +static void hahen_set(btd_class* i_this, s8 param_2) { fopAc_ac_c* actor = &i_this->actor; int iVar1; @@ -362,7 +358,7 @@ void hahen_set(btd_class* i_this, s8 param_2) { } /* 00000F14-00001398 .text startdemo__FP9btd_class */ -void startdemo(btd_class* i_this) { +static void startdemo(btd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; cXyz local_30; cXyz local_3c; @@ -416,14 +412,14 @@ void startdemo(btd_class* i_this) { if ((i_this->m6E1A >= 0x46) && (i_this->m6E1A <= 0xC3)) { i_this->m602E = 3; if (i_this->m6E1A >= 0x5A) { - mDoAud_seStart(JA_SE_CM_BTD_HIFUKI, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + fopAcM_seStart(actor, JA_SE_CM_BTD_HIFUKI, 0); i_this->mKankyoState = 2; } } if (i_this->m6E1A >= 0x46) { i_this->m602C = 3; } - if ((i_this->m02BC->isStop()) && (REG0_F(7) == 0.0f)) { + if ((i_this->mpPhase1Morf->isStop()) && (REG0_F(7) == 0.0f)) { i_this->m6E16 = 0x96; i_this->m02E4 = 0; i_this->mGohmaState = 0; @@ -433,22 +429,19 @@ void startdemo(btd_class* i_this) { } else { mDoAud_bgmStart(JA_BGM_GOMA); } - g_dComIfG_gameInfo.save.getMemory().getBit().onStageBossDemo(); + dComIfGs_onStageBossDemo(); } break; } } /* 00001398-00001898 .text damage_check__FP9btd_class */ -void damage_check(btd_class* i_this) { +static void damage_check(btd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - cCcD_Obj* pcVar2; - s16 sVar4; - u32 uVar7; - dCcD_GObjInf* pdVar9; - csXyz local_48; - cXyz local_40; - CcAtInfo local_34; + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + csXyz angle; + cXyz pos; + CcAtInfo atInfo; if ((i_this->m02F6 != 0) && (i_this->m02F6 == 1)) { i_this->m02F6 = 2; @@ -458,31 +451,30 @@ void damage_check(btd_class* i_this) { eff_off(i_this); return; } - if ((i_this->m1A6C.ChkTgHit()) && (i_this->m02E0 == 0 && (i_this->mActionState == 0))) { + if ((i_this->mEyeSph.ChkTgHit()) && (i_this->m02E0 == 0 && (i_this->mActionState == 0))) { i_this->mActionState = 10; - pcVar2 = i_this->m1A6C.GetTgHitObj(); - def_se_set(actor, pcVar2, 0x40); + def_se_set(actor, i_this->mEyeSph.GetTgHitObj(), 0x40); } - if (((i_this->m1A6C.ChkTgHit()) && (i_this->m02E0 == 1)) && (i_this->m1A6C.OnTgNoConHit(), i_this->mActionState == 0)) { + if (((i_this->mEyeSph.ChkTgHit()) && (i_this->m02E0 == 1)) && (i_this->mEyeSph.OnTgNoConHit(), i_this->mActionState == 0)) { i_this->mActionState = 7; - local_34.mpObj = i_this->m1A6C.GetTgHitObj(); - local_34.pParticlePos = i_this->m1A6C.GetTgHitPosP(); - at_power_check(&local_34); - i_this->mTotalDamage = i_this->mTotalDamage + local_34.mDamage; - actor->health -= local_34.mDamage; + atInfo.mpObj = i_this->mEyeSph.GetTgHitObj(); + atInfo.pParticlePos = i_this->mEyeSph.GetTgHitPosP(); + at_power_check(&atInfo); + i_this->mTotalDamage = i_this->mTotalDamage + atInfo.mDamage; + actor->health -= atInfo.mDamage; if ((actor->health <= 0) || (l_HIO.m06 != 0)) { - dScnPly_ply_c::nextPauseTimer = REG0_S(7) + 8; + dScnPly_ply_c::setPauseTimer(REG0_S(7) + 8); dComIfGp_particle_set(dPa_name::ID_AK_JN_CRITICALHITFLASH, &i_this->m03E0); - local_40.z = 2.0f; - local_40.y = 2.0f; - local_40.x = 2.0f; - local_48.z = 0; - local_48.x = 0; - local_48.y = fopAcM_searchActorAngleY(actor, daPy_getPlayerActorClass()); - dComIfGp_particle_set(dPa_name::ID_AK_JN_OK, &i_this->m03E0, &local_48, &local_40); + pos.z = 2.0f; + pos.y = 2.0f; + pos.x = 2.0f; + angle.z = 0; + angle.x = 0; + angle.y = fopAcM_searchPlayerAngleY(actor); + dComIfGp_particle_set(dPa_name::ID_AK_JN_OK, &i_this->m03E0, &angle, &pos); i_this->m02E4 = 0xb; i_this->mGohmaState = 0x32; - mDoAud_seStart(JA_SE_LK_LAST_HIT, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + fopAcM_seStart(actor, JA_SE_LK_LAST_HIT, 0); return; } if (i_this->m02E4 == 2) { @@ -490,19 +482,19 @@ void damage_check(btd_class* i_this) { i_this->mGohmaState = 10; i_this->mTotalDamage = 0; } else { - uVar7 = BTD_BCK_HIT_M; - if (local_34.mResultingAttackType == 1) { - sVar4 = fopAcM_searchActorAngleY(actor, daPy_getPlayerActorClass()); - sVar4 = sVar4 - actor->current.angle.y; - if ((sVar4 > -0x100) && (sVar4 < 0x100)) { - uVar7 = BTD_BCK_HIT_M; - } else if (sVar4 > 0) { - uVar7 = BTD_BCK_HIT_R; + u32 anm = BTD_BCK_HIT_M; + if (atInfo.mResultingAttackType == 1) { + s16 angle = fopAcM_searchPlayerAngleY(actor); + angle = angle - actor->current.angle.y; + if ((angle > -0x100) && (angle < 0x100)) { + anm = BTD_BCK_HIT_M; + } else if (angle > 0) { + anm = BTD_BCK_HIT_R; } else { - uVar7 = BTD_BCK_HIT_L; + anm = BTD_BCK_HIT_L; } } - anm_init(i_this, uVar7, 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + anm_init(i_this, anm, 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->mGohmaState = 3; } } else { @@ -512,27 +504,25 @@ void damage_check(btd_class* i_this) { fopAcM_monsSeStart(actor, JA_SE_CV_BTD_DAMAGE, 0); eff_off(i_this); } - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m0428); i++) { + for (s32 i = 0; i < ARRAY_SSIZE(i_this->mAtSphs); i++) { if (i_this->m5FC4[i] == 0) { - pdVar9 = &i_this->m0428[i]; - if (pdVar9->ChkTgHit()) { - i_this->m0428[i].OnTgNoConHit(); + if (i_this->mAtSphs[i].ChkTgHit()) { + i_this->mAtSphs[i].OnTgNoConHit(); i_this->m5FC4[i] = 10; i_this->m5E98[i] = i_this->m02FC[i]; - pcVar2 = pdVar9->GetTgHitObj(); - def_se_set_p(actor, &i_this->m5E98[i], pcVar2, 0x42); + def_se_set_p(actor, &i_this->m5E98[i], i_this->mAtSphs[i].GetTgHitObj(), 0x42); break; } } else { i_this->m5FC4[i]--; } } - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m575C); i++) { + for (s32 i = 0; i < ARRAY_SSIZE(i_this->mHandCyls); i++) { if (i_this->m5FEA[i] == 0) { - if (i_this->m575C[i].ChkTgHit()) { - i_this->m575C[i].OnTgNoConHit(); + if (i_this->mHandCyls[i].ChkTgHit()) { + i_this->mHandCyls[i].OnTgNoConHit(); i_this->m5FEA[i] = 10; - def_se_set_p(actor, &i_this->m5E98[i + 0x13], i_this->m575C[i].GetTgHitObj(), 0x42); + def_se_set_p(actor, &i_this->m5E98[i + 19], i_this->mHandCyls[i].GetTgHitObj(), 0x42); return; } } else { @@ -542,42 +532,46 @@ void damage_check(btd_class* i_this) { } /* 00001898-000019D8 .text sibuki_set__FP9btd_class */ -void sibuki_set(btd_class* i_this) { +static void sibuki_set(btd_class* i_this) { cXyz local_38; - btd_sibuki_s* pbVar2 = &i_this->mBtdSibukiS[0]; + btd_sibuki_s* sibuki = &i_this->mBtdSibukiS[0]; i_this->m6E14 = 0; local_38.x = 0.0f; - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->mBtdSibukiS); i++, pbVar2++) { - if (pbVar2->m00 == 0) { - pbVar2->m00 = 1; - mDoMtx_YrotS(*calc_mtx, cM_rndFX(32768.0f)); + for (s32 i = 0; i < ARRAY_SSIZE(i_this->mBtdSibukiS); i++, sibuki++) { + if (sibuki->m00 == 0) { + sibuki->m00 = 1; + cMtx_YrotS(*calc_mtx, cM_rndFX(32768.0f)); local_38.z = REG0_F(13) + (cM_rndFX(200.0f) + 300.0f); local_38.y = cM_rndF(50.0f); - MtxPosition(&local_38, &pbVar2->m04); + MtxPosition(&local_38, &sibuki->m04); local_38.z = l_HIO.m48 + cM_rndF(l_HIO.m48 * 0.5f); local_38.y = l_HIO.m4C + cM_rndF(l_HIO.m4C * 0.5f); - MtxPosition(&local_38, &pbVar2->m10); - mDoMtx_YrotS(*calc_mtx, cM_rndFX(32768.0f)); + MtxPosition(&local_38, &sibuki->m10); + cMtx_YrotS(*calc_mtx, cM_rndFX(32768.0f)); } } } /* 000019D8-00001A84 .text kubi_calc__FP9btd_class */ -void kubi_calc(btd_class* i_this) { +static void kubi_calc(btd_class* i_this) { MtxTrans(i_this->m6E50.x, i_this->m6E50.y, i_this->m6E50.z, false); - mDoMtx_YrotM(*calc_mtx, i_this->m6E74.y); - mDoMtx_XrotM(*calc_mtx, i_this->m6E74.x); - mDoMtx_ZrotM(*calc_mtx, i_this->m6E74.z); - J3DModel* model = i_this->m02D4->getModel(); - model->setBaseTRMtx(*calc_mtx); - i_this->m02D4->calc(); - i_this->m02D8->play(); - i_this->m02DC->play(); + cMtx_YrotM(*calc_mtx, i_this->m6E74.y); + cMtx_XrotM(*calc_mtx, i_this->m6E74.x); + cMtx_ZrotM(*calc_mtx, i_this->m6E74.z); + i_this->mpDeadHeadMorf->getModel()->setBaseTRMtx(*calc_mtx); + i_this->mpDeadHeadMorf->calc(); + i_this->mpDeadHeadBtkAnm->play(); + i_this->mpDeadHeadBrkAnm->play(); } /* 00001A84-000028C4 .text damage__FP9btd_class */ -s32 damage(btd_class* i_this) { +#if VERSION == VERSION_DEMO +static void damage(btd_class* i_this) +#else +static s32 damage(btd_class* i_this) +#endif +{ static s32 hibi_brk[] = {BTD_BRK_HIBI01, BTD_BRK_HIBI02, BTD_BRK_HIBI03}; static u16 hibi_eff_name[] = {dPa_name::ID_AK_SN_BTDCRACKSHELL00, dPa_name::ID_AK_SN_BTDCRACKSHELL01, dPa_name::ID_AK_SN_BTDCRACKSHELL02}; static u16 hahen_eff_name[] = { @@ -596,29 +590,35 @@ s32 damage(btd_class* i_this) { }; static s32 hahen_eff_index[] = {0x2E, 0x21, 0x24, 0x42, 0x31, 0x27, 0x2A, 0x46, 0x37, 0x20, 0x2D, 0x34}; fopAc_ac_c* actor = &i_this->actor; - int state; - mDoExt_McaMorf* iVar2; - J3DAnmTevRegKey* pJVar2; - int iVar3; - JPABaseEmitter* pJVar4; - J3DModel* pJVar8; cXyz local_58; - iVar2 = get_anm(i_this); - state = 1; + mDoExt_McaMorf* morf = get_anm(i_this); +#if VERSION == VERSION_DEMO + fopAcM_OffStatus(actor, 0); + actor->attention_info.flags = 0; i_this->m02F0 = 5; if (i_this->mGohmaState >= 10) { i_this->mActionState = 10; } - if (i_this->mGohmaState <= 0xb) { + if (i_this->mGohmaState <= 11) { + actor->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e; + } +#else + int state = 1; + i_this->m02F0 = 5; + if (i_this->mGohmaState >= 10) { + i_this->mActionState = 10; + } + if (i_this->mGohmaState <= 11) { state = 0; } +#endif switch (i_this->mGohmaState) { case 0: anm_init(i_this, BTD_BCK_DAMAGE1, 5.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->mGohmaState++; case 1: - if (iVar2->isStop()) { + if (morf->isStop()) { anm_init(i_this, BTD_BCK_DAMAGE2, 1.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->mStunTimer = l_HIO.m0C; i_this->mGohmaState++; @@ -632,7 +632,7 @@ s32 damage(btd_class* i_this) { } break; case 3: - if (iVar2->isStop()) { + if (morf->isStop()) { anm_init(i_this, BTD_BCK_DAMAGE2, 1.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->mGohmaState = 2; } @@ -642,7 +642,7 @@ s32 damage(btd_class* i_this) { i_this->mGohmaState++; fopAcM_monsSeStart(actor, JA_SE_CV_BTD_AFT_DAMAGE, 0); case 0xb: - if (iVar2->isStop()) { + if (morf->isStop()) { i_this->m02E4 = 0; i_this->mGohmaState = 0; i_this->m02EC[0] = cM_rndF(50.0f) + 50.0f; @@ -654,22 +654,31 @@ s32 damage(btd_class* i_this) { i_this->m6E7C = 0.0f; break; case 0x15: - if (iVar2->isStop()) { + if (morf->isStop()) { anm_init(i_this, BTD_BCK_SIZUMU2, 1.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->m02EC[0] = (REG0_S(7) + 0x14) * 5; i_this->mGohmaState++; case 0x16: if (i_this->m02EC[0] == REG0_S(5) + 0x28) { - pJVar8 = iVar2->getModel(); - pJVar2 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Btd", hibi_brk[i_this->m6190]); - i_this->brk->init(pJVar8->getModelData(), pJVar2, true, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, 0); + J3DModel* model = morf->getModel(); + i_this->brk->init( + model->getModelData(), + (J3DAnmTevRegKey*)dComIfG_getObjectRes("Btd", hibi_brk[i_this->m6190]), + true, + J3DFrameCtrl::EMode_LOOP, + 1.0f, + 0, + -1, + true, + 0 + ); i_this->m6190++; - mDoAud_seStart(JA_SE_CM_BTD_BRK_SHIELD_S, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + fopAcM_seStart(actor, JA_SE_CM_BTD_BRK_SHIELD_S, 0); for (int i = 0, j = 0; i < 3; i++, j++) { - pJVar4 = dComIfGp_particle_set(hibi_eff_name[j], &actor->current.pos); - if (pJVar4 != NULL) { - pJVar4->setGlobalRTMatrix(iVar2->getModel()->getAnmMtx(0x37)); + JPABaseEmitter* emitter = dComIfGp_particle_set(hibi_eff_name[j], &actor->current.pos); + if (emitter != NULL) { + emitter->setGlobalRTMatrix(morf->getModel()->getAnmMtx(0x37)); } } if (l_HIO.m06 != 0) { @@ -697,7 +706,7 @@ s32 damage(btd_class* i_this) { if ((i_this->m02EC[0] == 1) || (i_this->m02EC[0] == 0x46)) { i_this->m6E7C = 0.0f; } - if (iVar2->isStop()) { + if (morf->isStop()) { i_this->mGohmaState = 0x1e; i_this->m02EC[0] = 0; } @@ -722,7 +731,7 @@ s32 damage(btd_class* i_this) { if (i_this->m02EC[0] == 1) { i_this->m6E7C = 0.0f; } - if (iVar2->isStop()) { + if (morf->isStop()) { anm_init(i_this, BTD_BCK_MOTIAGE2, 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->mGohmaState++; mDoAud_seStart(JA_SE_CM_BTD_LIFT_UP, &static_center_pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); @@ -731,10 +740,10 @@ s32 damage(btd_class* i_this) { break; case 0x20: i_this->m6E88 = 0; - if (iVar2->isStop()) { + if (morf->isStop()) { anm_init(i_this, BTD_BCK_MOTIAGE3, 3.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); - dr2_class* dr2Var = (dr2_class*)dr2; - mDoAud_seStart(JA_SE_CM_BTD_JUMP_DOWN, &dr2Var->unk_4A8, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + dr2_class* tmp = (dr2_class*)dr2; + mDoAud_seStart(JA_SE_CM_BTD_JUMP_DOWN, &tmp->unk_4A8, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); dComIfGp_particle_set(dPa_name::ID_AK_SN_BTDSPLASHMAGMA00, &actor->current.pos, &actor->current.angle); i_this->mGohmaState++; i_this->m02EC[0] = 0x1e; @@ -746,7 +755,7 @@ s32 damage(btd_class* i_this) { i_this->m6E7C = 0.0f; sibuki_set(i_this); } - if (iVar2->isStop()) { + if (morf->isStop()) { i_this->m02E4 = 0; i_this->mGohmaState = 0; i_this->m02EC[0] = cM_rndF(50.0f) + 50.0f; @@ -755,56 +764,58 @@ s32 damage(btd_class* i_this) { case 0x28: anm_init(i_this, BTD_BCK_WARERU1, 3.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->mGohmaState++; - mDoAud_seStart(JA_SE_CM_BTD_FALL_FWD, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + fopAcM_seStart(actor, JA_SE_CM_BTD_FALL_FWD, 0); mDoAud_bgmStop(30); i_this->m02EC[0] = 0x96; i_this->m6E7C = 0.0f; case 0x29: if (i_this->m02EC[0] == (s16)(REG0_S(5) + 0x26)) { - dr2->unk_4BA = 10; + dr2_class* tmp = dr2; + tmp->unk_4BA = 10; if (dComIfGp_getStartStageName()[0] == 'X') { mDoAud_bgmStart(JA_BGM_PAST_GOMA_2); } else { mDoAud_bgmStart(JA_BGM_GOMA_2); }; - btd_hahen_s* pbVar10 = &i_this->hahen[0]; - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->hahen); i++, pbVar10++) { - if (pbVar10->m04 == 0) { + btd_hahen_s* hahen = &i_this->hahen[0]; + for (s32 i = 0; i < ARRAY_SSIZE(i_this->hahen); i++, hahen++) { + if (hahen->m04 == 0) { + int iVar3; if (i < 5) { iVar3 = 2; } else { iVar3 = cM_rndF(18.999f); } - pbVar10->m04 = 1; - pbVar10->m08.x = i_this->m02FC[iVar3].x; - pbVar10->m08.y = i_this->m02FC[iVar3].y; - pbVar10->m08.z = i_this->m02FC[iVar3].z; - pbVar10->m08.x = pbVar10->m08.x + cM_rndFX(REG0_F(2) + 50.0f); - pbVar10->m08.y = pbVar10->m08.y + cM_rndFX(REG0_F(2) + 50.0f); - pbVar10->m08.z = pbVar10->m08.z + cM_rndFX(REG0_F(2) + 50.0f); - s16 r0 = cM_atan2s(pbVar10->m08.x, pbVar10->m08.z); - mDoMtx_YrotS(*calc_mtx, (r0 + (s16)cM_rndFX(2000.0f))); + hahen->m04 = 1; + hahen->m08.x = i_this->m02FC[iVar3].x; + hahen->m08.y = i_this->m02FC[iVar3].y; + hahen->m08.z = i_this->m02FC[iVar3].z; + hahen->m08.x = hahen->m08.x + cM_rndFX(REG0_F(2) + 50.0f); + hahen->m08.y = hahen->m08.y + cM_rndFX(REG0_F(2) + 50.0f); + hahen->m08.z = hahen->m08.z + cM_rndFX(REG0_F(2) + 50.0f); + s16 r0 = cM_atan2s(hahen->m08.x, hahen->m08.z); + cMtx_YrotS(*calc_mtx, r0 + (s16)cM_rndFX(2000.0f)); local_58.x = 0.0f; local_58.y = REG0_F(1) + (cM_rndF(5.0f) + 20.0f); local_58.z = REG0_F(0) + (cM_rndF(5.0f) + 20.0f); - MtxPosition(&local_58, &pbVar10->m14); - pbVar10->m22 = cM_rndF(65536.0f); - pbVar10->m20 = cM_rndF(65536.0f); + MtxPosition(&local_58, &hahen->m14); + hahen->m22 = cM_rndF(65536.0f); + hahen->m20 = cM_rndF(65536.0f); } } - for (s32 i = 0, j = 0, k = 0; i < (s32)ARRAY_SIZE(hahen_eff_name); i++, j++, k++) { - pJVar4 = dComIfGp_particle_set(hahen_eff_name[k], &actor->current.pos); - if (pJVar4 != NULL) { - pJVar4->setGlobalRTMatrix(iVar2->getModel()->getAnmMtx(hahen_eff_index[j])); + for (s32 i = 0, j = 0, k = 0; i < ARRAY_SSIZE(hahen_eff_name); i++, j++, k++) { + JPABaseEmitter* emitter = dComIfGp_particle_set(hahen_eff_name[k], &actor->current.pos); + if (emitter != NULL) { + emitter->setGlobalRTMatrix(morf->getModel()->getAnmMtx(hahen_eff_index[j])); } } } if (i_this->m02EC[0] == 0x65) { - mDoAud_seStart(JA_SE_CM_BTD_GET_UP, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + fopAcM_seStart(actor, JA_SE_CM_BTD_GET_UP, 0); fopAcM_monsSeStart(actor, JA_SE_CV_BTD_ENTER, 0); } - if (iVar2->isStop()) { - mDoAud_seStart(JA_SE_CM_BTD_BRK_SHIELD_L, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + if (morf->isStop()) { + fopAcM_seStart(actor, JA_SE_CM_BTD_BRK_SHIELD_L, 0); fopAcM_monsSeStart(actor, JA_SE_CV_BTD_AFT_DAMAGE, 0); i_this->m02E0 = 1; anm_init(i_this, BTD_BCK_WARERU2, 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); @@ -812,18 +823,22 @@ s32 damage(btd_class* i_this) { } break; case 0x2a: - if (iVar2->isStop()) { + if (morf->isStop()) { i_this->m02E4 = 0; i_this->mGohmaState = 0; i_this->m02EC[0] = cM_rndF(50.0f) + 50.0f; } } } +#if VERSION == VERSION_DEMO + return; +#else return state; +#endif } /* 000028C4-000036A0 .text end__FP9btd_class */ -void end(btd_class* i_this) { +static void end(btd_class* i_this) { static u16 last_eff_name[] = { dPa_name::ID_AK_SN_BTDBREAKDOWNBODY00, dPa_name::ID_AK_SN_BTDBREAKDOWNBODY01, @@ -847,14 +862,11 @@ void end(btd_class* i_this) { }; static s32 last_eff_index[] = {0x20, 0x2D, 0x34, 0x42, 0x43, 0x2E, 0x2F, 0x21, 0x22, 0x24, 0x25, 0x46, 0x47, 0x31, 0x32, 0x27, 0x28, 0x2A, 0x2B}; fopAc_ac_c* actor = &i_this->actor; - mDoExt_McaMorf* iVar2; - J3DMaterialTable* pJVar2; - JPABaseEmitter* pJVar6; - J3DModel* pJVar10; + J3DModel* model; f32 fVar13; cXyz local_2c; - iVar2 = get_anm(i_this); + mDoExt_McaMorf* morf = get_anm(i_this); i_this->mActionState = 10; switch (i_this->mGohmaState) { case 0x32: @@ -873,14 +885,14 @@ void end(btd_class* i_this) { i_this->m02EC[0] = REG0_S(3) + 0x21c; mDoAud_bgmStop(20); mDoAud_bgmStreamPrepare(JA_STRM_BOSS_CLEAR); - pJVar10 = iVar2->getModel(); - pJVar2 = (J3DMaterialTable*)dComIfG_getObjectRes("Btd", BTD_BMT_DEADA); - pJVar10->getModelData()->setMaterialTable(pJVar2, J3DMatCopyFlag_Material); + model = morf->getModel(); + J3DMaterialTable* bmt = (J3DMaterialTable*)dComIfG_getObjectRes("Btd", BTD_BMT_DEADA); + model->getModelData()->setMaterialTable(bmt, J3DMatCopyFlag_Material); i_this->brkS->init( - pJVar10->getModelData(), (J3DAnmTevRegKey*)dComIfG_getObjectRes("Btd", BTD_BRK_DEADA), true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, 0 + model->getModelData(), (J3DAnmTevRegKey*)dComIfG_getObjectRes("Btd", BTD_BRK_DEADA), true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, 0 ); i_this->btkS->init( - pJVar10->getModelData(), (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Btd", BTD_BTK_DEADA), true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, 0 + model->getModelData(), (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Btd", BTD_BTK_DEADA), true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, 0 ); wave_set(i_this); } @@ -894,7 +906,7 @@ void end(btd_class* i_this) { wave_set(i_this); } if (i_this->m6E1A == 0x78) { - mDoAud_seStart(JA_SE_CM_BTD_BECOME_BLACK, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + fopAcM_seStart(actor, JA_SE_CM_BTD_BECOME_BLACK, 0); wave_set(i_this); } if (i_this->m6E1A == 0xa0) { @@ -921,22 +933,28 @@ void end(btd_class* i_this) { actor->speedF = 30.0f; i_this->m02EC[0] = 0x46; mDoAud_seStart(JA_SE_CM_BTD_LAST_EXPLODE, &static_center_pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); - pJVar6 = dComIfGp_particle_set(dPa_name::ID_AK_SN_BTDBREAKDOWNHEAD00, &i_this->m6E50); - i_this->m6038 = pJVar6; + i_this->m6038 = dComIfGp_particle_set(dPa_name::ID_AK_SN_BTDBREAKDOWNHEAD00, &i_this->m6E50); i_this->m6E48 = 30.0f; dComIfGp_getVibration().StartShock(REG0_S(2) + 5, -0x21, cXyz(0.0f, 1.0f, 0.0f)); +#if VERSION == VERSION_DEMO + mDoGph_gInf_c::setBlureRate(REG0_S(4) + 180); + // Required to match + mDoGph_gInf_c::mBlureFlag = true; + mDoMtx_copy(cMtx_getIdentity(), mDoGph_gInf_c::mBlureMtx); +#else i_this->m6E15 = 0xb4; +#endif } else { if (i_this->m02EC[0] == 0x1cc) { i_this->m02E0 = 2; } if (i_this->m02EC[0] == 0xf1) { - pJVar10 = iVar2->getModel(); + model = morf->getModel(); i_this->brkS->init( - pJVar10->getModelData(), (J3DAnmTevRegKey*)dComIfG_getObjectRes("Btd", BTD_BRK_DEADB), true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, 0 + model->getModelData(), (J3DAnmTevRegKey*)dComIfG_getObjectRes("Btd", BTD_BRK_DEADB), true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, 0 ); i_this->btkS->init( - pJVar10->getModelData(), + model->getModelData(), (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Btd", BTD_BTK_DEADB), true, J3DFrameCtrl::EMode_NONE, @@ -948,10 +966,10 @@ void end(btd_class* i_this) { ); } if (i_this->m02EC[0] == 0xbf) { - for (s32 i = 0; i < (s32)ARRAY_SIZE(last_eff_index); i++) { - pJVar6 = dComIfGp_particle_set(last_eff_name[i], &actor->current.pos); - if (pJVar6 != NULL) { - pJVar6->setGlobalRTMatrix(iVar2->getModel()->getAnmMtx(last_eff_index[i])); + for (s32 i = 0; i < ARRAY_SSIZE(last_eff_index); i++) { + JPABaseEmitter* emitter = dComIfGp_particle_set(last_eff_name[i], &actor->current.pos); + if (emitter != NULL) { + emitter->setGlobalRTMatrix(morf->getModel()->getAnmMtx(last_eff_index[i])); } } } @@ -960,13 +978,13 @@ void end(btd_class* i_this) { case 0x34: i_this->m6E88 = 0; local_2c = i_this->m6E5C - i_this->m6E50; - fVar13 = std::sqrtf(local_2c.x * local_2c.x + local_2c.z * local_2c.z); + fVar13 = std::sqrtf(SQUARE(local_2c.x) + SQUARE(local_2c.z)); local_2c.y += fVar13 * (REG0_F(14) + 3.5f); - s16 Yangle; i_this->m6E74.y = cM_atan2s(local_2c.x, local_2c.z); - Yangle = -cM_atan2s(local_2c.y, std::sqrtf(local_2c.x * local_2c.x + local_2c.z * local_2c.z)); - mDoMtx_YrotS(*calc_mtx, i_this->m6E74.y); - mDoMtx_XrotM(*calc_mtx, Yangle); + s16 yAngle; + yAngle = -cM_atan2s(local_2c.y, std::sqrtf(SQUARE(local_2c.x) + SQUARE(local_2c.z))); + cMtx_YrotS(*calc_mtx, i_this->m6E74.y); + cMtx_XrotM(*calc_mtx, yAngle); local_2c.x = 0.0f; local_2c.y = 0.0f; local_2c.z = actor->speedF; @@ -977,8 +995,7 @@ void end(btd_class* i_this) { } actor->eyePos = i_this->m6E50; local_2c = i_this->m6E5C - i_this->m6E50; - fVar13 = local_2c.abs(); - if (fVar13 < actor->speedF * 2.0f) { + if (local_2c.abs() < actor->speedF * 2.0f) { i_this->mGohmaState = 0x35; goto block_58; case 0x35: @@ -992,7 +1009,7 @@ void end(btd_class* i_this) { i_this->m6E68.y *= REG0_F(4) + -0.3f; i_this->m6E48 = 40.0f; dComIfGp_getVibration().StartShock(REG0_S(2) + 5, -0x21, cXyz(0.0f, 1.0f, 0.0f)); - mDoAud_seStart(JA_SE_CM_BTD_DROP_HEAD, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + fopAcM_seStart(actor, JA_SE_CM_BTD_DROP_HEAD, 0); i_this->mGohmaState = 0x36; i_this->m02EC[0] = 0x32; static cXyz pos(i_this->m6E50); @@ -1012,7 +1029,7 @@ void end(btd_class* i_this) { i_this->m6E74.z += REG0_S(4) + 0x5dc; kubi_calc(i_this); if (i_this->m6038 != NULL) { - i_this->m6038->setGlobalRTMatrix(i_this->m02D4->getModel()->getAnmMtx(0)); + i_this->m6038->setGlobalRTMatrix(i_this->mpDeadHeadMorf->getModel()->getAnmMtx(0)); } break; case 0x36: @@ -1028,8 +1045,8 @@ void end(btd_class* i_this) { actor->eyePos = i_this->m6E50; if (i_this->m02EC[0] == 1) { i_this->m6E50.y = i_this->m6E50.y - 100.0f; - mDoAud_seStart(JA_SE_CM_BOSS_EXPLODE, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); - fopAcM_createDisappear(actor, &i_this->m6E50, 0xF, daDisItem_HEART_CONTAINER_e, 0xFF); + fopAcM_seStart(actor, JA_SE_CM_BOSS_EXPLODE, 0); + fopAcM_createDisappear(actor, &i_this->m6E50, 15, daDisItem_HEART_CONTAINER_e); i_this->mGohmaState = 0x37; i_this->m6E50.y = -10000.0f; i_this->m02EC[0] = 0x96; @@ -1039,7 +1056,8 @@ void end(btd_class* i_this) { case 0x37: i_this->m6E88 = 0; if (i_this->m02EC[0] == 2) { - dr2->unk_43C = 1; + dr2_class* tmp = dr2; + tmp->unk_43C = 1; i_this->m6E84 = -200.0f; } if (i_this->m02EC[0] == 1) { @@ -1052,22 +1070,8 @@ void end(btd_class* i_this) { } } -static s32 jab_bck[] = {BTD_BCK_RJAB1, BTD_BCK_RJAB2, BTD_BCK_RJAB3, 0, 0, BTD_BCK_LJAB1, BTD_BCK_LJAB2, BTD_BCK_LJAB3}; -static s32 punch_bck[] = { - BTD_BCK_RATTACK1, - BTD_BCK_RATTACK2, - BTD_BCK_RATTACK3, - BTD_BCK_RATTACK4, - BTD_BCK_RATTACK5, - BTD_BCK_LATTACK1, - BTD_BCK_LATTACK2, - BTD_BCK_LATTACK3, - BTD_BCK_LATTACK4, - BTD_BCK_LATTACK5 -}; - /* 000036A0-00003BCC .text wait__FP9btd_class */ -void wait(btd_class* i_this) { +static void wait(btd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; s16 sVar1; u16 uVar5; @@ -1187,13 +1191,15 @@ void wait(btd_class* i_this) { } } +static s32 jab_bck[] = {BTD_BCK_RJAB1, BTD_BCK_RJAB2, BTD_BCK_RJAB3, 0, 0, BTD_BCK_LJAB1, BTD_BCK_LJAB2, BTD_BCK_LJAB3}; + /* 00003BCC-00003E64 .text jab_attack__FP9btd_class */ -void jab_attack(btd_class* i_this) { +static void jab_attack(btd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - mDoExt_McaMorf* iVar3; + mDoExt_McaMorf* morf; int iVar6; - iVar3 = get_anm(i_this); + morf = get_anm(i_this); switch (i_this->mGohmaState) { case 0: anm_init(i_this, jab_bck[i_this->m02E9], 5.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); @@ -1201,7 +1207,7 @@ void jab_attack(btd_class* i_this) { i_this->mGohmaState++; break; case 1: - if (iVar3->isStop()) { + if (morf->isStop()) { i_this->m02E9++; anm_init(i_this, jab_bck[i_this->m02E9], 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->mGohmaState++; @@ -1214,14 +1220,14 @@ void jab_attack(btd_class* i_this) { break; case 2: i_this->m5E84 = 1; - if (iVar3->isStop()) { + if (morf->isStop()) { i_this->m02E9++; anm_init(i_this, jab_bck[i_this->m02E9], 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->mGohmaState++; } break; case 3: - if (iVar3->isStop()) { + if (morf->isStop()) { i_this->m02E4 = 0; i_this->mGohmaState = 0; i_this->m02EC[0] = (s16)(l_HIO.m14 + cM_rndF(50.0f)); @@ -1230,14 +1236,27 @@ void jab_attack(btd_class* i_this) { } } +static s32 punch_bck[] = { + BTD_BCK_RATTACK1, + BTD_BCK_RATTACK2, + BTD_BCK_RATTACK3, + BTD_BCK_RATTACK4, + BTD_BCK_RATTACK5, + BTD_BCK_LATTACK1, + BTD_BCK_LATTACK2, + BTD_BCK_LATTACK3, + BTD_BCK_LATTACK4, + BTD_BCK_LATTACK5 +}; + /* 00003E64-00004418 .text punch_attack__FP9btd_class */ -void punch_attack(btd_class* i_this) { +static void punch_attack(btd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; int iVar1; - mDoExt_McaMorf* iVar3; + mDoExt_McaMorf* morf; int iVar6; - iVar3 = get_anm(i_this); + morf = get_anm(i_this); switch (i_this->mGohmaState) { case 0: anm_init(i_this, punch_bck[i_this->m02E9], 5.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); @@ -1245,7 +1264,7 @@ void punch_attack(btd_class* i_this) { fopAcM_monsSeStart(actor, JA_SE_CV_BTD_ATTACK, 0); break; case 1: - if (iVar3->isStop()) { + if (morf->isStop()) { i_this->m02E9++; anm_init(i_this, punch_bck[i_this->m02E9], 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->mGohmaState++; @@ -1258,7 +1277,7 @@ void punch_attack(btd_class* i_this) { break; case 2: i_this->m5E84 = 2; - if (iVar3->isStop()) { + if (morf->isStop()) { i_this->m02E9++; anm_init(i_this, punch_bck[i_this->m02E9], 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->mGohmaState++; @@ -1272,7 +1291,7 @@ void punch_attack(btd_class* i_this) { } break; case 3: - if (iVar3->isStop()) { + if (morf->isStop()) { i_this->m02E9++; anm_init(i_this, punch_bck[i_this->m02E9], 0.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->m02EC[0] = (s16)(l_HIO.m28 + cM_rndF(100.0f)); @@ -1284,7 +1303,7 @@ void punch_attack(btd_class* i_this) { if (i_this->m02EA != 0) { iVar6 = 10; } - iVar1 = iVar3->getFrame(); + iVar1 = morf->getFrame(); if (iVar1 == 2) { mDoAud_seStart(JA_SE_CM_BTD_ARM_PULLOUT_1, &i_this->m02FC[iVar6], 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); fopAcM_monsSeStart(actor, JA_SE_CV_BTD_JITABATA, 0); @@ -1301,7 +1320,7 @@ void punch_attack(btd_class* i_this) { } break; case 5: - if (iVar3->isStop()) { + if (morf->isStop()) { i_this->m02E4 = 0; i_this->mGohmaState = 0; i_this->m02EC[0] = (s16)(l_HIO.m14 + cM_rndF(50.0f)); @@ -1314,12 +1333,11 @@ void punch_attack(btd_class* i_this) { } /* 00004418-00004948 .text punch2_attack__FP9btd_class */ -void punch2_attack(btd_class* i_this) { +static void punch2_attack(btd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - mDoExt_McaMorf* iVar3; int iVar6; - iVar3 = get_anm(i_this); + mDoExt_McaMorf* morf = get_anm(i_this); switch (i_this->mGohmaState) { case 0: anm_init(i_this, punch_bck[i_this->m02E9], 5.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); @@ -1327,7 +1345,7 @@ void punch2_attack(btd_class* i_this) { fopAcM_monsSeStart(actor, JA_SE_CV_BTD_ATTACK, 0); break; case 1: - if (iVar3->isStop()) { + if (morf->isStop()) { i_this->m02E9++; anm_init(i_this, punch_bck[i_this->m02E9], 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->mGohmaState++; @@ -1342,7 +1360,7 @@ void punch2_attack(btd_class* i_this) { break; case 2: i_this->m5E84 = 2; - if (iVar3->isStop()) { + if (morf->isStop()) { i_this->m02E9++; anm_init(i_this, punch_bck[i_this->m02E9], 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->mGohmaState++; @@ -1356,7 +1374,7 @@ void punch2_attack(btd_class* i_this) { } break; case 3: - if (iVar3->isStop()) { + if (morf->isStop()) { i_this->m02E9++; anm_init(i_this, punch_bck[i_this->m02E9], 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->m02EC[0] = (s16)(cM_rndF(80.0f) + 80.0f); @@ -1368,7 +1386,7 @@ void punch2_attack(btd_class* i_this) { if (i_this->m02EA != 0) { iVar6 = 10; } - if (iVar3->isStop()) { + if (morf->isStop()) { i_this->m02E9++; anm_init(i_this, punch_bck[i_this->m02E9], 5.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->mGohmaState++; @@ -1380,7 +1398,7 @@ void punch2_attack(btd_class* i_this) { } break; case 5: - if (iVar3->isStop()) { + if (morf->isStop()) { if (l_HIO.m10 != 4) { i_this->m02E4 = 0; i_this->mGohmaState = 0; @@ -1395,13 +1413,12 @@ void punch2_attack(btd_class* i_this) { } /* 00004948-00004FE4 .text fire_attack__FP9btd_class */ -void fire_attack(btd_class* i_this) { +static void fire_attack(btd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - mDoExt_McaMorf* iVar2; cXyz local_2c; cXyz cStack_38; - iVar2 = get_anm(i_this); + mDoExt_McaMorf* morf = get_anm(i_this); i_this->m5E86 = 2; switch (i_this->mGohmaState) { case 0: @@ -1417,13 +1434,13 @@ void fire_attack(btd_class* i_this) { if (i_this->m02EC[0] == 0x1f) { fopAcM_monsSeStart(actor, JA_SE_CV_BTD_BEF_FIRE, 0); } - if (iVar2->isStop()) { + if (morf->isStop()) { anm_init(i_this, BTD_BCK_FATTACK2, 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->mGohmaState++; } break; case 2: - if (iVar2->isStop()) { + if (morf->isStop()) { if (i_this->m02E0 != 0) { i_this->mGohmaState = 6; anm_init(i_this, BTD_BCK_HASAMI_ATTACK, 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); @@ -1459,7 +1476,7 @@ void fire_attack(btd_class* i_this) { case 4: i_this->m602C = 0xc; i_this->m602E = 3; - if (iVar2->isStop()) { + if (morf->isStop()) { i_this->m02E4 = 0; i_this->mGohmaState = 0; i_this->m02EC[0] = (s16)(l_HIO.m14 + cM_rndF(50.0f)); @@ -1467,18 +1484,18 @@ void fire_attack(btd_class* i_this) { if (i_this->m02EC[0] <= 1) { i_this->mKankyoState = 2; mDoAud_seStart(JA_SE_CM_BTD_HIFUKI, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); - MTXCopy(iVar2->getModel()->getAnmMtx(0x3a), *calc_mtx); + MTXCopy(morf->getModel()->getAnmMtx(0x3a), *calc_mtx); local_2c.x = 0.0f; local_2c.y = i_this->m5E80 * -200.0f; local_2c.z = i_this->m5E80 * 1000.0f; MtxPosition(&local_2c, &cStack_38); - i_this->m1B98.SetR(i_this->m5E80 * 200.0f); + i_this->mFireSph.SetR(i_this->m5E80 * 200.0f); if (i_this->m02EC[0] == 1) { - i_this->m1B98.StartCAt(cStack_38); + i_this->mFireSph.StartCAt(cStack_38); } else { - i_this->m1B98.MoveCAt(cStack_38); + i_this->mFireSph.MoveCAt(cStack_38); } - dComIfG_Ccsp()->Set(&i_this->m1B98); + dComIfG_Ccsp()->Set(&i_this->mFireSph); i_this->m5E80 += 0.1f; if (i_this->m5E80 > 1.0f) { i_this->m5E80 = 0.0f; @@ -1489,7 +1506,7 @@ void fire_attack(btd_class* i_this) { break; case 5: i_this->m5E84 = 3; - if (iVar2->isStop()) { + if (morf->isStop()) { anm_init(i_this, BTD_BCK_FATTACK4, 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->mGohmaState = 4; i_this->m02EC[0] = REG0_S(3) + 0x19; @@ -1498,7 +1515,7 @@ void fire_attack(btd_class* i_this) { break; case 6: i_this->m5E84 = 3; - if (iVar2->isStop()) { + if (morf->isStop()) { anm_init(i_this, BTD_BCK_FATTACK3, 15.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->m02EC[0] = (s16)(l_HIO.m2C << 2); i_this->mGohmaState = 3; @@ -1510,14 +1527,13 @@ void fire_attack(btd_class* i_this) { } /* 00004FE4-000053E4 .text up_fire_attack__FP9btd_class */ -void up_fire_attack(btd_class* i_this) { +static void up_fire_attack(btd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - mDoExt_McaMorf* iVar5; cXyz local_2c; cXyz cStack_38; daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); - iVar5 = get_anm(i_this); + mDoExt_McaMorf* morf = get_anm(i_this); i_this->m5E86 = 3; switch (i_this->mGohmaState) { case 0: @@ -1526,7 +1542,7 @@ void up_fire_attack(btd_class* i_this) { i_this->m02EC[0] = 0x28; break; case 1: - if (iVar5->isStop()) { + if (morf->isStop()) { anm_init(i_this, BTD_BCK_UE_KAEN2, 1.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->m02EC[0] = l_HIO.m2C * 9; i_this->mGohmaState++; @@ -1551,14 +1567,14 @@ void up_fire_attack(btd_class* i_this) { if (i_this->m02EC[0] == 0) { i_this->mKankyoState = 2; mDoAud_seStart(JA_SE_CM_BTD_HIFUKI, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); - MTXCopy(iVar5->getModel()->getAnmMtx(0x3a), *calc_mtx); + MTXCopy(morf->getModel()->getAnmMtx(0x3a), *calc_mtx); local_2c.x = 0.0f; local_2c.y = i_this->m5E80 * -200.0f; local_2c.z = i_this->m5E80 * 1000.0f; MtxPosition(&local_2c, &cStack_38); - i_this->m1B98.SetR(i_this->m5E80 * 200.0f); - i_this->m1B98.SetC(cStack_38); - dComIfG_Ccsp()->Set(&i_this->m1B98); + i_this->mFireSph.SetR(i_this->m5E80 * 200.0f); + i_this->mFireSph.SetC(cStack_38); + dComIfG_Ccsp()->Set(&i_this->mFireSph); i_this->m5E80 += 0.1f; if (i_this->m5E80 > 1.0f) { i_this->m5E80 = 0.0f; @@ -1566,30 +1582,28 @@ void up_fire_attack(btd_class* i_this) { } else { i_this->m5E80 = 0.0f; } - if (iVar5->isStop()) { + if (morf->isStop()) { i_this->m02E4 = 0; i_this->mGohmaState = 0; - i_this->m02EC[0] = (s16)(l_HIO.m14 + cM_rndF(50.0f)); + i_this->m02EC[0] = l_HIO.m14 + cM_rndF(50.0f); } break; } if ((player->current.pos.y < REG0_F(5) + 400.0f) || (kui != 0 && (kui->health != 3))) { i_this->m02E4 = 0; i_this->mGohmaState = 0; - i_this->m02EC[0] = (s16)(l_HIO.m14 + cM_rndF(50.0f)); + i_this->m02EC[0] = l_HIO.m14 + cM_rndF(50.0f); } } /* 000053E4-000058A4 .text yoko_fire_attack__FP9btd_class */ -void yoko_fire_attack(btd_class* i_this) { +static void yoko_fire_attack(btd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - mDoExt_McaMorf* iVar5; - f32 fVar8; cXyz local_2c; cXyz cStack_38; daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); - iVar5 = get_anm(i_this); + mDoExt_McaMorf* morf = get_anm(i_this); i_this->m5E86 = 1; switch (i_this->mGohmaState) { case 0: @@ -1598,7 +1612,7 @@ void yoko_fire_attack(btd_class* i_this) { i_this->m02EC[0] = 0x28; break; case 1: - if (iVar5->isStop()) { + if (morf->isStop()) { anm_init(i_this, BTD_BCK_YOKO_KAEN2, 1.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->m02EC[0] = l_HIO.m2C * 7; i_this->mGohmaState++; @@ -1619,21 +1633,20 @@ void yoko_fire_attack(btd_class* i_this) { break; case 3: local_2c = player->eyePos - actor->eyePos; - fVar8 = std::sqrtf(local_2c.x * local_2c.x + local_2c.z * local_2c.z); - i_this->m5E8C = -cM_atan2s(local_2c.y, fVar8) - 0x9c4; + i_this->m5E8C = -cM_atan2s(local_2c.y, std::sqrtf(SQUARE(local_2c.x) + SQUARE(local_2c.z))) - 0x9c4; i_this->m602C = 0xc; i_this->m602E = 3; if (i_this->m02EC[0] == 0) { i_this->mKankyoState = 2; mDoAud_seStart(JA_SE_CM_BTD_HIFUKI, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); - MTXCopy(iVar5->getModel()->getAnmMtx(0x3a), *calc_mtx); + MTXCopy(morf->getModel()->getAnmMtx(0x3a), *calc_mtx); local_2c.x = 0.0f; local_2c.y = i_this->m5E80 * -200.0f; local_2c.z = i_this->m5E80 * 1000.0f; MtxPosition(&local_2c, &cStack_38); - i_this->m1B98.SetR(i_this->m5E80 * 200.0f); - i_this->m1B98.SetC(cStack_38); - dComIfG_Ccsp()->Set(&i_this->m1B98); + i_this->mFireSph.SetR(i_this->m5E80 * 200.0f); + i_this->mFireSph.SetC(cStack_38); + dComIfG_Ccsp()->Set(&i_this->mFireSph); i_this->m5E80 += 0.1f; if (i_this->m5E80 > REG0_F(9) + 1.0f) { i_this->m5E80 = 0.0f; @@ -1641,25 +1654,23 @@ void yoko_fire_attack(btd_class* i_this) { } else { i_this->m5E80 = 0.0f; } - if (iVar5->isStop()) { + if (morf->isStop()) { i_this->m02E4 = 0; i_this->mGohmaState = 0; - fVar8 = cM_rndF(50.0f); - i_this->m02EC[0] = (s16)(l_HIO.m14 + fVar8); + i_this->m02EC[0] = l_HIO.m14 + cM_rndF(50.0f); } break; } if ((player->current.pos.y < REG0_F(5) + 400.0f) || (kui != 0 && (kui->health == 3))) { i_this->m02E4 = 0; i_this->mGohmaState = 0; - fVar8 = cM_rndF(50.0f); - i_this->m02EC[0] = (s16)(l_HIO.m14 + fVar8); + i_this->m02EC[0] = l_HIO.m14 + cM_rndF(50.0f); } i_this->m5E94 = 0x200; } /* 000058A4-00005930 .text attack__FP9btd_class */ -void attack(btd_class* i_this) { +static void attack(btd_class* i_this) { i_this->m02F0 = 5; switch (i_this->mAttackType) { case 0: @@ -1684,7 +1695,7 @@ void attack(btd_class* i_this) { } /* 00005930-00005BCC .text move__FP9btd_class */ -void move(btd_class* i_this) { +static void move(btd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); s16 uVar2; @@ -1704,7 +1715,12 @@ void move(btd_class* i_this) { attack(i_this); break; case 2: +#if VERSION == VERSION_DEMO + damage(i_this); + bVar5 = true; +#else bVar5 = damage(i_this); +#endif break; case 0xA: startdemo(i_this); @@ -1721,8 +1737,8 @@ void move(btd_class* i_this) { } damage_check(i_this); if (i_this->m5E94 != 0) { - dr2_class* dr2Var = (dr2_class*)dr2; - if (((dr2Var != NULL) && (dr2Var->unk_4BA == 0 || (dr2Var->unk_4BA >= 0xA))) && (dr2Var->unk_4CA == 0 || (dr2Var->unk_4CA >= 0x62))) { + dr2_class* tmp = (dr2_class*)dr2; + if (((tmp != NULL) && (tmp->unk_4BA == 0 || (tmp->unk_4BA >= 0xA))) && (tmp->unk_4CA == 0 || (tmp->unk_4CA >= 0x62))) { s16 r4; if (i_this->m5E90 != 0) { r4 = i_this->m5E90; @@ -1768,18 +1784,18 @@ void move(btd_class* i_this) { } /* 00005BCC-00005C24 .text k_a_d_sub__FPvPv */ -void* k_a_d_sub(void* i_this, void* param_2) { +static void* k_a_d_sub(void* i_this, void* param_2) { UNUSED(param_2); - if (((fopAc_IsActor(i_this)) && (fopAcM_GetName(i_this) == PROC_KUI)) && (fopAcM_GetParam(i_this) == 0x511)) { + if (((fopAcM_IsActor(i_this)) && (fopAcM_GetName(i_this) == PROC_KUI)) && (fopAcM_GetParam(i_this) == 0x511)) { return i_this; } return NULL; } /* 00005C24-00005C70 .text dr2_a_d_sub__FPvPv */ -void* dr2_a_d_sub(void* i_this, void* param_2) { +static void* dr2_a_d_sub(void* i_this, void* param_2) { UNUSED(param_2); - if ((fopAc_IsActor(i_this)) && (fopAcM_GetName(i_this) == PROC_DR2)) { + if ((fopAcM_IsActor(i_this)) && (fopAcM_GetName(i_this) == PROC_DR2)) { return i_this; } else { return NULL; @@ -1787,40 +1803,40 @@ void* dr2_a_d_sub(void* i_this, void* param_2) { } /* 00005C70-00005CC8 .text wepon_s_sub__FPvPv */ -void* wepon_s_sub(void* i_this, void* param_2) { +static void* wepon_s_sub(void* i_this, void* param_2) { UNUSED(param_2); - if (((fopAc_IsActor(i_this)) && (fopAcM_GetName(i_this) == PROC_HIMO2)) || (fopAcM_GetName(i_this) == PROC_BOOMERANG)) { + if (((fopAcM_IsActor(i_this)) && (fopAcM_GetName(i_this) == PROC_HIMO2)) || (fopAcM_GetName(i_this) == PROC_BOOMERANG)) { return i_this; } return NULL; } /* 00005CC8-00005DC4 .text hahen_move__FP9btd_class */ -void hahen_move(btd_class* i_this) { - btd_hahen_s* pbVar2 = &i_this->hahen[0]; - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->hahen); i++, pbVar2++) { - if (pbVar2->m04 != 0) { - pbVar2->m08 += pbVar2->m14; - pbVar2->m20 += 0x900; - pbVar2->m22 += 0x600; - pbVar2->m14.y -= 3.0f; - MtxTrans(pbVar2->m08.x, pbVar2->m08.y, pbVar2->m08.z, false); - mDoMtx_YrotM(*calc_mtx, pbVar2->m22); - mDoMtx_XrotM(*calc_mtx, pbVar2->m20); - pbVar2->model->setBaseTRMtx(*calc_mtx); - if (pbVar2->m08.y < -100.0f) { - pbVar2->m04 = 0; +static void hahen_move(btd_class* i_this) { + btd_hahen_s* hahen = &i_this->hahen[0]; + for (s32 i = 0; i < ARRAY_SSIZE(i_this->hahen); i++, hahen++) { + if (hahen->m04 != 0) { + hahen->m08 += hahen->m14; + hahen->m20 += 0x900; + hahen->m22 += 0x600; + hahen->m14.y -= 3.0f; + MtxTrans(hahen->m08.x, hahen->m08.y, hahen->m08.z, false); + cMtx_YrotM(*calc_mtx, hahen->m22); + cMtx_XrotM(*calc_mtx, hahen->m20); + hahen->model->setBaseTRMtx(*calc_mtx); + if (hahen->m08.y < -100.0f) { + hahen->m04 = 0; } } } } /* 00005DC4-000060E0 .text sibuki_move__FP9btd_class */ -void sibuki_move(btd_class* i_this) { +static void sibuki_move(btd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); btd_sibuki_s* sibuikiS = &i_this->mBtdSibukiS[0]; - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->mBtdSibukiS); i++, sibuikiS++) { + for (s32 i = 0; i < ARRAY_SSIZE(i_this->mBtdSibukiS); i++, sibuikiS++) { if (sibuikiS->m00 == 0) { continue; } @@ -1837,28 +1853,28 @@ void sibuki_move(btd_class* i_this) { } if (sibuikiS->m10.y < 0.0f) { if (sibuikiS->m00 == 1) { - i_this->m1CC4[i].StartCAt(sibuikiS->m04); + i_this->mSibukiSphs[i].StartCAt(sibuikiS->m04); sibuikiS->m00++; } else { - i_this->m1CC4[i].MoveCAt(sibuikiS->m04); + i_this->mSibukiSphs[i].MoveCAt(sibuikiS->m04); } - dComIfG_Ccsp()->Set(&i_this->m1CC4[i]); + dComIfG_Ccsp()->Set(&i_this->mSibukiSphs[i]); if (sibuikiS->m04.y < 0.0f) { sibuikiS->m04.y = 0.0f; bVar2 = true; } } - if ((bVar2) || (i_this->m1CC4[i].ChkAtHit())) { + if ((bVar2) || (i_this->mSibukiSphs[i].ChkAtHit())) { cXyz local_38 = player->current.pos - sibuikiS->m04; sibuikiS->m00 = 0; if ((local_38.abs() < 1500.0f) && (i_this->m6E14 < 20)) { i_this->m6E14++; - dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_BTDPOPMAGMA01, &sibuikiS->m04, 0xff, g_whiteColor, g_whiteColor, 0); + dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_BTDPOPMAGMA01, &sibuikiS->m04, 0xFF, g_whiteColor, g_whiteColor, 0); mDoAud_seStart(JA_SE_OBJ_BTD_FIRE_DROP, &sibuikiS->m04, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); sibuikiS->m00 = 0; } } else { - dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_BTDPOPMAGMA00, &sibuikiS->m04, 0xff, g_whiteColor, g_whiteColor, 0); + dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_BTDPOPMAGMA00, &sibuikiS->m04, 0xFF, g_whiteColor, g_whiteColor, 0); } } else { sibuikiS->m00++; @@ -1870,7 +1886,7 @@ void sibuki_move(btd_class* i_this) { } /* 000060E0-000072BC .text demo_camera__FP9btd_class */ -void demo_camera(btd_class* i_this) { +static void demo_camera(btd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; f32 fVar2; camera_class* camera2; @@ -1909,10 +1925,16 @@ void demo_camera(btd_class* i_this) { if (i_this->m6E1A > 0x32) { i_this->m6E1C.y -= (REG0_F(6) + 5.0f); } - local_44.x = -1373.0f; - local_44.y = player->current.pos.y; - local_44.z = 790.0f; - player->setPlayerPosAndAngle(&local_44, actor->current.angle.y + 0x8000); +#if VERSION == VERSION_DEMO + if (i_this->m6E1A >= 0x6e) { +#endif + local_44.x = -1373.0f; + local_44.y = player->current.pos.y; + local_44.z = 790.0f; + player->setPlayerPosAndAngle(&local_44, actor->current.angle.y + 0x8000); +#if VERSION == VERSION_DEMO + } +#endif if (i_this->m6E1A != 0x6F) { break; } @@ -2047,7 +2069,7 @@ void demo_camera(btd_class* i_this) { } cLib_addCalc2(&i_this->m6E28.y, fVar2, 0.2f, 200.0f); cLib_addCalc2(&i_this->m6E28.z, actor->eyePos.z * 0.3f, 0.2f, 200.0f); - mDoMtx_YrotS(*calc_mtx, actor->current.angle.y); + cMtx_YrotS(*calc_mtx, actor->current.angle.y); local_38.x = REG0_F(7) * 0.1f + -500.0f; local_38.y = REG0_F(8) * 0.1f + 70.0f; local_38.z = REG0_F(9) * 0.1f + 2000.0f; @@ -2064,7 +2086,11 @@ void demo_camera(btd_class* i_this) { i_this->mKankyoState = 4; } if (i_this->m6E1A == 0x5a) { +#if VERSION == VERSION_DEMO + mDoGph_gInf_c::offBlure(); +#else i_this->m6E15 = 1; +#endif } if (i_this->m6E1A > (s16)(REG0_S(2) + 0x5a)) { cLib_addCalc2(&i_this->m6E28.x, actor->eyePos.x, i_this->m6E40 * 0.2f, i_this->m6E40 * 200.0f); @@ -2072,7 +2098,7 @@ void demo_camera(btd_class* i_this) { cLib_addCalc2(&i_this->m6E28.z, actor->eyePos.z, i_this->m6E40 * 0.2f, i_this->m6E40 * 200.0f); cLib_addCalc2(&i_this->m6E40, 1.0f, 1.0f, 0.1f); } - mDoMtx_YrotS(*calc_mtx, actor->current.angle.y); + cMtx_YrotS(*calc_mtx, actor->current.angle.y); local_38.x = REG0_F(7) * 0.1f + -500.0f; local_38.y = REG0_F(8) * 0.1f + 70.0f; local_38.z = REG0_F(9) * 0.1f + 2000.0f; @@ -2108,8 +2134,8 @@ void demo_camera(btd_class* i_this) { f0 = i_this->m6E40 * 5000.0f; cLib_addCalcAngleS2(&i_this->m6E34, REG0_S(2) + -6000, 0x10, f0); cLib_addCalc2(&i_this->m6E44, 500.0f, 0.0625f, i_this->m6E40 * 2300.0f); - mDoMtx_YrotS(*calc_mtx, i_this->m6E36); - mDoMtx_XrotM(*calc_mtx, i_this->m6E34); + cMtx_YrotS(*calc_mtx, i_this->m6E36); + cMtx_XrotM(*calc_mtx, i_this->m6E34); local_38.x = 0.0f; local_38.y = 0.0f; local_38.z = i_this->m6E44; @@ -2167,23 +2193,23 @@ void demo_camera(btd_class* i_this) { if (i_this->m6E18 == 2) { player->changeOriginalDemo(); } - if (i_this->m6E18 == 0x73) { + if (i_this->m6E18 == 115) { player->changeDemoMode(daPy_demo_c::DEMO_LOOKUP_e); } - if (i_this->m6E18 == 0x136) { + if (i_this->m6E18 == 310) { player->changeDemoMode(daPy_demo_c::DEMO_UNK_028_e); } - if (i_this->m6E18 == 0x1c4) { + if (i_this->m6E18 == 452) { player->changeDemoMode(daPy_demo_c::DEMO_SURPRISED_e); } - if (i_this->m6E18 == 0x1d1) { + if (i_this->m6E18 == 465) { player->changeDemoMode(daPy_demo_c::DEMO_A_WAIT_e); player->changeDemoParam0(2); } - if (i_this->m6E18 == 0x294) { + if (i_this->m6E18 == 660) { player->changeDemoMode(daPy_demo_c::DEMO_UNK_027_e); } - if (i_this->m6E18 == REG0_S(3) + 0x2dd) { + if (i_this->m6E18 == REG0_S(3) + 733) { player->changeDemoMode(daPy_demo_c::DEMO_A_WAIT_e); player->changeDemoParam0(2); } @@ -2195,10 +2221,19 @@ void demo_camera(btd_class* i_this) { player->changeDemoMode(daPy_demo_c::DEMO_A_WAIT_e); player->changeDemoParam0(2); } - if (i_this->m6E18 == REG0_S(2) + 0x2b5) { +#if VERSION == VERSION_DEMO + if (i_this->m6E18 == 580) { + player->changeDemoMode(daPy_demo_c::DEMO_SURPRISED_e); + } + if (i_this->m6E18 == 593) { + player->changeDemoMode(daPy_demo_c::DEMO_A_WAIT_e); + player->changeDemoParam0(2); + } +#endif + if (i_this->m6E18 == REG0_S(2) + 693) { player->changeDemoMode(daPy_demo_c::DEMO_SMILE_e); } - if (i_this->m6E18 == REG0_S(2) + 0x2c1) { + if (i_this->m6E18 == REG0_S(2) + DEMO_SELECT(723, 705)) { player->changeDemoMode(daPy_demo_c::DEMO_UNK_029_e); } } @@ -2210,9 +2245,15 @@ static f32 at_size[] = { }; /* 000072BC-00007608 .text btd_effect__FP9btd_class */ -void btd_effect(btd_class* i_this) { +static void btd_effect(btd_class* i_this) { static s32 eff_index[] = {0x43, 0x47, 0x20, 0x2D, 0x34}; - static u16 eff_name[] = {dPa_name::ID_AK_SN_ARMFIRECHIP, dPa_name::ID_AK_SN_ARMFIRECHIP, dPa_name::ID_AK_SN_BACKBONEFIRECHIP00, dPa_name::ID_AK_SN_BACKBONEFIRECHIP01, dPa_name::ID_AK_SN_BACKBONEFIRECHIP02}; + static u16 eff_name[] = { + dPa_name::ID_AK_SN_ARMFIRECHIP, + dPa_name::ID_AK_SN_ARMFIRECHIP, + dPa_name::ID_AK_SN_BACKBONEFIRECHIP00, + dPa_name::ID_AK_SN_BACKBONEFIRECHIP01, + dPa_name::ID_AK_SN_BACKBONEFIRECHIP02 + }; static u16 effF_name[] = { dPa_name::ID_AK_SN_FIREBREATHSTORE00, dPa_name::ID_AK_SN_FIREBREATHSTORE01, @@ -2232,77 +2273,63 @@ void btd_effect(btd_class* i_this) { dPa_name::ID_AK_ST_BTDCLAWSMOKER00 }; fopAc_ac_c* actor = &i_this->actor; - mDoExt_McaMorf* iVar2; - JPABaseEmitter* iVar4; - u16 userID; + u32 userID; - iVar2 = get_anm(i_this); - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m5FF8); i++) - if (i_this->m5FF8[i] != 0) { - MTXCopy(iVar2->getModel()->getAnmMtx(eff_index[i]), *calc_mtx); + mDoExt_McaMorf* morf = get_anm(i_this); + for (s32 i = 0; i < ARRAY_SSIZE(i_this->m5FF8); i++) + if (i_this->m5FF8[i] != NULL) { + MTXCopy(morf->getModel()->getAnmMtx(eff_index[i]), *calc_mtx); if (i_this->m02E0 >= 2) { MtxTrans(0.0f, -10000.0f, 0.0f, false); } - iVar4 = i_this->m5FF8[i]; - iVar4->setGlobalRTMatrix(*calc_mtx); + i_this->m5FF8[i]->setGlobalRTMatrix(*calc_mtx); } else { - iVar4 = dComIfGp_particle_set(eff_name[i], &actor->current.pos); - i_this->m5FF8[i] = iVar4; + i_this->m5FF8[i] = dComIfGp_particle_set(eff_name[i], &actor->current.pos); } - for (s32 i = 0, j = 0; i < (s32)ARRAY_SIZE(i_this->m600C); i++, j++) { + for (s32 i = 0, j = 0; i < ARRAY_SSIZE(i_this->m600C); i++, j++) { if (i_this->m6028[j] != 0) { i_this->m6028[j]--; - iVar4 = i_this->m600C[i]; - if (iVar4 != NULL) { + if (i_this->m600C[i] != NULL) { if (i >= 4) { if (i_this->m02EA != 0) { - iVar4->setGlobalRTMatrix(iVar2->getModel()->getAnmMtx(0x48)); + i_this->m600C[i]->setGlobalRTMatrix(morf->getModel()->getAnmMtx(0x48)); } else { - iVar4->setGlobalRTMatrix(iVar2->getModel()->getAnmMtx(0x44)); + i_this->m600C[i]->setGlobalRTMatrix(morf->getModel()->getAnmMtx(0x44)); } } else { - iVar4->setGlobalRTMatrix(iVar2->getModel()->getAnmMtx(0x3a)); + i_this->m600C[i]->setGlobalRTMatrix(morf->getModel()->getAnmMtx(0x3a)); } } else if (i == 6) { userID = dPa_name::ID_AK_ST_BTDCLAWSMOKEL00; if (i_this->m02EA != 0) { userID = dPa_name::ID_AK_ST_BTDCLAWSMOKER00; } - iVar4 = - dComIfGp_particle_setToon((s16)userID, &actor->current.pos, NULL, NULL, 0xB9, &i_this->mPa_SmokeEcallBack[2], (u8)fopAcM_GetRoomNo(actor)); - i_this->m600C[i] = iVar4; + i_this->m600C[i] = + dComIfGp_particle_setToon(userID, &actor->current.pos, NULL, NULL, 0xB9, &i_this->mPa_SmokeEcallBack[2], (u8)fopAcM_GetRoomNo(actor)); } else { if (i_this->m02EA != 0) { - iVar4 = dComIfGp_particle_set(effF_nameR[j], &actor->current.pos); - i_this->m600C[i] = iVar4; + i_this->m600C[i] = dComIfGp_particle_set(effF_nameR[j], &actor->current.pos); } else { - iVar4 = dComIfGp_particle_set(effF_name[j], &actor->current.pos); - i_this->m600C[i] = iVar4; + i_this->m600C[i] = dComIfGp_particle_set(effF_name[j], &actor->current.pos); } if (i == 5) { - iVar4 = i_this->m600C[i]; - iVar4->becomeImmortalEmitter(); + i_this->m600C[i]->becomeImmortalEmitter(); } } - } else { - iVar4 = i_this->m600C[i]; - if (i_this->m600C[i] != NULL) { - if ((i != 3) && (i != 6)) { - if (i == 5) { - i_this->m600C[i]->quitImmortalEmitter(); - } - iVar4 = i_this->m600C[i]; - iVar4->mMaxFrame = -1; - iVar4->stopCreateParticle(); + } else if (i_this->m600C[i] != NULL) { + if ((i != 3) && (i != 6)) { + if (i == 5) { + i_this->m600C[i]->quitImmortalEmitter(); } - i_this->m600C[i] = 0; + i_this->m600C[i]->becomeInvalidEmitter(); } + i_this->m600C[i] = 0; } } } /* 00007608-00007950 .text btd_kankyo__FP9btd_class */ -void btd_kankyo(btd_class* i_this) { +static void btd_kankyo(btd_class* i_this) { u8 uVar1; u8 uVar2; @@ -2345,11 +2372,11 @@ void btd_kankyo(btd_class* i_this) { cLib_addCalc0(&i_this->m60D0, 1.0f, 0.06666f); uVar2 = 3; } - i_this->m60B0.mColor.r = (u8)(i_this->m60D8 * i_this->m60D4); - i_this->m60B0.mColor.g = (u8)(i_this->m60D9 * i_this->m60D4); - i_this->m60B0.mColor.b = (u8)(i_this->m60DA * i_this->m60D4); - i_this->m60B0.mPower = (REG0_F(8) + 5000.0f) * i_this->m60D4; - i_this->m60B0.mFluctuation = REG0_F(9); + i_this->mLightInfluence.mColor.r = (u8)(i_this->m60D8 * i_this->m60D4); + i_this->mLightInfluence.mColor.g = (u8)(i_this->m60D9 * i_this->m60D4); + i_this->mLightInfluence.mColor.b = (u8)(i_this->m60DA * i_this->m60D4); + i_this->mLightInfluence.mPower = (REG0_F(8) + 5000.0f) * i_this->m60D4; + i_this->mLightInfluence.mFluctuation = REG0_F(9); switch (uVar2) { case 0: { dKy_custom_colset(0, 3, i_this->m60D0); @@ -2381,10 +2408,6 @@ static BOOL daBtd_Execute(btd_class* i_this) { static f32 hand_co_size_H[] = {250.0f, 200.0f, 200.0f, 250.0f, 200.0f, 200.0f}; static f32 hand_co_size_R[] = {30.0f, 170.0f, 180.0f, 30.0f, 170.0f, 180.0f}; fopAc_ac_c* actor = &i_this->actor; - mDoExt_McaMorf* this_02; - fopAc_ac_c* pvVar6; - cM3dGSph* this_03; - J3DModel* pJVar9; f32 dVar11; f32 fVar12; cXyz local_60; @@ -2392,15 +2415,16 @@ static BOOL daBtd_Execute(btd_class* i_this) { cXyz local_78; daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); +#if VERSION > VERSION_DEMO if (dComIfGp_getStartStageName()[0] == 'X') { i_this->m6E15 = 0x32; } +#endif if (i_this->m6E90 != 0) { dCam_getBody()->SetTypeForce("Boss01", NULL); } i_this->m6E88 = 1; - fVar12 = i_this->m6E80; - i_this->floor->setYpos(fVar12); + i_this->floor->setYpos(i_this->m6E80); i_this->m6E7C += REG0_F(15) + 30.0f; if (i_this->m6E7C > REG0_F(18) + 2300.0f) { i_this->m6E7C = REG0_F(18) + 2300.0f; @@ -2413,8 +2437,8 @@ static BOOL daBtd_Execute(btd_class* i_this) { if (dr2 == NULL) { dr2 = (dr2_class*)fpcM_Search(dr2_a_d_sub, i_this); } - actor->attention_info.distances[2] = 4; - i_this->m02E2 = i_this->m02E2 + 1; + actor->attention_info.distances[fopAc_Attn_TYPE_BATTLE_e] = 4; + i_this->m02E2++; for (int i = 0; i < 4; i++) { if (i_this->m02EC[i] != 0) { i_this->m02EC[i]--; @@ -2428,62 +2452,61 @@ static BOOL daBtd_Execute(btd_class* i_this) { actor->scale.z = l_HIO.m08; actor->scale.y = fVar12; actor->scale.x = fVar12; - this_02 = get_anm(i_this); - pJVar9 = this_02->getModel(); - pJVar9->setBaseScale(actor->scale); + mDoExt_McaMorf* morf = get_anm(i_this); + J3DModel* model = morf->getModel(); + model->setBaseScale(actor->scale); mDoMtx_stack_c::transS(actor->current.pos.x, actor->current.pos.y, actor->current.pos.z); mDoMtx_stack_c::YrotM(actor->current.angle.y); mDoMtx_stack_c::XrotM(actor->current.angle.x); mDoMtx_stack_c::ZrotM(actor->current.angle.z); - pJVar9->setBaseTRMtx(mDoMtx_stack_c::now); + model->setBaseTRMtx(mDoMtx_stack_c::now); if (l_HIO.m05 == 0) { - this_02->play(&actor->eyePos, 0, 0); + morf->play(&actor->eyePos, 0, 0); } - this_02->calc(); + morf->calc(); fVar12 = 1.0f; if (i_this->m02E0 != 0) { fVar12 = 0.6f; } dVar11 = fVar12; - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m0428); i++) { + for (s32 i = 0; i < ARRAY_SSIZE(i_this->mAtSphs); i++) { if (((i_this->m02E0 != 0) && (i != 8)) && (i != 10)) { - i_this->m0428[i].OffTgShield(); + i_this->mAtSphs[i].OffTgShield(); } - this_03 = &i_this->m0428[i]; - this_03->SetR(dVar11 * at_size[i]); + i_this->mAtSphs[i].SetR(dVar11 * at_size[i]); if (i_this->m6E4C != 0) { local_60.x = 0.0f; local_60.y = -20000.0f; local_60.z = 0.0f; - this_03->SetC(local_60); + i_this->mAtSphs[i].SetC(local_60); } else { - this_03->SetC(i_this->m02FC[i]); + i_this->mAtSphs[i].SetC(i_this->m02FC[i]); } if ((i == 8) || (i == 10)) { if ((i_this->m5E84 == 1) || (i_this->m5E84 == 2)) { - i_this->m0428[i].OnAtSetBit(); + i_this->mAtSphs[i].OnAtSetBit(); if (i_this->m5E84 == 2) { - i_this->m0428[i].SetAtAtp(2); + i_this->mAtSphs[i].SetAtAtp(2); } else { - i_this->m0428[i].SetAtAtp(1); + i_this->mAtSphs[i].SetAtAtp(1); } } else { - i_this->m0428[i].OffAtSetBit(); + i_this->mAtSphs[i].OffAtSetBit(); } - i_this->m0428[i].OffCoSetBit(); - i_this->m0428[i].OffTgSetBit(); + i_this->mAtSphs[i].OffCoSetBit(); + i_this->mAtSphs[i].OffTgSetBit(); } else { if ((i < 2) && (i_this->m5E84 == 3)) { - i_this->m0428[i].OnAtSetBit(); + i_this->mAtSphs[i].OnAtSetBit(); } else { - i_this->m0428[i].OffAtSetBit(); + i_this->mAtSphs[i].OffAtSetBit(); } if ((i < 2) && (i_this->m02E0 == 0)) { - i_this->m0428[i].OffCoSetBit(); - i_this->m0428[i].OffTgSetBit(); + i_this->mAtSphs[i].OffCoSetBit(); + i_this->mAtSphs[i].OffTgSetBit(); } } - dComIfG_Ccsp()->Set(&i_this->m0428[i]); + dComIfG_Ccsp()->Set(&i_this->mAtSphs[i]); } s16 sVar4 = 0; dVar11 = 1.0f; @@ -2497,33 +2520,34 @@ static BOOL daBtd_Execute(btd_class* i_this) { local_78.x = 0.0f; local_78.y = -10000.0f; local_78.z = 0.0f; - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m575C); i++) { - i_this->m575C[i].SetC(local_78); + for (s32 i = 0; i < ARRAY_SSIZE(i_this->mHandCyls); i++) { + i_this->mHandCyls[i].SetC(local_78); } - mDoMtx_YrotS(*calc_mtx, (s16)(actor->current.angle.y + sVar4)); - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m575C); i++) { + cMtx_YrotS(*calc_mtx, (s16)(actor->current.angle.y + sVar4)); + for (s32 i = 0; i < ARRAY_SSIZE(i_this->mHandCyls); i++) { if ((i_this->m5E7C != 0) && ((i_this->m5E7C == 1 || (i_this->m5E7C == 2 && (i <= 2))) || (i_this->m5E7C == 3 && (i >= 3)))) { - local_6c.set(hand_co_pos_X[i], hand_co_pos_Y[i], dVar11 * hand_co_pos_Z[i]); - MtxPosition(&local_6c, &i_this->m5E98[i + 0x13]); - i_this->m5E98[i + 0x13] += actor->current.pos; - i_this->m575C[i].SetC(i_this->m5E98[i + 0x13]); - i_this->m575C[i].SetH(hand_co_size_H[i]); - i_this->m575C[i].SetR(hand_co_size_R[i]); + local_6c.x = hand_co_pos_X[i]; + local_6c.y = hand_co_pos_Y[i]; + local_6c.z = dVar11 * hand_co_pos_Z[i]; + MtxPosition(&local_6c, &i_this->m5E98[i + 19]); + i_this->m5E98[i + 19] += actor->current.pos; + i_this->mHandCyls[i].SetC(i_this->m5E98[i + 19]); + i_this->mHandCyls[i].SetH(hand_co_size_H[i]); + i_this->mHandCyls[i].SetR(hand_co_size_R[i]); } - dComIfG_Ccsp()->Set(&i_this->m575C[i]); + dComIfG_Ccsp()->Set(&i_this->mHandCyls[i]); } i_this->m5E7C = 0; - pvVar6 = (fopAc_ac_c*)fpcM_Search(wepon_s_sub, i_this); - if ((pvVar6 != NULL) && (pvVar6->speedF > 10.0f)) { - local_6c = pvVar6->current.pos - actor->eyePos; + fopAc_ac_c* itemActor = (fopAc_ac_c*)fpcM_Search(wepon_s_sub, i_this); + if ((itemActor != NULL) && (itemActor->speedF > 10.0f)) { + local_6c = itemActor->current.pos - actor->eyePos; if (local_6c.abs() < 400.0f) { i_this->m02F8 = 0x14; } } local_6c = player->eyePos - actor->eyePos; if (player->getCutType() != daPy_py_c::CUT_TYPE_NONE) { - fVar12 = local_6c.abs(); - if (fVar12 < 400.0f) { + if (local_6c.abs() < 400.0f) { i_this->m02F8 = 0x14; } } @@ -2538,14 +2562,14 @@ static BOOL daBtd_Execute(btd_class* i_this) { i_this->m02F8 = 0x14; } if (i_this->m02E0 != 0) { - i_this->m1A6C.OffTgShield(); + i_this->mEyeSph.OffTgShield(); } - i_this->m1A6C.SetR(REG0_F(5) + 80.0f); - i_this->m1A6C.SetC(i_this->m03E0); - dComIfG_Ccsp()->Set(&i_this->m1A6C); + i_this->mEyeSph.SetR(REG0_F(5) + 80.0f); + i_this->mEyeSph.SetC(i_this->m03E0); + dComIfG_Ccsp()->Set(&i_this->mEyeSph); btk->play(); brk->play(); - g_env_light.settingTevStruct(TEV_TYPE_BG0, &actor->eyePos, &i_this->m60E0); + g_env_light.settingTevStruct(TEV_TYPE_BG0, &actor->eyePos, &i_this->mTevstr); hahen_move(i_this); sibuki_move(i_this); demo_camera(i_this); @@ -2561,39 +2585,39 @@ static BOOL daBtd_IsDelete(btd_class*) { /* 000081C0-00008304 .text daBtd_Delete__FP9btd_class */ static BOOL daBtd_Delete(btd_class* i_this) { - dComIfG_resDelete(&i_this->m02AC, "Btd"); - dComIfG_resDelete(&i_this->m02B4, "Magma"); + dComIfG_resDeleteDemo(&i_this->mPhaseBtd, "Btd"); + dComIfG_resDeleteDemo(&i_this->mPhaseMagma, "Magma"); mDoHIO_deleteChild(l_HIO.mNo); // !@bug: this for loop only iterates through the first 19 elements of the array. for (int i = 0; i < 19; i++) { mDoAud_seDeleteObject(&i_this->m5E98[i]); } - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->mBtdSibukiS); i++) { + for (s32 i = 0; i < ARRAY_SSIZE(i_this->mBtdSibukiS); i++) { mDoAud_seDeleteObject(&i_this->mBtdSibukiS[i].m04); } - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m02FC); i++) { +#if VERSION > VERSION_DEMO + for (s32 i = 0; i < ARRAY_SSIZE(i_this->m02FC); i++) { mDoAud_seDeleteObject(&i_this->m02FC[i]); } if (dr2 != NULL) { mDoAud_seDeleteObject(&dr2->unk_4A8); } mDoAud_seDeleteObject(&static_center_pos); - dKy_efplight_cut(&i_this->m60B0); +#endif + dKy_efplight_cut(&i_this->mLightInfluence); return TRUE; } /* 00008304-00008D30 .text useHeapInit__FP10fopAc_ac_c */ static BOOL useHeapInit(fopAc_ac_c* a_this) { J3DModelData* modelDataA; - J3DAnmTextureSRTKey* pJVar10; - int iVar11; - J3DAnmTevRegKey* pJVar13; + J3DAnmTextureSRTKey* pBtk; + J3DAnmTevRegKey* pBrk; J3DModelData* modelDataB; - J3DModel* pJVar15; - f32 dVar18; + J3DModel* pModel; btd_class* i_this = (btd_class*)a_this; - i_this->m02BC = new mDoExt_McaMorf( + i_this->mpPhase1Morf = new mDoExt_McaMorf( (J3DModelData*)dComIfG_getObjectRes("Btd", BTD_BMD_BTD), NULL, NULL, @@ -2607,31 +2631,37 @@ static BOOL useHeapInit(fopAc_ac_c* a_this) { 0, 0x11020203 ); - if ((i_this->m02BC == NULL) || (i_this->m02BC->getModel() == NULL)) { + if ((i_this->mpPhase1Morf == NULL) || (i_this->mpPhase1Morf->getModel() == NULL)) { return FALSE; } - for (u16 uVar16 = 0; uVar16 < i_this->m02BC->getModel()->getModelData()->getJointNum(); uVar16++) { - if (joint_check[uVar16] >= 0) { - i_this->m02BC->getModel()->getModelData()->getJointNodePointer(uVar16)->setCallBack(nodeCallBack); + for (u16 i = 0; i < i_this->mpPhase1Morf->getModel()->getModelData()->getJointNum(); i++) { + if (joint_check[i] >= 0) { + i_this->mpPhase1Morf->getModel()->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack); } } - i_this->m02BC->getModel()->setUserArea((u32)i_this); - pJVar15 = i_this->m02BC->getModel(); + i_this->mpPhase1Morf->getModel()->setUserArea((u32)i_this); + pModel = i_this->mpPhase1Morf->getModel(); i_this->btk = new mDoExt_btkAnm(); - JUT_ASSERT(5370, i_this->btk); - pJVar10 = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Btd", BTD_BTK_BTD); - iVar11 = i_this->btk->init(pJVar15->getModelData(), pJVar10, true, J3DFrameCtrl::EMode_LOOP); - if (iVar11 == 0) { + JUT_ASSERT(DEMO_SELECT(5327, 5370), i_this->btk); + pBtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Btd", BTD_BTK_BTD); +#if VERSION == VERSION_DEMO + i_this->btk->init(pModel->getModelData(), pBtk, true, J3DFrameCtrl::EMode_LOOP); +#else + if (!i_this->btk->init(pModel->getModelData(), pBtk, true, J3DFrameCtrl::EMode_LOOP)) { return FALSE; } +#endif i_this->brk = new mDoExt_brkAnm(); - JUT_ASSERT(5390, i_this->brk); - pJVar13 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Btd", BTD_BRK_BTD); - iVar11 = i_this->brk->init(pJVar15->getModelData(), pJVar13, true, J3DFrameCtrl::EMode_LOOP); - if (iVar11 == 0) { + JUT_ASSERT(DEMO_SELECT(5337, 5390), i_this->brk); + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Btd", BTD_BRK_BTD); +#if VERSION == VERSION_DEMO + i_this->brk->init(pModel->getModelData(), pBrk, true, J3DFrameCtrl::EMode_LOOP); +#else + if (!i_this->brk->init(pModel->getModelData(), pBrk, true, J3DFrameCtrl::EMode_LOOP)) { return FALSE; } - i_this->m02C8 = new mDoExt_McaMorf( +#endif + i_this->mpPhase2Morf = new mDoExt_McaMorf( (J3DModelData*)dComIfG_getObjectRes("Btd", BTD_BMD_SOTAI), NULL, NULL, @@ -2645,76 +2675,77 @@ static BOOL useHeapInit(fopAc_ac_c* a_this) { 0, 0x11020203 ); - if ((i_this->m02C8 == NULL) || (i_this->m02C8->getModel() == NULL)) { + if ((i_this->mpPhase2Morf == NULL) || (i_this->mpPhase2Morf->getModel() == NULL)) { return FALSE; } - for (u16 uVar16 = 0; uVar16 < i_this->m02C8->getModel()->getModelData()->getJointNum(); uVar16++) { - if (joint_check[uVar16] >= 0) { - i_this->m02C8->getModel()->getModelData()->getJointNodePointer(uVar16)->setCallBack(nodeCallBack); + for (u16 i = 0; i < i_this->mpPhase2Morf->getModel()->getModelData()->getJointNum(); i++) { + if (joint_check[i] >= 0) { + i_this->mpPhase2Morf->getModel()->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack); } } - i_this->m02C8->getModel()->setUserArea((u32)i_this); - pJVar15 = i_this->m02C8->getModel(); + i_this->mpPhase2Morf->getModel()->setUserArea((u32)i_this); + pModel = i_this->mpPhase2Morf->getModel(); i_this->btkS = new mDoExt_btkAnm(); - JUT_ASSERT(5432, i_this->btkS); - pJVar10 = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Btd", BTD_BTK_DEADA); - iVar11 = i_this->btkS->init(pJVar15->getModelData(), pJVar10, true, J3DFrameCtrl::EMode_NONE); - if (iVar11 == 0) { + JUT_ASSERT(DEMO_SELECT(5370, 5432), i_this->btkS); + pBtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Btd", BTD_BTK_DEADA); +#if VERSION == VERSION_DEMO + i_this->btkS->init(pModel->getModelData(), pBtk, true, J3DFrameCtrl::EMode_NONE); +#else + if (!i_this->btkS->init(pModel->getModelData(), pBtk, true, J3DFrameCtrl::EMode_NONE)) { return FALSE; } - pJVar10 = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Btd", BTD_BTK_SOTAI); - i_this->btkS->init(pJVar15->getModelData(), pJVar10, true, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, 0); +#endif + pBtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Btd", BTD_BTK_SOTAI); + i_this->btkS->init(pModel->getModelData(), pBtk, true, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, 0); i_this->brkS = new mDoExt_brkAnm(); - JUT_ASSERT(5463, i_this->brkS); - pJVar13 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Btd", BTD_BRK_DEADA); - iVar11 = i_this->brkS->init(pJVar15->getModelData(), pJVar13, true, J3DFrameCtrl::EMode_NONE); - if (iVar11 == 0) { + JUT_ASSERT(DEMO_SELECT(5390, 5463), i_this->brkS); + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Btd", BTD_BRK_DEADA); +#if VERSION == VERSION_DEMO + i_this->brkS->init(pModel->getModelData(), pBrk, true, J3DFrameCtrl::EMode_NONE); +#else + if (!i_this->brkS->init(pModel->getModelData(), pBrk, true, J3DFrameCtrl::EMode_NONE)) { return FALSE; } - pJVar13 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Btd", BTD_BRK_SOTAI); - i_this->brkS->init(pJVar15->getModelData(), pJVar13, true, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, 0); - i_this->m02D4 = new mDoExt_McaMorf( +#endif + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Btd", BTD_BRK_SOTAI); + i_this->brkS->init(pModel->getModelData(), pBrk, true, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, 0); + i_this->mpDeadHeadMorf = new mDoExt_McaMorf( (J3DModelData*)dComIfG_getObjectRes("Btd", BTD_BMD_NAMAKUBI), NULL, NULL, NULL, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, 0, NULL, 0, 0x11020203 ); - if ((i_this->m02D4 == NULL) || (pJVar15 = i_this->m02D4->getModel(), pJVar15 == NULL)) { + if ((i_this->mpDeadHeadMorf == NULL) || (pModel = i_this->mpDeadHeadMorf->getModel(), pModel == NULL)) { return FALSE; } - i_this->m02D8 = new mDoExt_btkAnm(); - if (i_this->m02D8 == NULL) { + i_this->mpDeadHeadBtkAnm = new mDoExt_btkAnm(); + if (i_this->mpDeadHeadBtkAnm == NULL) { return FALSE; } - pJVar10 = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Btd", BTD_BTK_NAMAKUBI); - iVar11 = i_this->m02D8->init(pJVar15->getModelData(), pJVar10, true, J3DFrameCtrl::EMode_NONE); - if (iVar11 == 0) { + pBtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Btd", BTD_BTK_NAMAKUBI); + if (!i_this->mpDeadHeadBtkAnm->init(pModel->getModelData(), pBtk, true, J3DFrameCtrl::EMode_NONE)) { return FALSE; } - i_this->m02DC = new mDoExt_brkAnm(); - if (i_this->m02DC == NULL) { + i_this->mpDeadHeadBrkAnm = new mDoExt_brkAnm(); + if (i_this->mpDeadHeadBrkAnm == NULL) { return FALSE; } - pJVar13 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Btd", BTD_BRK_NAMAKUBI); - iVar11 = i_this->m02DC->init(pJVar15->getModelData(), pJVar13, true, J3DFrameCtrl::EMode_NONE); - if (iVar11 == 0) { + pBrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Btd", BTD_BRK_NAMAKUBI); + if (!i_this->mpDeadHeadBrkAnm->init(pModel->getModelData(), pBrk, true, J3DFrameCtrl::EMode_NONE)) { return FALSE; } modelDataA = (J3DModelData*)dComIfG_getObjectRes("Btd", BTD_BMD_HAHENA); modelDataB = (J3DModelData*)dComIfG_getObjectRes("Btd", BTD_BMD_KAMENA); - JUT_ASSERT(5544, modelDataA && modelDataB); - dVar18 = 1.0f; - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->hahen); i++) { + JUT_ASSERT(DEMO_SELECT(5460, 5544), modelDataA && modelDataB); + for (s32 i = 0; i < ARRAY_SSIZE(i_this->hahen); i++) { if (i < 5) { - pJVar15 = mDoExt_J3DModel__create(modelDataB, 0, 0x11020203); - i_this->hahen[i].model = pJVar15; + i_this->hahen[i].model = mDoExt_J3DModel__create(modelDataB, 0, 0x11020203); } else { - pJVar15 = mDoExt_J3DModel__create(modelDataA, 0, 0x11020203); - i_this->hahen[i].model = pJVar15; + i_this->hahen[i].model = mDoExt_J3DModel__create(modelDataA, 0, 0x11020203); } - JUT_ASSERT(5594, i_this->hahen[i].model); - cXyz vec; - vec.x = dVar18 + cM_rndF(0.5f); - vec.y = dVar18 + cM_rndF(0.5f); - vec.z = dVar18 + cM_rndF(0.5f); - i_this->hahen[i].model->setBaseScale(vec); + JUT_ASSERT(DEMO_SELECT(5510, 5594), i_this->hahen[i].model); + cXyz scale; + scale.x = 1.0f + cM_rndF(0.5f); + scale.y = 1.0f + cM_rndF(0.5f); + scale.z = 1.0f + cM_rndF(0.5f); + i_this->hahen[i].model->setBaseScale(scale); } return TRUE; } @@ -2863,89 +2894,93 @@ static cPhs_State daBtd_Create(fopAc_ac_c* a_this) { }}, }; - cPhs_State res; - fopAc_ac_c* actor = a_this; fopAcM_ct(actor, btd_class); btd_class* i_this = (btd_class*)a_this; - res = dComIfG_resLoad(&i_this->m02AC, "Btd"); + + cPhs_State res = dComIfG_resLoad(&i_this->mPhaseBtd, "Btd"); +#if VERSION == VERSION_DEMO + cPhs_State res2 = dComIfG_resLoad(&i_this->mPhaseMagma, "Magma"); + if (res == cPhs_ERROR_e || res2 == cPhs_ERROR_e) { + return cPhs_ERROR_e; + } if (res != cPhs_COMPLEATE_e) { return res; - } else { - res = dComIfG_resLoad(&i_this->m02B4, "Magma"); - if (res != cPhs_COMPLEATE_e) { - return res; - } else { - dr2 = NULL; - kui = NULL; - i_this->mPa_SmokeEcallBack[0].setFollowOff(); - i_this->mPa_SmokeEcallBack[1].setFollowOff(); - i_this->mPa_SmokeEcallBack[2].setFollowOff(); - if ((dComIfGs_isStageBossEnemy()) && (dComIfGp_getStartStageName()[0] != 'X')) { - res = cPhs_ERROR_e; - } else { - if (!fopAcM_entrySolidHeap(actor, useHeapInit, 0x5B8C0)) { - res = cPhs_ERROR_e; - } else { - actor->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e; - l_HIO.mNo = mDoHIO_createChild("ボスゴーマ", &l_HIO); // Boss Goma - i_this->m03EC.Init(0xff, 0xff, actor); - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m0428); i++) { - i_this->m0428[i].Set(at_sph_src); - i_this->m0428[i].SetStts(&i_this->m03EC); - } - i_this->m1A6C.SetStts(&i_this->m03EC); - i_this->m1A6C.Set(eye_sph_src); - i_this->m1B98.SetStts(&i_this->m03EC); - i_this->m1B98.Set(fire_sph_src); - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m1CC4); i++) { - i_this->m1CC4[i].Set(sibuki_sph_src); - i_this->m1CC4[i].SetStts(&i_this->m03EC); - } - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m575C); i++) { - i_this->m575C[i].Set(hand_cyl_src); - i_this->m575C[i].SetStts(&i_this->m03EC); - } - i_this->m02EC[0] = (s16)(l_HIO.m14 + cM_rndF(50.0f)); - dKy_efplight_set(&i_this->m60B0); - actor->health = 10; - actor->max_health = 10; - if ((dComIfGs_isStageBossDemo()) || (dComIfGp_getStartStageName()[0] == 'X')) { - dComIfGs_offTmpBit(dSv_event_tmp_flag_c::UNK_0480); - i_this->m6E80 = -50.0f; - i_this->m6E84 = 0.0f; - if (dComIfGp_getStartStageName()[0] == 'X') { - mDoAud_bgmStart(JA_BGM_PAST_GOMA); - } else { - mDoAud_bgmStart(JA_BGM_GOMA); - } - i_this->m02EC[0] = (s16)((cM_rndF(50.0f) + 70.0f) + 100.0f); - fopAcM_OnStatus(actor, fopAcStts_SHOWMAP_e | fopAcStts_UNK4000_e); - } else { - i_this->m02E4 = 10; - i_this->m6E80 = -50.0f; - i_this->m6E84 = -30.0f; - i_this->m02EC[0] = REG0_S(4) + 0x96; - i_this->m6E7C = REG0_F(18) + 2300.0f; - fopAcM_OnStatus(actor, fopAcStts_SHOWMAP_e | fopAcStts_UNK4000_e); - } - i_this->m6E90 = 1; - if (dComIfGp_createMagma()) { - cXyz local_48; - local_48.x = 0.0f; - local_48.y = -300.0f; - local_48.z = 0.0f; - i_this->floor = dComIfGp_getMagma()->newFloor(local_48, actor->scale, fopAcM_GetRoomNo(actor), -0xFA); - JUT_ASSERT(6096, i_this->floor != NULL); - } - fopAcM_create(PROC_Ykgr, 0x10FF00, &actor->current.pos); - dKy_custom_timeset(l_HIO.m30); - res = cPhs_COMPLEATE_e; - } - } - } } - return res; + if (res2 != cPhs_COMPLEATE_e) { + return res2; + } +#else + if (res != cPhs_COMPLEATE_e) { + return res; + } + cPhs_State res2 = dComIfG_resLoad(&i_this->mPhaseMagma, "Magma"); + if (res2 != cPhs_COMPLEATE_e) { + return res2; + } +#endif + dr2 = NULL; + kui = NULL; + i_this->mPa_SmokeEcallBack[0].setFollowOff(); + i_this->mPa_SmokeEcallBack[1].setFollowOff(); + i_this->mPa_SmokeEcallBack[2].setFollowOff(); + if ((dComIfGs_isStageBossEnemy()) && (dComIfGp_getStartStageName()[0] != 'X')) { + return cPhs_ERROR_e; + } + if (!fopAcM_entrySolidHeap(actor, useHeapInit, 0x5B8C0)) { + return cPhs_ERROR_e; + } + actor->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e; + l_HIO.mNo = mDoHIO_createChild("ボスゴーマ", &l_HIO); // Boss Goma + i_this->mStts.Init(0xFF, 0xFF, actor); + for (s32 i = 0; i < ARRAY_SSIZE(i_this->mAtSphs); i++) { + i_this->mAtSphs[i].Set(at_sph_src); + i_this->mAtSphs[i].SetStts(&i_this->mStts); + } + i_this->mEyeSph.SetStts(&i_this->mStts); + i_this->mEyeSph.Set(eye_sph_src); + i_this->mFireSph.SetStts(&i_this->mStts); + i_this->mFireSph.Set(fire_sph_src); + for (s32 i = 0; i < ARRAY_SSIZE(i_this->mSibukiSphs); i++) { + i_this->mSibukiSphs[i].Set(sibuki_sph_src); + i_this->mSibukiSphs[i].SetStts(&i_this->mStts); + } + for (s32 i = 0; i < ARRAY_SSIZE(i_this->mHandCyls); i++) { + i_this->mHandCyls[i].Set(hand_cyl_src); + i_this->mHandCyls[i].SetStts(&i_this->mStts); + } + i_this->m02EC[0] = (s16)(l_HIO.m14 + cM_rndF(50.0f)); + dKy_efplight_set(&i_this->mLightInfluence); + actor->health = 10; + actor->max_health = 10; + if ((dComIfGs_isStageBossDemo()) || (dComIfGp_getStartStageName()[0] == 'X')) { + dComIfGs_offTmpBit(dSv_event_tmp_flag_c::UNK_0480); + i_this->m6E80 = -50.0f; + i_this->m6E84 = 0.0f; + if (dComIfGp_getStartStageName()[0] == 'X') { + mDoAud_bgmStart(JA_BGM_PAST_GOMA); + } else { + mDoAud_bgmStart(JA_BGM_GOMA); + } + i_this->m02EC[0] = (s16)((cM_rndF(50.0f) + 70.0f) + 100.0f); + fopAcM_OnStatus(actor, fopAcStts_SHOWMAP_e | fopAcStts_UNK4000_e); + } else { + i_this->m02E4 = 10; + i_this->m6E80 = -50.0f; + i_this->m6E84 = -30.0f; + i_this->m02EC[0] = REG0_S(4) + 0x96; + i_this->m6E7C = REG0_F(18) + 2300.0f; + fopAcM_OnStatus(actor, fopAcStts_SHOWMAP_e | fopAcStts_UNK4000_e); + } + i_this->m6E90 = 1; + if (dComIfGp_createMagma()) { + cXyz local_48(0.0f, -300.0f, 0.0f); + i_this->floor = dComIfGp_getMagma()->newFloor(local_48, actor->scale, fopAcM_GetRoomNo(actor), -0xFA); + JUT_ASSERT(DEMO_SELECT(6003, 6096), i_this->floor != NULL); + } + fopAcM_create(PROC_Ykgr, 0x10FF00, &actor->current.pos); + dKy_custom_timeset(l_HIO.m30); + return cPhs_COMPLEATE_e; } static actor_method_class l_daBtd_Method = { diff --git a/src/d/actor/d_a_bwd.cpp b/src/d/actor/d_a_bwd.cpp index 2fcd00069..80aa23109 100644 --- a/src/d/actor/d_a_bwd.cpp +++ b/src/d/actor/d_a_bwd.cpp @@ -115,7 +115,7 @@ void* ko_s_sub(void* param_1, void* param_2) { UNUSED(param_2); fopAc_ac_c* actor = (fopAc_ac_c*)param_1; - if ((fopAc_IsActor(actor)) && (fopAcM_GetName(actor) == PROC_BWDS)) { + if ((fopAcM_IsActor(actor)) && (fopAcM_GetName(actor) == PROC_BWDS)) { if (ko_count < l_HIO.m26) { ko_ac[ko_count] = actor; ko_count++; @@ -130,7 +130,7 @@ void* ko_delete_sub(void* param_1, void* param_2) { UNUSED(param_2); bwds_class* actor = (bwds_class*)param_1; - if ((fopAc_IsActor(actor)) && (fopAcM_GetName(actor) == PROC_BWDS)) { + if ((fopAcM_IsActor(actor)) && (fopAcM_GetName(actor) == PROC_BWDS)) { actor->m04F4 = 1; } return FALSE; @@ -138,16 +138,12 @@ void* ko_delete_sub(void* param_1, void* param_2) { /* 0000029C-000003C4 .text anm_init__FP9bwd_classifUcfi */ void anm_init(bwd_class* i_this, int bckFileIdx, f32 morf, u8 loopMode, f32 speed, int soundFileIdx) { - void* pSoundAnimRes; - J3DAnmTransform* pJVar1; - if (soundFileIdx >= 0) { - pSoundAnimRes = dComIfG_getObjectRes("Bwd", soundFileIdx); - pJVar1 = (J3DAnmTransform*)dComIfG_getObjectRes("Bwd", bckFileIdx); - i_this->m02C0->setAnm(pJVar1, loopMode, morf, speed, 0.0f, -1.0f, pSoundAnimRes); + i_this->mpHeadMorf->setAnm( + (J3DAnmTransform*)dComIfG_getObjectRes("Bwd", bckFileIdx), loopMode, morf, speed, 0.0f, -1.0f, dComIfG_getObjectRes("Bwd", soundFileIdx) + ); } else { - pJVar1 = (J3DAnmTransform*)dComIfG_getObjectRes("Bwd", bckFileIdx); - i_this->m02C0->setAnm(pJVar1, loopMode, morf, speed, 0.0f, -1.0f, NULL); + i_this->mpHeadMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Bwd", bckFileIdx), loopMode, morf, speed, 0.0f, -1.0f, NULL); } } @@ -159,8 +155,8 @@ void gr_draw(bwd_class* i_this) { g_env_light.settingTevStruct(TEV_TYPE_BG0, &local_18, &i_this->m1714); if (i_this->m1865 == 0) { dComIfGd_setListBG(); - g_env_light.setLightTevColorType(i_this->m1868, &i_this->m1714); - mDoExt_modelUpdateDL(i_this->m1868); + g_env_light.setLightTevColorType(i_this->mpTriforcePlatformModel, &i_this->m1714); + mDoExt_modelUpdateDL(i_this->mpTriforcePlatformModel); dComIfGd_setList(); } } @@ -180,8 +176,8 @@ void suna_draw(bwd_class* i_this) { /* 00000564-00000760 .text daBwd_Draw__FP9bwd_class */ static BOOL daBwd_Draw(bwd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - J3DModel* pJVar5; +#if VERSION > VERSION_DEMO if (i_this->m3C1C > 1) { mDoGph_gInf_c::setBlureRate(i_this->m3C1C); mDoGph_gInf_c::onBlure(); @@ -189,26 +185,27 @@ static BOOL daBwd_Draw(bwd_class* i_this) { i_this->m3C1C = 0; mDoGph_gInf_c::offBlure(); } - pJVar5 = i_this->m02C0->getModel(); +#endif + J3DModel* model = i_this->mpHeadMorf->getModel(); g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &actor->current.pos, &actor->tevStr); - g_env_light.setLightTevColorType(pJVar5, &actor->tevStr); - i_this->m02C4->entry(pJVar5->getModelData()); - i_this->m02C0->entryDL(); + g_env_light.setLightTevColorType(model, &actor->tevStr); + i_this->mpHeadBrkAnm->entry(model->getModelData()); + i_this->mpHeadMorf->entryDL(); if (i_this->m1BB6 < 2) { sita_s* psVar3; s32 i = 0; - for (psVar3 = i_this->m1908, i = 0; i < 0x1E; i++, psVar3++) { + for (psVar3 = i_this->mTongueSegments, i = 0; i < 0x1E; i++, psVar3++) { g_env_light.setLightTevColorType(psVar3->m00, &actor->tevStr); mDoExt_modelUpdateDL(psVar3->m00); } } if (i_this->m170C != 0) { - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m02D4); i++) { - if (i_this->m02D4[i] != NULL) { - pJVar5 = i_this->m02D4[i]; - g_env_light.setLightTevColorType(pJVar5, &actor->tevStr); - i_this->m0374[i]->entry(pJVar5->getModelData()); - mDoExt_modelUpdateDL(pJVar5); + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->mpBodyModel); i++) { + if (i_this->mpBodyModel[i] != NULL) { + model = i_this->mpBodyModel[i]; + g_env_light.setLightTevColorType(model, &actor->tevStr); + i_this->mpBodyMorf[i]->entry(model->getModelData()); + mDoExt_modelUpdateDL(model); } } } @@ -217,9 +214,9 @@ static BOOL daBwd_Draw(bwd_class* i_this) { suna_draw(i_this); for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m3B08); i++) { if (i_this->m3B08[i] != 0) { - i_this->m3B34[i]->entry(i_this->m3B24[i]->getModel()->getModelData()); - i_this->m3B2C[i]->entry(i_this->m3B24[i]->getModel()->getModelData()); - i_this->m3B24[i]->updateDL(); + i_this->mpGspBrkAnm[i]->entry(i_this->mpGspMorf[i]->getModel()->getModelData()); + i_this->mpGspBtkAnm[i]->entry(i_this->mpGspMorf[i]->getModel()->getModelData()); + i_this->mpGspMorf[i]->updateDL(); } } return TRUE; @@ -227,68 +224,66 @@ static BOOL daBwd_Draw(bwd_class* i_this) { /* 00000760-00000FBC .text fly_pos_move__FP9bwd_classss */ void fly_pos_move(bwd_class* i_this, s16 param_2, s16 param_3) { - /* Nonmatching - sVar1, target */ fopAc_ac_c* actor = &i_this->actor; - s16 sVar1; - f32 fVar2; - f32 fVar3; - s16 target; - int iVar4; - int iVar5; - s8 cVar6; - f32 dVar12; cXyz local_ec; cXyz cStack_f8; - fVar2 = i_this->m18B4.x - actor->current.pos.x; - dVar12 = (i_this->m18B4.y - actor->current.pos.y); - fVar3 = i_this->m18B4.z - actor->current.pos.z; - iVar4 = cM_atan2s(fVar2, fVar3); - fVar2 = std::sqrtf((fVar2 * fVar2) + (fVar3 * fVar3)); - iVar5 = cM_atan2s(dVar12, fVar2); - sVar1 = actor->current.angle.y; - cLib_addCalcAngleS2(&actor->current.angle.y, param_3 + iVar4, REG0_S(3) + 10, (i_this->m18C4 * i_this->m18C8)); - sVar1 = (sVar1 - actor->current.angle.y) * 0x20; - target = REG0_S(1) + 0x157c; - if (sVar1 > target) { - iVar4 = -target; - target = sVar1; - } else if (sVar1 < iVar4) { - target = iVar4; + f32 temp_f30 = i_this->m18B4.x - actor->current.pos.x; + f32 temp_f31 = i_this->m18B4.y - actor->current.pos.y; + f32 temp_f29 = i_this->m18B4.z - actor->current.pos.z; + s16 temp_r22 = param_3 + cM_atan2s(temp_f30, temp_f29); + f32 var_f2 = std::sqrtf(SQUARE(temp_f30) + SQUARE(temp_f29)); + s16 temp_r21 = param_2 - cM_atan2s(temp_f31, var_f2); + s16 temp_r23 = actor->current.angle.y; + cLib_addCalcAngleS2(&actor->current.angle.y, temp_r22, REG0_S(3) + 10, i_this->m18C4 * i_this->m18C8); + s16 var_r4 = (temp_r23 - actor->current.angle.y) * 0x20; + s16 temp_r0 = REG0_S(1) + 0x157c; + if (var_r4 > temp_r0) { + var_r4 = temp_r0; + } else { + s32 temp_r0_2 = -temp_r0; + if (var_r4 < temp_r0_2) { + var_r4 = temp_r0_2; + } } - cLib_addCalcAngleS2(&actor->current.angle.z, target, REG0_S(3) + 10, (i_this->m18C4 * i_this->m18C8 * 0.5f)); - cLib_addCalcAngleS2(&actor->current.angle.x, param_2 - iVar5, REG0_S(3) + 10, (i_this->m18C4 * i_this->m18C8)); + cLib_addCalcAngleS2(&actor->current.angle.z, var_r4, REG0_S(3) + 10, i_this->m18C4 * i_this->m18C8 * 0.5f); + cLib_addCalcAngleS2(&actor->current.angle.x, temp_r21, REG0_S(3) + 10, i_this->m18C4 * i_this->m18C8); cLib_addCalc2(&i_this->m18C8, 1.0f, 1.0f, 0.04); local_ec.x = 0.0f; local_ec.y = 0.0f; local_ec.z = actor->speedF; - mDoMtx_YrotS(*calc_mtx, actor->current.angle.y); - mDoMtx_XrotM(*calc_mtx, actor->current.angle.x); + cMtx_YrotS(*calc_mtx, actor->current.angle.y); + cMtx_XrotM(*calc_mtx, actor->current.angle.x); MtxPosition(&local_ec, &actor->speed); actor->current.pos.x = actor->current.pos.x + actor->speed.x; actor->current.pos.y = actor->current.pos.y + actor->speed.y; actor->current.pos.z = actor->current.pos.z + actor->speed.z; if (i_this->m18FC == 0) { - dBgS_LinChk local_e0; + dBgS_LinChk linChk; + s8 r21 = 0; local_ec.x = 0.0f; local_ec.y = 0.0f; local_ec.z = REG0_F(7) + 700.0f; MtxPosition(&local_ec, &cStack_f8); cStack_f8 += actor->current.pos; - local_e0.Set(&actor->current.pos, &cStack_f8, NULL); - cVar6 = dComIfG_Bgsp()->LineCross(&local_e0); - local_e0.Set(&cStack_f8, &actor->current.pos, NULL); - if (dComIfG_Bgsp()->LineCross(&local_e0)) { - cVar6 = 2; + linChk.Set(&actor->current.pos, &cStack_f8, NULL); + if (dComIfG_Bgsp()->LineCross(&linChk)) { + r21 = 1; } - if (cVar6 != 0) { + linChk.Set(&cStack_f8, &actor->current.pos, NULL); + if (dComIfG_Bgsp()->LineCross(&linChk)) { + r21 = 2; + } + if (r21 != 0) { i_this->m18FC = 0x1e; dComIfGp_getVibration().StartShock(REG0_S(2) + 7, -0x21, cXyz(0.0f, 1.0f, 0.0f)); +#if VERSION > VERSION_DEMO if (i_this->m3C1E != 0) { i_this->m3C1C = 0xb4; } - i_this->m3C4C = REG0_F(0x13) + 50.0f; - if ((cVar6 == 1) && (i_this->m3AE0[0] == 0)) { +#endif + i_this->m3C4C = REG0_F(19) + 50.0f; + if ((r21 == 1) && (i_this->m3AE0[0] == 0)) { i_this->m3954.x = actor->current.pos.x; i_this->m3954.z = actor->current.pos.z; i_this->m3C15 = 2; @@ -297,7 +292,9 @@ void fly_pos_move(bwd_class* i_this, s16 param_2, s16 param_3) { i_this->m17C4 = 199; i_this->m3B08[1] = 1; i_this->m3B0C[1] = i_this->m3954; - dComIfGp_particle_setToon(dPa_name::ID_IT_ST_BWO_DIVE_SMOKE00, &i_this->m3954, NULL, NULL, eff_col.a, &i_this->m3978[0], (s8)actor->current.roomNo); + dComIfGp_particle_setToon( + dPa_name::ID_IT_ST_BWO_DIVE_SMOKE00, &i_this->m3954, NULL, NULL, eff_col.a, &i_this->m3978[0], (s8)actor->current.roomNo + ); i_this->m3978[0].setColor(eff_col); dComIfGp_particle_set(dPa_name::ID_IT_SN_BWO_DIVE_SUNA00, &i_this->m3954, NULL, NULL, eff_col.a, &i_this->m3AB8[0], (s8)actor->current.roomNo); mDoAud_seStart(JA_SE_CM_BWD_IN_SAND_1, &i_this->m3954, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); @@ -310,7 +307,9 @@ void fly_pos_move(bwd_class* i_this, s16 param_2, s16 param_3) { ; i_this->m3C15 = 2; i_this->m3C14 = 0x5a; - dComIfGp_particle_setToon(dPa_name::ID_IT_ST_BWO_OUT_SMOKE00, &i_this->m3954, NULL, NULL, eff_col.a, &i_this->m3978[1], (s8)actor->current.roomNo); + dComIfGp_particle_setToon( + dPa_name::ID_IT_ST_BWO_OUT_SMOKE00, &i_this->m3954, NULL, NULL, eff_col.a, &i_this->m3978[1], (s8)actor->current.roomNo + ); i_this->m3978[1].setColor(eff_col); dComIfGp_particle_set(dPa_name::ID_IT_SN_BWO_OUT_SUNA00, &i_this->m3954, NULL, NULL, eff_col.a, &i_this->m3AB8[1], (s8)actor->current.roomNo); mDoAud_seStart(JA_SE_CM_BWD_OUT_SAND_1, &i_this->m3954, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); @@ -323,12 +322,10 @@ void fly_pos_move(bwd_class* i_this, s16 param_2, s16 param_3) { /* 000013F4-00001640 .text damage_check__FP9bwd_class */ void damage_check(bwd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - s8 sVar6; - cCcD_Obj* pcVar5; - CcAtInfo local_34; + CcAtInfo atInfo; if (i_this->m18D6 == 0) { - local_34.pParticlePos = NULL; + atInfo.pParticlePos = NULL; #if VERSION == VERSION_USA fopAc_ac_c* pfVar2 = fopAcM_SearchByID(i_this->m1BC0); if (pfVar2 != NULL) { @@ -336,39 +333,36 @@ void damage_check(bwd_class* i_this) { } #endif if (i_this->m1BB1 != 0) { - i_this->mCcD_Sph.SetTgType(~(AT_TYPE_WATER | AT_TYPE_UNK20000 | AT_TYPE_WIND | AT_TYPE_UNK400000 | AT_TYPE_LIGHT)); + i_this->mTongueSph.SetTgType(~(AT_TYPE_WATER | AT_TYPE_UNK20000 | AT_TYPE_WIND | AT_TYPE_UNK400000 | AT_TYPE_LIGHT)); } else { - i_this->mCcD_Sph.SetTgType(AT_TYPE_HOOKSHOT); + i_this->mTongueSph.SetTgType(AT_TYPE_HOOKSHOT); } - if (i_this->mCcD_Sph.ChkTgHit()) { + if (i_this->mTongueSph.ChkTgHit()) { i_this->m18D6 = 6; - local_34.mpObj = i_this->mCcD_Sph.GetTgHitObj(); - if (local_34.mpObj != NULL) { - local_34.pParticlePos = i_this->mCcD_Sph.GetTgHitPosP(); - if (local_34.mpObj->ChkAtType(AT_TYPE_HOOKSHOT)) { + atInfo.mpObj = i_this->mTongueSph.GetTgHitObj(); + if (atInfo.mpObj != NULL) { + atInfo.pParticlePos = i_this->mTongueSph.GetTgHitPosP(); + if (atInfo.mpObj->ChkAtType(AT_TYPE_HOOKSHOT)) { i_this->m1BB0 = 1; - local_34.mpActor = local_34.mpObj->GetAc(); - i_this->m1BBC = fopAcM_GetID(local_34.mpActor); + atInfo.mpActor = atInfo.mpObj->GetAc(); + i_this->m1BBC = fopAcM_GetID(atInfo.mpActor); i_this->m18AE = 3; i_this->m18B0 = 0; mDoAud_seStart(JA_SE_LK_HS_SPIKE, &actor->eyePos, 0x20, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); - } else { - if (i_this->m1BB1 != 0) { - sVar6 = actor->health; - actor->health = 0x14; - cc_at_check(actor, &local_34); - actor->health = sVar6 + -1; - fopAcM_monsSeStart(actor, JA_SE_CV_BWD_DAMAGE, 0); - i_this->m1BB4++; - i_this->m1BB3 = 0x14; - } + } else if (i_this->m1BB1 != 0) { + s8 sVar6 = actor->health; + actor->health = 0x14; + cc_at_check(actor, &atInfo); + actor->health = sVar6 + -1; + fopAcM_monsSeStart(actor, JA_SE_CV_BWD_DAMAGE, 0); + i_this->m1BB4++; + i_this->m1BB3 = 0x14; } } } for (s32 i = 0; i < 9; i++) { - if (i_this->mDamageSpheres[i].ChkTgHit()) { - pcVar5 = i_this->mDamageSpheres[i].GetTgHitObj(); - def_se_set(actor, pcVar5, 0x40); + if (i_this->mBodySph[i].ChkTgHit()) { + def_se_set(actor, i_this->mBodySph[i].GetTgHitObj(), 0x40); return; } } @@ -378,14 +372,12 @@ void damage_check(bwd_class* i_this) { /* 0000167C-000018E8 .text start__FP9bwd_class */ void start(bwd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - f32 fVar7; daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); switch (i_this->m18B0) { case 0: i_this->m17C4 = 0xC9; - fVar7 = player->current.pos.abs(); - if (fVar7 < 3200.0f) { + if (player->current.pos.abs() < 3200.0f) { i_this->m18B0 = 1; i_this->m18AC = 0; i_this->m3C1E = 0x32; @@ -402,7 +394,7 @@ void start(bwd_class* i_this) { i_this->m17D8 = REG0_S(4) + 500; } if (i_this->m18AC >= 0xDC) { - cLib_addCalc2(&i_this->m17E0, 900.0f, 0.1f, REG0_F(0xd) + 0.9f); + cLib_addCalc2(&i_this->m17E0, 900.0f, 0.1f, REG0_F(13) + 0.9f); } if (i_this->m18AC == 0x28f) { i_this->m1865 = 1; @@ -413,7 +405,7 @@ void start(bwd_class* i_this) { i_this->m18AE = 0xB; i_this->m18B0 = 0; actor->current.pos.x = 0.0f; - actor->current.pos.y = ((l_HIO.m28 + -2000.0f) - 200.0f) + REG0_F(0xb); + actor->current.pos.y = ((l_HIO.m28 + -2000.0f) - 200.0f) + REG0_F(11); actor->current.pos.z = 0.0f; i_this->m18CC[1] = 0x28; g_eff_on(i_this); @@ -479,7 +471,6 @@ void wait(bwd_class* i_this) { /* 00001AEC-00001CBC .text reset__FP9bwd_class */ void reset(bwd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - f32 fVar4; daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); switch (i_this->m18B0) { @@ -488,7 +479,7 @@ void reset(bwd_class* i_this) { i_this->m18CC[0] = 0x96; // fallthrough case 1: - cLib_addCalc2(&actor->current.pos.y, REG0_F(0x11) + -1500.0f + l_HIO.m28, 1.0f, 10.0f); + cLib_addCalc2(&actor->current.pos.y, REG0_F(17) + -1500.0f + l_HIO.m28, 1.0f, 10.0f); if (i_this->m18CC[0] == 100) { g_eff_off(i_this); } @@ -501,8 +492,7 @@ void reset(bwd_class* i_this) { actor->current.pos.y = l_HIO.m28 + -1500.0f; actor->current.pos.z = player->current.pos.z + cM_rndFX(300.0f); while (true) { - fVar4 = std::sqrtf(actor->current.pos.x * actor->current.pos.x + actor->current.pos.z * actor->current.pos.z); - if (fVar4 < REG0_F(0x12) + 3000.0f) { + if (std::sqrtf(SQUARE(actor->current.pos.x) + SQUARE(actor->current.pos.z)) < REG0_F(18) + 3000.0f) { break; } actor->current.pos.x *= 0.9f; @@ -516,17 +506,12 @@ void reset(bwd_class* i_this) { /* 00001CBC-000026A4 .text sita_hit__FP9bwd_class */ void sita_hit(bwd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - JPABaseEmitter* pJVar5; - int iVar6; - mDoExt_McaMorf* pmVar9; - int iVar11; - f32 fVar12; csXyz local_40; cXyz local_2c; cXyz local_38; daPy_py_c* player = daPy_getPlayerActorClass(); - iVar6 = (int)i_this->m02C0->getFrame(); + int frame = (int)i_this->mpHeadMorf->getFrame(); i_this->m17C4 = 200; switch (i_this->m18B0) { case 0: @@ -535,7 +520,7 @@ void sita_hit(bwd_class* i_this) { i_this->m1BAC = 1.0f; // fallthrough case 1: - if (!i_this->m02C0->isStop()) { + if (!i_this->mpHeadMorf->isStop()) { break; } anm_init(i_this, BWD_BCK_BWD_NUKARERU_LOOP, 1.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); @@ -552,25 +537,33 @@ void sita_hit(bwd_class* i_this) { break; } i_this->m1BB5++; - dComIfGp_particle_set(dPa_name::ID_AK_JN_CRITICALHITFLASH, &i_this->m1908[29].m04); + dComIfGp_particle_set(dPa_name::ID_AK_JN_CRITICALHITFLASH, &i_this->mTongueSegments[29].m04); local_38.z = 2.0f; local_38.y = 2.0f; local_38.x = 2.0f; local_40.z = 0; local_40.x = 0; local_40.y = fopAcM_searchPlayerAngleY(actor); - dComIfGp_particle_set(dPa_name::ID_AK_JN_OK, &i_this->m1908[29].m04, &local_40, &local_38); + dComIfGp_particle_set(dPa_name::ID_AK_JN_OK, &i_this->mTongueSegments[29].m04, &local_40, &local_38); if ((i_this->m1BB5 >= 4) || (l_HIO.m06 != 0)) { fopAcM_monsSeStart(actor, JA_SE_CV_BWD_LAST_HIT, 0); i_this->m18AE = 0xc; i_this->m18B0 = 0; i_this->m1BB2 = 0x32; - dScnPly_ply_c::nextPauseTimer = 8; +#if VERSION == VERSION_DEMO + dScnPly_ply_c::setPauseTimer(8); mDoAud_bgmStop(30); + mDoAud_bgmStreamPrepare(JA_STRM_BWD_CLEAR); +#else + dScnPly_ply_c::setPauseTimer(8); + mDoAud_bgmStop(30); +#endif i_this->m1710 = 0; break; } - dScnPly_ply_c::nextPauseTimer = 4; +#if VERSION > VERSION_DEMO + dScnPly_ply_c::setPauseTimer(4); +#endif anm_init(i_this, BWD_BCK_BWD_DAMAGE1, 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->m18B0++; i_this->m1BB1 = 0; @@ -579,7 +572,7 @@ void sita_hit(bwd_class* i_this) { fopAcM_monsSeStart(actor, JA_SE_CV_BWD_DAMAGE_L, 0); break; case 3: - if (!i_this->m02C0->isStop()) { + if (!i_this->mpHeadMorf->isStop()) { break; } anm_init(i_this, BWD_BCK_BWD_DAMAGE2, 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); @@ -588,8 +581,7 @@ void sita_hit(bwd_class* i_this) { i_this->m3954.x = actor->current.pos.x; i_this->m3954.z = actor->current.pos.z; dComIfGp_particle_set(dPa_name::ID_IT_SN_BWO_HIT_SUNA00, &i_this->m3954, &actor->shape_angle); - pJVar5 = dComIfGp_particle_set(dPa_name::ID_IT_SN_BWO_HIT_TAIEKI00, &i_this->m3954); - i_this->m3964 = pJVar5; + i_this->m3964 = dComIfGp_particle_set(dPa_name::ID_IT_SN_BWO_HIT_TAIEKI00, &i_this->m3954); dComIfGp_particle_set(dPa_name::ID_IT_SN_BWO_HITAFTER_HAKISUNA00, &i_this->m3954, &actor->shape_angle); dComIfGp_particle_set(dPa_name::ID_IT_SN_BWO_HITAFTER_SUNA00, &i_this->m3954, &actor->shape_angle); if (i_this->m3AE4 == 0) { @@ -603,29 +595,27 @@ void sita_hit(bwd_class* i_this) { } // fallthrough case 4: - pJVar5 = i_this->m3964; - if (pJVar5 != NULL) { - pmVar9 = i_this->m02C0; - if (pmVar9->isStop()) { - pJVar5->becomeInvalidEmitter(); + if (i_this->m3964 != NULL) { + if (i_this->mpHeadMorf->isStop()) { + i_this->m3964->becomeInvalidEmitter(); i_this->m3964 = NULL; } else { - pJVar5->setGlobalRTMatrix(pmVar9->getModel()->getAnmMtx(0xe)); + i_this->m3964->setGlobalRTMatrix(i_this->mpHeadMorf->getModel()->getAnmMtx(0xe)); } } i_this->m1BB6 = 1; - iVar11 = (int)i_this->m02C0->getFrame(); - if (iVar11 == 0x32) { + int r0 = (int)i_this->mpHeadMorf->getFrame(); + if (r0 == 0x32) { g_eff_off(i_this); } - if (iVar6 == 0x30) { + if (frame == 0x30) { mDoAud_seStart(JA_SE_CM_BWD_IN_SAND_3, &i_this->m3954, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } - if (((((iVar6 == 0x30) && (l_HIO.m24 >= 1)) || ((iVar6 == 0x31) && (l_HIO.m24 >= 2)) || (iVar6 == 0x32 && (l_HIO.m24 >= 3))) || - (iVar6 == 0x33 && (l_HIO.m24 >= 4))) && + if (((((frame == 0x30) && (l_HIO.m24 >= 1)) || ((frame == 0x31) && (l_HIO.m24 >= 2)) || (frame == 0x32 && (l_HIO.m24 >= 3))) || + (frame == 0x33 && (l_HIO.m24 >= 4))) && (ko_count < l_HIO.m26)) { - local_2c = i_this->m1908[0].m04; + local_2c = i_this->mTongueSegments[0].m04; local_2c.y = REG0_F(9) + -600.0f + l_HIO.m28; fopAcM_create(PROC_BWDS, 0x23, &local_2c, fopAcM_GetRoomNo(actor)); if (i_this->m1710 == 0) { @@ -641,14 +631,11 @@ void sita_hit(bwd_class* i_this) { if ((i_this->m1BB5 >= 2) || (l_HIO.m07 != 0)) { i_this->m18AE = 10; i_this->m18B0 = 0; - fVar12 = cM_rndFX(300.0f); - actor->current.pos.x = player->current.pos.x + fVar12; + actor->current.pos.x = player->current.pos.x + cM_rndFX(300.0f); actor->current.pos.y = l_HIO.m28 + -2000.0f; - fVar12 = cM_rndFX(300.0f); - actor->current.pos.z = player->current.pos.z + fVar12; + actor->current.pos.z = player->current.pos.z + cM_rndFX(300.0f); while (true) { - fVar12 = std::sqrtf(actor->current.pos.x * actor->current.pos.x + actor->current.pos.z * actor->current.pos.z); - if (fVar12 < REG0_F(0x12) + 3000.0f) { + if (std::sqrtf(SQUARE(actor->current.pos.x) + SQUARE(actor->current.pos.z)) < REG0_F(18) + 3000.0f) { break; } actor->current.pos.x *= 0.9f; @@ -664,14 +651,11 @@ void sita_hit(bwd_class* i_this) { i_this->m18B0 = 0; i_this->m18D0 = 0xde; i_this->m18CC[0] = 0x7a; - fVar12 = cM_rndFX(300.0f); - actor->current.pos.x = player->current.pos.x + fVar12; + actor->current.pos.x = player->current.pos.x + cM_rndFX(300.0f); actor->current.pos.y = l_HIO.m28 + -1500.0f; - fVar12 = cM_rndFX(300.0f); - actor->current.pos.z = player->current.pos.z + fVar12; + actor->current.pos.z = player->current.pos.z + cM_rndFX(300.0f); while (true) { - fVar12 = std::sqrtf(actor->current.pos.x * actor->current.pos.x + actor->current.pos.z * actor->current.pos.z); - if (fVar12 < REG0_F(0x12) + 3000.0f) { + if (std::sqrtf(SQUARE(actor->current.pos.x) + SQUARE(actor->current.pos.z)) < REG0_F(18) + 3000.0f) { break; } actor->current.pos.x *= 0.9f; @@ -686,22 +670,19 @@ void sita_hit(bwd_class* i_this) { /* 000026A4-00002F30 .text eat_attack__FP9bwd_class */ void eat_attack(bwd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - f32 fVar1; s8 bVar2; - s16 sVar6; - int iVar8; - s8 cVar10; cXyz local_38; daPy_py_c* player = daPy_getPlayerActorClass(); - cVar10 = 0; + s8 cVar10 = 0; i_this->m17C8 = actor->current.pos; i_this->m17C4 = 1; if ((i_this->m3C1E == 0) && (i_this->m1BB8 > 80.0f)) { - sVar6 = fopAcM_searchPlayerAngleY(actor); - cLib_addCalcAngleS2(&actor->current.angle.y, sVar6, 10, 0x800); + cLib_addCalcAngleS2(&actor->current.angle.y, fopAcM_searchPlayerAngleY(actor), 10, 0x800); } +#if VERSION > VERSION_DEMO i_this->m18D6 = 5; +#endif i_this->m1BB6 = 1; bVar2 = false; switch (i_this->m18B0) { @@ -714,9 +695,8 @@ void eat_attack(bwd_class* i_this) { mDoAud_seStart(JA_SE_CV_BWD_ATTACK, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); break; case 1: - fVar1 = i_this->m02C0->getFrame(); - if (fVar1 >= 27.0f) { - if (((int)fVar1 == 0x1b) && (i_this->m3AE6 == 0)) { + if (i_this->mpHeadMorf->getFrame() >= 27.0f) { + if (((int)i_this->mpHeadMorf->getFrame() == 0x1b) && (i_this->m3AE6 == 0)) { i_this->m3AE6 = REG0_S(4) + 10; i_this->m3978[3].remove(); i_this->m3954.x = actor->current.pos.x; @@ -727,7 +707,7 @@ void eat_attack(bwd_class* i_this) { i_this->m3978[3].setColor(eff_col); } for (s32 i = 0; i < 9; i++) { - if (i_this->mDamageSpheres[i].ChkAtHit()) { + if (i_this->mBodySph[i].ChkAtHit()) { bVar2 = true; break; } @@ -756,7 +736,7 @@ void eat_attack(bwd_class* i_this) { } mDoAud_seStart(JA_SE_CM_BWD_MOUTH_CLOSE_2, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } else { - if (i_this->m02C0->isStop()) { + if (i_this->mpHeadMorf->isStop()) { anm_init(i_this, BWD_BCK_BWD_ATTACK_SHIPPAI, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); mDoAud_seStart(JA_SE_CM_BWD_MOUTH_CLOSE_2, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); i_this->m18B0++; @@ -764,7 +744,7 @@ void eat_attack(bwd_class* i_this) { } break; case 2: - if (i_this->m02C0->isStop()) { + if (i_this->mpHeadMorf->isStop()) { cVar10 = 1; } break; @@ -773,20 +753,19 @@ void eat_attack(bwd_class* i_this) { case 4: break; case 5: - if ((int)i_this->m02C0->getFrame() == 10) { + if ((int)i_this->mpHeadMorf->getFrame() == 10) { mDoAud_seStart(JA_SE_CM_BWD_HEAD_BACK_1, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } - if ((int)i_this->m02C0->getFrame() == 30) { + if ((int)i_this->mpHeadMorf->getFrame() == 30) { mDoAud_seStart(JA_SE_CM_BWD_IN_SAND_2, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } - if ((int)i_this->m02C0->getFrame() == 50) { + if ((int)i_this->mpHeadMorf->getFrame() == 50) { g_eff_off(i_this); } if (i_this->m18CC[0] == 0x3c) { - local_38 = i_this->m1908[0].m04; + local_38 = i_this->mTongueSegments[0].m04; local_38.y = i_this->m3954.y + REG0_F(9); - iVar8 = player->setThrowDamage(&local_38, actor->shape_angle.y, (REG0_F(7) + 60.0f), (REG0_F(8) + 130.0f), 0); - if (iVar8 == 1) { + if (player->setThrowDamage(&local_38, actor->shape_angle.y, REG0_F(7) + 60.0f, REG0_F(8) + 130.0f, 0) == 1) { i_this->m3C1E++; i_this->m3C20 = 0; if (i_this->m3AEA == 0) { @@ -794,13 +773,15 @@ void eat_attack(bwd_class* i_this) { i_this->m3978[5].remove(); i_this->m3954.x = actor->current.pos.x; i_this->m3954.z = actor->current.pos.z; - dComIfGp_particle_setToon(dPa_name::ID_IT_ST_BWK_OUT_SMOKE00, &i_this->m3954, NULL, NULL, eff_col.a, &i_this->m3978[5], (s8)actor->current.roomNo); + dComIfGp_particle_setToon( + dPa_name::ID_IT_ST_BWK_OUT_SMOKE00, &i_this->m3954, NULL, NULL, eff_col.a, &i_this->m3978[5], (s8)actor->current.roomNo + ); i_this->m3978[5].setColor(eff_col); } dComIfGp_particle_set(dPa_name::ID_IT_SN_BWK_OUT_SUNA00, &player->current.pos); mDoAud_seStart(JA_SE_CM_BWD_SPIT_OUT, &i_this->m3954, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } else { - local_38 = i_this->m1908[0].m04; + local_38 = i_this->mTongueSegments[0].m04; local_38.y = REG0_F(9) + -450.0f + l_HIO.m28; player->setPlayerPosAndAngle(&local_38, player->shape_angle.y); i_this->m3C1E = 0x96; @@ -844,7 +825,7 @@ void fly(bwd_class* i_this) { i_this->m18B4.y = l_HIO.m28 + (cM_rndFX(800.0f) + 2000.0f); i_this->m18B4.z = actor->current.pos.z; actor->current.angle.x = -0x4000; - i_this->m18CC[1] = REG0_F(0x12) + (cM_rndF(50.0f) + 200.0f); + i_this->m18CC[1] = REG0_F(18) + (cM_rndF(50.0f) + 200.0f); i_this->m1904 = REG0_S(0) + 5; i_this->m18D0 = REG0_S(4) + 0xb4; } else { @@ -854,10 +835,10 @@ void fly(bwd_class* i_this) { } case 1: mDoAud_seStart(JA_SE_CM_BWD_FLYING, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); - if ((int)i_this->m02C0->getFrame() == 2) { + if ((int)i_this->mpHeadMorf->getFrame() == 2) { mDoAud_seStart(JA_SE_CM_BWD_MOUTH_CLOSE_1, &actor->current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } - if ((int)i_this->m02C0->getFrame() == 0x14) { + if ((int)i_this->mpHeadMorf->getFrame() == 0x14) { mDoAud_seStart(JA_SE_CV_BWD_FLYING, &actor->current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } if (i_this->m18D0 == 0x50) { @@ -872,15 +853,15 @@ void fly(bwd_class* i_this) { } } local_48 = i_this->m18B4 - actor->current.pos; - if ((local_48.abs() < REG0_F(0xe) + 500.0f) || (i_this->m18CC[0] == 0)) { + if ((local_48.abs() < REG0_F(14) + 500.0f) || (i_this->m18CC[0] == 0)) { i_this->m18CC[0] = 100; - i_this->m18B4.x = cM_rndFX(REG0_F(0x10) + 1500.0f); - i_this->m18B4.y = l_HIO.m28 + (REG0_F(0xf) + 2000.0f + cM_rndFX(800.0f)); - i_this->m18B4.z = cM_rndFX(REG0_F(0x10) + 1500.0f); + i_this->m18B4.x = cM_rndFX(REG0_F(16) + 1500.0f); + i_this->m18B4.y = l_HIO.m28 + (REG0_F(15) + 2000.0f + cM_rndFX(800.0f)); + i_this->m18B4.z = cM_rndFX(REG0_F(16) + 1500.0f); i_this->m18C8 = 0.0f; } - i_this->m18C4 = REG0_F(0x12) + 500.0f; - actor->speedF = REG0_F(0x11) + 40.0f; + i_this->m18C4 = REG0_F(18) + 500.0f; + actor->speedF = REG0_F(17) + 40.0f; if (i_this->m18CC[1] == 0) { i_this->m18B0 = 2; i_this->m18CC[0] = 0x96; @@ -890,29 +871,29 @@ void fly(bwd_class* i_this) { break; case 2: mDoAud_seStart(JA_SE_CM_BWD_FLYING, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); - if (i_this->m02C0->isStop()) { + if (i_this->mpHeadMorf->isStop()) { anm_init(i_this, BWD_BCK_BWD_JATTACK2, 2.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); } i_this->m18B4 = player->eyePos; local_48 = i_this->m18B4 - actor->current.pos; - if ((local_48.abs() < REG0_F(0xe) + 1000.0f) || (i_this->m18CC[0] == 0)) { + if ((local_48.abs() < REG0_F(14) + 1000.0f) || (i_this->m18CC[0] == 0)) { i_this->m18B0 = 3; i_this->m18B4.y -= 10000.0f; i_this->m18CC[0] = 200; anm_init(i_this, BWD_BCK_BWD_JATTACK3, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); } - cLib_addCalc2(&i_this->m18C4, REG0_F(0xf) + 800.0f, 1.0f, 10.0f); + cLib_addCalc2(&i_this->m18C4, REG0_F(15) + 800.0f, 1.0f, 10.0f); break; case 3: mDoAud_seStart(JA_SE_CM_BWD_FLYING, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); - cLib_addCalc2(&i_this->m18C4, REG0_F(0xc) + 1200.0f, 1.0f, 20.0f); + cLib_addCalc2(&i_this->m18C4, REG0_F(12) + 1200.0f, 1.0f, 20.0f); if (i_this->m18CC[0] == 0) { i_this->m18AE = 1; i_this->m18B0 = 0; i_this->m18CC[0] = 0x7a; i_this->m18D0 = 0xde; dVar7 = cM_rndFX(1500.0f); - dVar8 = (REG0_F(0x11) + -1500.0f + l_HIO.m28); + dVar8 = (REG0_F(17) + -1500.0f + l_HIO.m28); fVar9 = cM_rndFX(1500.0f); actor->current.pos.x = fVar9; actor->current.pos.y = dVar8; @@ -952,10 +933,10 @@ void s_fly(bwd_class* i_this) { } case 1: mDoAud_seStart(JA_SE_CM_BWD_FLYING, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); - if ((int)i_this->m02C0->getFrame() == 2) { + if ((int)i_this->mpHeadMorf->getFrame() == 2) { mDoAud_seStart(JA_SE_CM_BWD_MOUTH_CLOSE_1, &actor->current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } - if ((int)i_this->m02C0->getFrame() == 20) { + if ((int)i_this->mpHeadMorf->getFrame() == 20) { mDoAud_seStart(JA_SE_CV_BWD_FLYING, &actor->current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } if (i_this->m18D0 == 0x50) { @@ -970,7 +951,7 @@ void s_fly(bwd_class* i_this) { } } local_28 = i_this->m18B4 - actor->current.pos; - if (local_28.abs() < REG0_F(0xe) + 500.0f) { + if (local_28.abs() < REG0_F(14) + 500.0f) { if (i_this->m3C24 == 3) { i_this->m18B0 = 2; i_this->m18CC[0] = 0x96; @@ -984,35 +965,35 @@ void s_fly(bwd_class* i_this) { i_this->m3C24++; } } - i_this->m18C4 = REG0_F(0x12) + 500.0f; - actor->speedF = REG0_F(0x11) + 40.0f; + i_this->m18C4 = REG0_F(18) + 500.0f; + actor->speedF = REG0_F(17) + 40.0f; break; case 2: mDoAud_seStart(JA_SE_CM_BWD_FLYING, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); - if (i_this->m02C0->isStop()) { + if (i_this->mpHeadMorf->isStop()) { anm_init(i_this, BWD_BCK_BWD_JATTACK2, 2.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); } i_this->m18B4.x = 0.0f; i_this->m18B4.y = 800.0f; i_this->m18B4.z = 0.0f; local_28 = i_this->m18B4 - actor->current.pos; - if (local_28.abs() < REG0_F(0xe) + 1000.0f) { + if (local_28.abs() < REG0_F(14) + 1000.0f) { i_this->m18B0 = 3; i_this->m18B4.y -= 10000.0f; i_this->m18CC[0] = 200; anm_init(i_this, BWD_BCK_BWD_JATTACK3, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); } - cLib_addCalc2(&i_this->m18C4, REG0_F(0xf) + 800.0f, 1.0f, 10.0f); + cLib_addCalc2(&i_this->m18C4, REG0_F(15) + 800.0f, 1.0f, 10.0f); break; case 3: mDoAud_seStart(JA_SE_CM_BWD_FLYING, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); - cLib_addCalc2(&i_this->m18C4, REG0_F(0xc) + 1200.0f, 1.0f, 20.0f); + cLib_addCalc2(&i_this->m18C4, REG0_F(12) + 1200.0f, 1.0f, 20.0f); if (i_this->m18CC[0] == 0) { i_this->m18AE = 1; i_this->m18B0 = 0; i_this->m18CC[0] = 0xac; i_this->m18D0 = 0x12e; - fVar6 = REG0_F(0x11) + -1500.0f + l_HIO.m28; + fVar6 = REG0_F(17) + -1500.0f + l_HIO.m28; actor->current.pos.x = 0.0f; actor->current.pos.y = fVar6; actor->current.pos.z = 0.0f; @@ -1028,8 +1009,6 @@ void s_fly(bwd_class* i_this) { void end(bwd_class* i_this) { fopAc_ac_c* actor = &i_this->actor; bool bVar2; - mDoExt_McaMorf* pmVar7; - JPABaseEmitter* pJVar8; s16 uVar9; s16 uVar10; f32 fVar13; @@ -1037,12 +1016,12 @@ void end(bwd_class* i_this) { cXyz local_c0; bVar2 = true; - dBgS_GndChk local_a8; + dBgS_GndChk gndChk; Vec pos; pos = actor->current.pos; - pos.y += REG0_F(0xd) + 1000.0f; - local_a8.SetPos(&pos); - fVar13 = dComIfG_Bgsp()->GroundCross(&local_a8); + pos.y += REG0_F(13) + 1000.0f; + gndChk.SetPos(&pos); + fVar13 = dComIfG_Bgsp()->GroundCross(&gndChk); if (fVar13 != -G_CM3D_F_INF) { i_this->m18DC = fVar13; } @@ -1057,7 +1036,7 @@ void end(bwd_class* i_this) { dComIfGs_onTmpBit(dSv_event_tmp_flag_c::UNK_0480); return; } -#if VERSION != VERSION_USA +#if VERSION != VERSION_DEMO && VERSION != VERSION_USA mDoAud_bgmStreamPrepare(JA_STRM_BWD_CLEAR); #endif anm_init(i_this, BWD_BCK_BWD_DEAD1, 3.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); @@ -1076,30 +1055,27 @@ void end(bwd_class* i_this) { i_this->m3978[6].setColor(eff_col); } dComIfGp_particle_set(dPa_name::ID_IT_SN_BWO_LASTHIT_SUNA00, &i_this->m3954, &actor->shape_angle); - pJVar8 = dComIfGp_particle_set(dPa_name::ID_IT_SN_BWO_LASTHIT_TAIEKI00, &i_this->m3954); - i_this->m3968 = pJVar8; + i_this->m3968 = dComIfGp_particle_set(dPa_name::ID_IT_SN_BWO_LASTHIT_TAIEKI00, &i_this->m3954); i_this->m3C24 = 0; mDoAud_seStart(JA_SE_CM_BWD_LAST_HEAD_BACK, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); case 1: - pJVar8 = i_this->m3968; - if (pJVar8 != NULL) { - pmVar7 = i_this->m02C0; - if (i_this->m02C0->isStop()) { - pJVar8->becomeInvalidEmitter(); + if (i_this->m3968 != NULL) { + if (i_this->mpHeadMorf->isStop()) { + i_this->m3968->becomeInvalidEmitter(); i_this->m3968 = NULL; } else { - pJVar8->setGlobalRTMatrix(pmVar7->getModel()->getAnmMtx(0xe)); + i_this->m3968->setGlobalRTMatrix(i_this->mpHeadMorf->getModel()->getAnmMtx(0xe)); } } - if ((int)i_this->m02C0->getFrame() == 30) { + if ((int)i_this->mpHeadMorf->getFrame() == 30) { mDoAud_seStart(JA_SE_CM_BWD_LAST_IN_SAND, &i_this->m3954, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } - if ((int)i_this->m02C0->getFrame() == 50) { + if ((int)i_this->mpHeadMorf->getFrame() == 50) { g_eff_off(i_this); } bVar2 = false; i_this->m1BB6 = 1; - if (i_this->m02C0->isStop()) { + if (i_this->mpHeadMorf->isStop()) { #if VERSION == VERSION_USA mDoAud_bgmStreamPrepare(JA_STRM_BWD_CLEAR); #endif @@ -1121,14 +1097,14 @@ void end(bwd_class* i_this) { i_this->m1BB6 = 2; local_b4 = i_this->m18B4 - actor->current.pos; fVar13 = local_b4.abs(); - if ((fVar13 < REG0_F(0xe) + 500.0f) || (i_this->m18CC[0] == 0)) { + if ((fVar13 < REG0_F(14) + 500.0f) || (i_this->m18CC[0] == 0)) { i_this->m18CC[0] = (s16)(int)cM_rndF(20.0f); - i_this->m18B4.x = cM_rndFX(REG0_F(0x10) + 1600.0f); - i_this->m18B4.y = l_HIO.m28 + (REG0_F(0xf) + 2000.0f + cM_rndFX(500.0f)); - i_this->m18B4.z = cM_rndFX(REG0_F(0x10) + 1600.0f); + i_this->m18B4.x = cM_rndFX(REG0_F(16) + 1600.0f); + i_this->m18B4.y = l_HIO.m28 + (REG0_F(15) + 2000.0f + cM_rndFX(500.0f)); + i_this->m18B4.z = cM_rndFX(REG0_F(16) + 1600.0f); } - i_this->m18C4 = REG0_F(0x12) + 1000.0f; - actor->speedF = REG0_F(0x11) + 65.0f; + i_this->m18C4 = REG0_F(18) + 1000.0f; + actor->speedF = REG0_F(17) + 65.0f; if (i_this->m3C20 == 0x96) { mDoAud_seStart(JA_SE_CV_BWD_DIE, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } @@ -1149,8 +1125,8 @@ void end(bwd_class* i_this) { } i_this->m18FE += REG0_S(5) + 0xc1c; i_this->m1900 += REG0_S(5) + 0xdac; - uVar9 = ((REG0_F(0xd) + 7000.0f) * cM_ssin(i_this->m18FE)); - uVar10 = ((REG0_F(0xd) + 7000.0f) * cM_scos(i_this->m1900)); + uVar9 = ((REG0_F(13) + 7000.0f) * cM_ssin(i_this->m18FE)); + uVar10 = ((REG0_F(13) + 7000.0f) * cM_scos(i_this->m1900)); break; case 23: i_this->m1BB6 = 2; @@ -1158,11 +1134,11 @@ void end(bwd_class* i_this) { anm_init(i_this, BWD_BCK_BWD_DEAD3, 3.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->m02C8 = 1.0f; } - if (((i_this->m18CC[0] == 0) && ((i_this->m18AC & 3U) == 0)) && (i_this->m0414 < 0x14)) { + if (((i_this->m18CC[0] == 0) && ((i_this->m18AC & 3) == 0)) && (i_this->m0414 < 0x14)) { i_this->m03C4[i_this->m0414] = 1.0f; i_this->m0414++; } - if (((i_this->m18CC[1] == 0) && ((i_this->m18AC & 3U) == 0)) && (i_this->m3C24 < 0x14)) { + if (((i_this->m18CC[1] == 0) && ((i_this->m18AC & 3) == 0)) && (i_this->m3C24 < 0x14)) { if (i_this->m3C24 == 0x13) { i_this->m18B0 = 3; i_this->m18CC[0] = 0; @@ -1185,7 +1161,7 @@ void end(bwd_class* i_this) { dComIfGp_particle_set(dPa_name::ID_IT_SN_BWO_SIBOUBAKUEN00, i_this->m0418 + i_this->m3C24, &local_d4, &local_c0); dComIfGp_particle_set(dPa_name::ID_IT_SN_BWO_SIBOUSUNA00, i_this->m0418 + i_this->m3C24, &local_d4, &local_c0); mDoAud_seStart(JA_SE_CM_MONS_EXPLODE, i_this->m0418 + i_this->m3C24, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); - i_this->m02D4[i_this->m3C24] = NULL; + i_this->mpBodyModel[i_this->m3C24] = NULL; if (i_this->m3C24 == 0) { i_this->m18B0 = 4; i_this->m18CC[0] = 10; @@ -1228,15 +1204,13 @@ void control1(bwd_class* i_this) { cXyz local_11c; cXyz local_128; - MTXCopy(i_this->m02C0->getModel()->getAnmMtx(0x1d), *calc_mtx); - local_104.x = REG0_F(2) + -50.0f; - local_104.y = REG0_F(3); - local_104.z = REG0_F(4); - MtxPosition(&local_104, &i_this->m1908[0].m04); + MTXCopy(i_this->mpHeadMorf->getModel()->getAnmMtx(0x1d), *calc_mtx); + local_104.set(REG0_F(2) + -50.0f, REG0_F(3), REG0_F(4)); + MtxPosition(&local_104, &i_this->mTongueSegments[0].m04); s32 i = 1; - sita_s* psVar5 = &i_this->m1908[i]; - mDoMtx_YrotS(*calc_mtx, (int)actor->current.angle.y); - mDoMtx_XrotM(*calc_mtx, actor->current.angle.x); + sita_s* sita_i = &i_this->mTongueSegments[1]; + cMtx_YrotS(*calc_mtx, actor->current.angle.y); + cMtx_XrotM(*calc_mtx, actor->current.angle.x); local_104.x = 0.0f; local_104.y = 0.0f; local_104.z = i_this->m1BA4; @@ -1244,8 +1218,8 @@ void control1(bwd_class* i_this) { local_104.z = i_this->m1BA0; f32 dVar9 = i_this->m1BA8; local_128.setall(0.0f); - dBgS_GndChk local_f8; - for (i = 1; i < 0x1d; i++, ++psVar5) { + dBgS_GndChk gndChk; + for (i = 1; i < 0x1d; i++, ++sita_i) { if (i_this->m1BB0 == 0) { if (i_this->m1BB3 != 0) { dVar9 = i_this->m1BB3 * (REG0_F(3) + 4.5f); @@ -1263,29 +1237,29 @@ void control1(bwd_class* i_this) { } MtxPosition(&local_110, &local_128); } - dVar10 = (local_128.y + (psVar5->m04.y + local_11c.y)); + dVar10 = (local_128.y + (sita_i->m04.y + local_11c.y)); if (local_110.y < 0.0f) { Vec pos; - pos = psVar5->m04; + pos = sita_i->m04; pos.y += 200.0f; - local_f8.SetPos(&pos); - dVar8 = (REG0_F(0x10) + dComIfG_Bgsp()->GroundCross(&local_f8) + 30.0f); + gndChk.SetPos(&pos); + dVar8 = (REG0_F(16) + dComIfG_Bgsp()->GroundCross(&gndChk) + 30.0f); if (dVar10 <= dVar8) { dVar10 = dVar8; } } - f32 x = local_128.x + (local_11c.x + (psVar5->m04.x - psVar5[-1].m04.x)); - f32 y = (dVar10 - psVar5[-1].m04.y); - f32 z = local_128.z + (local_11c.z + (psVar5->m04.z - psVar5[-1].m04.z)); + f32 x = local_128.x + (local_11c.x + (sita_i->m04.x - sita_i[-1].m04.x)); + f32 y = (dVar10 - sita_i[-1].m04.y); + f32 z = local_128.z + (local_11c.z + (sita_i->m04.z - sita_i[-1].m04.z)); s16 iVar3; int iVar2 = cM_atan2s(x, z); iVar3 = -cM_atan2s(y, std::sqrtf((x * x) + (z * z))); MtxPush(); - mDoMtx_YrotS(*calc_mtx, iVar2); - mDoMtx_XrotM(*calc_mtx, iVar3); + cMtx_YrotS(*calc_mtx, iVar2); + cMtx_XrotM(*calc_mtx, iVar3); MtxPosition(&local_104, &local_110); MtxPull(); - psVar5->m04 = psVar5[-1].m04 + local_110; + sita_i->m04 = sita_i[-1].m04 + local_110; } } @@ -1295,20 +1269,20 @@ void control2(bwd_class* i_this) { rel_offset.x = 0; rel_offset.y = 0; rel_offset.z = i_this->m1BA0; - i_this->m1908[29].m04 = i_this->m1B88; + i_this->mTongueSegments[29].m04 = i_this->m1B88; int i = 28; s16 Yangle; int XZangle; - sita_s* sita_i = &i_this->m1908[i]; + sita_s* sita_i = &i_this->mTongueSegments[28]; for (i = 28; i >= 1; i--, sita_i--) { f32 delta_pos_x = sita_i->m04.x - sita_i[1].m04.x; f32 delta_pos_y = sita_i->m04.y - sita_i[1].m04.y; f32 delta_pos_z = sita_i->m04.z - sita_i[1].m04.z; XZangle = cM_atan2s(delta_pos_x, delta_pos_z); Yangle = -cM_atan2s(delta_pos_y, std::sqrtf(delta_pos_x * delta_pos_x + delta_pos_z * delta_pos_z)); - mDoMtx_YrotS(*calc_mtx, XZangle); - mDoMtx_XrotM(*calc_mtx, Yangle); + cMtx_YrotS(*calc_mtx, XZangle); + cMtx_XrotM(*calc_mtx, Yangle); MtxPosition(&rel_offset, &abs_offset); sita_i->m04 = sita_i[1].m04 + abs_offset; } @@ -1329,10 +1303,10 @@ void sita_move(bwd_class* i_this) { if (i_this->m1BB3 != 0) { i_this->m1BB3--; } - local_c8.x = (REG0_F(0xd) + 100.0f) * cM_ssin(i_this->m18AC * (REG0_S(5) + 0x44c)); - local_c8.y = REG0_F(0) + 600.0f + (REG0_F(0xe) + 50.0f) * cM_ssin(i_this->m18AC * (REG0_S(4) + 700)); - local_c8.z = (REG0_F(0xd) + 100.0f) * cM_ssin(i_this->m18AC * (REG0_S(7) + 900)); - local_f8 = i_this->m1908[0].m04 + local_c8; + local_c8.x = (REG0_F(13) + 100.0f) * cM_ssin(i_this->m18AC * (REG0_S(5) + 0x44c)); + local_c8.y = REG0_F(0) + 600.0f + (REG0_F(14) + 50.0f) * cM_ssin(i_this->m18AC * (REG0_S(4) + 700)); + local_c8.z = (REG0_F(13) + 100.0f) * cM_ssin(i_this->m18AC * (REG0_S(7) + 900)); + local_f8 = i_this->mTongueSegments[0].m04 + local_c8; if (i_this->m1B88.y < i_this->m3954.y) { fopAcM_OffStatus(actor, 0); actor->attention_info.flags = 0; @@ -1358,14 +1332,14 @@ void sita_move(bwd_class* i_this) { } else { if (i_this->m1BB1 != 0) { i_this->m1BB1--; - dBgS_GndChk local_bc; + dBgS_GndChk gndChk; Vec pos; pos = i_this->m1B88; pos.y += 200.0f; - local_bc.SetPos(&pos); - fVar10 = REG0_F(0x10) + dComIfG_Bgsp()->GroundCross(&local_bc) + 30.0f; + gndChk.SetPos(&pos); + fVar10 = REG0_F(16) + dComIfG_Bgsp()->GroundCross(&gndChk) + 30.0f; if (fVar10 != -G_CM3D_F_INF) { - cLib_addCalc2(&i_this->m1B88.y, fVar10, 0.1f, REG0_F(0xb) + 2.0f); + cLib_addCalc2(&i_this->m1B88.y, fVar10, 0.1f, REG0_F(11) + 2.0f); } if (i_this->m1BB3 != 0) { f32 f1 = i_this->m1BB3 * (REG0_F(3) + 3.0f); @@ -1383,19 +1357,19 @@ void sita_move(bwd_class* i_this) { } if (i_this->m1BB2 != 0) { i_this->m1BB2--; - local_c8.x = (REG0_F(0x11) + 400.0f) * cM_ssin((int)i_this->m18AC * (REG0_S(5) + 0xc1c)); + local_c8.x = (REG0_F(17) + 400.0f) * cM_ssin((int)i_this->m18AC * (REG0_S(5) + 0xc1c)); local_c8.y = 400.0f; - local_c8.z = (REG0_F(0x11) + 400.0f) * cM_ssin((int)i_this->m18AC * (REG0_S(7) + 0x1324)); - local_f8 = i_this->m1908[0].m04 + local_c8; + local_c8.z = (REG0_F(17) + 400.0f) * cM_ssin((int)i_this->m18AC * (REG0_S(7) + 0x1324)); + local_f8 = i_this->mTongueSegments[0].m04 + local_c8; dVar8 = 1.0f; dVar9 = 200.0f; } } - local_c8 = i_this->m1B88 - i_this->m1908[0].m04; + local_c8 = i_this->m1B88 - i_this->mTongueSegments[0].m04; fVar10 = local_c8.abs(); dVar7 = ((REG0_F(2) + 0.035f) * fVar10); if (i_this->m1BB6 != 0) { - local_f8 = i_this->m1908[0].m04; + local_f8 = i_this->mTongueSegments[0].m04; dVar8 = 1.0f; dVar9 = 50.0f; if (i_this->m1BB6 != 2) { @@ -1413,21 +1387,22 @@ void sita_move(bwd_class* i_this) { i_this->m1BA8 = REG0_F(3) + 10.0f; control1(i_this); control2(i_this); - sita_s* psVar5 = i_this->m1908; - for (s32 i = 0; i < 30; i++, ++psVar5) { - MtxTrans(psVar5->m04.x, psVar5->m04.y, psVar5->m04.z, false); + sita_s* sita_i = i_this->mTongueSegments; + for (s32 i = 0; i < 30; i++, ++sita_i) { + MtxTrans(sita_i->m04.x, sita_i->m04.y, sita_i->m04.z, false); fVar10 = (1.0f + REG0_F(9)) + (0.2f + REG0_F(9)) * cM_scos((int)i_this->m18AC * (REG0_S(7) + 1000) + i * (REG0_S(8) + 2000)); MtxScale(fVar10, fVar10, fVar10, true); - psVar5->m00->setBaseTRMtx(*calc_mtx); + sita_i->m00->setBaseTRMtx(*calc_mtx); if (i == 29) { - actor->eyePos = psVar5->m04; + actor->eyePos = sita_i->m04; actor->attention_info.position = actor->eyePos; actor->attention_info.position.y += 20.0f; - i_this->mCcD_Sph.SetC(psVar5->m04); - dComIfG_Ccsp()->Set(&i_this->mCcD_Sph); + i_this->mTongueSph.SetC(sita_i->m04); + dComIfG_Ccsp()->Set(&i_this->mTongueSph); } else if ((((i == 0) || (i == 6)) || (i == 12)) || (i == 18 || (i == 24))) { - i_this->mCcD_Sph_Array5[i / 6].SetC(psVar5->m04); - dComIfG_Ccsp()->Set(&i_this->mCcD_Sph_Array5[i / 6]); + s32 r0 = i / 6; + i_this->mTongueCoSph[r0].SetC(sita_i->m04); + dComIfG_Ccsp()->Set(&i_this->mTongueCoSph[r0]); } } } @@ -1467,7 +1442,6 @@ void move(bwd_class* i_this) { /* 00005DFC-00007320 .text demo_camera__FP9bwd_class */ void demo_camera(bwd_class* i_this) { - /* Nonmatching - regalloc */ fopAc_ac_c* actor = &i_this->actor; f32 fVar1; f32 fVar2; @@ -1502,14 +1476,16 @@ void demo_camera(bwd_class* i_this) { i_this->m3C22 = 0; i_this->m3C48 = 55.0f; i_this->m3C44 = 0.0f; +#if VERSION > VERSION_DEMO i_this->m3C1C = 0x96; +#endif // fallthrough case 2: local_98.x = 0.0f; local_98.y = 5000.0f; local_98.z = 0.0f; player2->setPlayerPosAndAngle(&local_98, (int)player->shape_angle.y); - mDoMtx_YrotS(*calc_mtx, (int)actor->shape_angle.y); + cMtx_YrotS(*calc_mtx, actor->shape_angle.y); local_98.x = 0.0f; local_98.y = REG0_F(6) + 500.0f; local_98.z = REG0_F(7) + 1500.0f; @@ -1552,7 +1528,9 @@ void demo_camera(bwd_class* i_this) { i_this->m3C44 = 0.0f; player2->changeOriginalDemo(); mDoAud_bgmStreamPlay(); +#if VERSION > VERSION_DEMO i_this->m3C1C = 100; +#endif case 0x33: i_this->m3C34.set(0.0f, REG0_F(0) + 500.0f, 0.0f); i_this->m3C28.set(REG0_F(1) + 200.0f, REG0_F(2) + 388.0f, REG0_F(3) + 3575.0f); @@ -1611,7 +1589,7 @@ void demo_camera(bwd_class* i_this) { // fallthrough case 0x35: if ((i_this->m3C20 >= 0x46) && (i_this->m3C20 < (s16)(REG0_S(8) + 0x5a))) { - if (i_this->m3C20 == 0x55) { + if (i_this->m3C20 == DEMO_SELECT(0x4b, 0x55)) { player2->changeDemoMode(daPy_demo_c::DEMO_S_SURP_e); } i_this->m3C34.set(player->current.pos.x, (player->eyePos.y + REG0_F(6)) - 30.0f, player->current.pos.z); @@ -1634,22 +1612,26 @@ void demo_camera(bwd_class* i_this) { i_this->m3C1E = 0x3c; i_this->m3C20 = 0; dComIfGp_getVibration().StopQuake(-1); +#if VERSION > VERSION_DEMO i_this->m3C1C = 200; +#endif // fallthrough case 0x3C: +#if VERSION > VERSION_DEMO if (i_this->m3C1C > 2) { cLib_addCalcAngleS2(&i_this->m3C1C, 1, 1, 1); } +#endif cLib_addCalc2(&i_this->m3C34.x, actor->current.pos.x, 0.1f, 100.0f); - local_98.y = i_this->m1908[0].m04.y + REG0_F(10) + 200.0f; - fVar2 = REG0_F(0xc) + -200.0f + 300.0f + l_HIO.m28; + local_98.y = i_this->mTongueSegments[0].m04.y + REG0_F(10) + 200.0f; + fVar2 = REG0_F(12) + -200.0f + 300.0f + l_HIO.m28; if (local_98.y < fVar2) { local_98.y = fVar2; } cLib_addCalc2(&i_this->m3C34.y, local_98.y, 0.1f, 100.0f); cLib_addCalc2(&i_this->m3C34.z, actor->current.pos.z, 0.1f, 100.0f); cLib_addCalc2(&i_this->m3C28.x, actor->current.pos.x * 0.5f, 0.05f, 50.0f); - cLib_addCalc2(&i_this->m3C28.y, l_HIO.m28 + 100.0f + REG0_F(0xf) + 300.0f, 0.1f, 50.0f); + cLib_addCalc2(&i_this->m3C28.y, l_HIO.m28 + 100.0f + REG0_F(15) + 300.0f, 0.1f, 50.0f); cLib_addCalc2(&i_this->m3C28.z, ((actor->current.pos.z + 1700.0f + 500.0f) - 200.0f) + REG0_F(9), 0.05f, 50.0f); if ((int)i_this->m3C22 == REG0_S(4) + 0x5b4) { i_this->m3C1E = 0x96; @@ -1682,15 +1664,17 @@ void demo_camera(bwd_class* i_this) { set_pos.x = actor->current.pos.x - 100.0f; set_pos.y = player->current.pos.y; set_pos.z = actor->current.pos.z + 777.0f; +#if VERSION > VERSION_DEMO i_this->m3C1C = 0x96; +#endif // fallthrough case 0x65: { - dBgS_GndChk local_8c; + dBgS_GndChk gndChk; Vec pos; pos = set_pos; pos.y += 1000.0f; - local_8c.SetPos(&pos); - fVar1 = dComIfG_Bgsp()->GroundCross(&local_8c); + gndChk.SetPos(&pos); + fVar1 = dComIfG_Bgsp()->GroundCross(&gndChk); if (fVar1 != -G_CM3D_F_INF) { set_pos.y = fVar1; } else { @@ -1699,17 +1683,19 @@ void demo_camera(bwd_class* i_this) { player2->setPlayerPosAndAngle(&set_pos, -0x8000); } cLib_addCalc2(&i_this->m3C34.x, actor->current.pos.x, 0.1f, 100.0f); - local_98.y = i_this->m1908[0].m04.y + REG0_F(10) + 200.0f; - fVar2 = REG0_F(0xc) + -200.0f + 300.0f + l_HIO.m28; + local_98.y = i_this->mTongueSegments[0].m04.y + REG0_F(10) + 200.0f; + fVar2 = REG0_F(12) + -200.0f + 300.0f + l_HIO.m28; if (local_98.y < fVar2) { local_98.y = fVar2; } cLib_addCalc2(&i_this->m3C34.y, local_98.y, 0.1f, 100.0f); cLib_addCalc2(&i_this->m3C34.z, actor->current.pos.z, 0.1f, 100.0f); cLib_addCalc2(&i_this->m3C28.x, actor->current.pos.x, 0.05f, 50.0f); - cLib_addCalc2(&i_this->m3C28.y, l_HIO.m28 + 100.0f + REG0_F(0xf) + 300.0f, 0.1f, 50.0f); + cLib_addCalc2(&i_this->m3C28.y, l_HIO.m28 + 100.0f + REG0_F(15) + 300.0f, 0.1f, 50.0f); cLib_addCalc2(&i_this->m3C28.z, actor->current.pos.z + 1700.0f + 500.0f + REG0_F(9), 0.05f, 50.0f); +#if VERSION > VERSION_DEMO cLib_addCalcAngleS2(&i_this->m3C1C, 1, 1, 1); +#endif break; case 0x66: cLib_addCalc2(&i_this->m3C34.x, i_this->m0418[i_this->m3C24].x, 0.1f, i_this->m3C44 * 200.0f); @@ -1737,9 +1723,9 @@ void demo_camera(bwd_class* i_this) { i_this->m3C28.x = (player->current.pos.x - 300.0f) + REG0_F(8); i_this->m3C28.y = (player->current.pos.y - 50.0f) + REG0_F(9) + 100.0f + 100.0f; i_this->m3C28.z = (player->current.pos.z - 600.0f) + REG0_F(10); - i_this->m3C34.x = player->current.pos.x + REG0_F(0xb); - i_this->m3C34.y = player->current.pos.y + REG0_F(0xc); - i_this->m3C34.z = (player->current.pos.z - 350.0f) + REG0_F(0xd); + i_this->m3C34.x = player->current.pos.x + REG0_F(11); + i_this->m3C34.y = player->current.pos.y + REG0_F(12); + i_this->m3C34.z = (player->current.pos.z - 350.0f) + REG0_F(13); pfVar7 = fopAcM_SearchByID(i_this->m18E0); if ((i_this->m3C20 < 10) && (pfVar7 != NULL)) { pfVar7->current.pos.set(player->current.pos.x, player->current.pos.y + 300.0f, player->current.pos.z - 350.0f); @@ -1760,7 +1746,9 @@ void demo_camera(bwd_class* i_this) { i_this->m17C4 = 0xca; i_this->m1865 = 0; i_this->m3C15 = 5; +#if VERSION > VERSION_DEMO i_this->m3C1C = 100; +#endif } break; case 0x6A: @@ -1773,7 +1761,7 @@ void demo_camera(bwd_class* i_this) { cLib_addCalc2(&i_this->m17E0, REG0_F(7) + 400.0f, 0.1f, 1.0f); i_this->m3C34.x = 0.0f; i_this->m3C34.z = 0.0f; - i_this->m3C34.y = REG0_F(0xc) + 200.0f; + i_this->m3C34.y = REG0_F(12) + 200.0f; actor->current.angle.y = actor->current.angle.y + (int)i_this->m3C44; if ((int)i_this->m3C20 < REG0_S(6) + 400) { cLib_addCalc2(&i_this->m3C44, 40.0f, 1.0f, 0.5f); @@ -1781,10 +1769,8 @@ void demo_camera(bwd_class* i_this) { if ((int)i_this->m3C20 > REG0_S(6) + 600) { cLib_addCalc2(&i_this->m3C44, 0.0f, 1.0f, 0.5f); } - mDoMtx_YrotS(*calc_mtx, (int)actor->current.angle.y); - local_98.x = 0.0f; - local_98.y = REG0_F(0xd) + 1200.0f; - local_98.z = REG0_F(0xe) + 2600.0f; + cMtx_YrotS(*calc_mtx, actor->current.angle.y); + local_98.set(0.0f, REG0_F(13) + 1200.0f, REG0_F(14) + 2600.0f); MtxPosition(&local_98, &i_this->m3C28); if ((int)i_this->m3C20 == REG0_S(6) + 0x208) { i_this->m17C4 = 200; @@ -1805,7 +1791,9 @@ void demo_camera(bwd_class* i_this) { camera->mCamera.Reset(i_this->m3C34, i_this->m3C28); camera->mCamera.Start(); camera->mCamera.SetTrimSize(0); +#if VERSION > VERSION_DEMO i_this->m3C1C = 1; +#endif break; default: break; @@ -1821,7 +1809,7 @@ void demo_camera(bwd_class* i_this) { local_e0.z = i_this->m3C34.z; sVar3 = (i_this->m3C4C * cM_scos(i_this->m18AC * 0x1c00) * 7.5f); camera->mCamera.Set(local_e0, local_d4, sVar3, i_this->m3C48); - cLib_addCalc0(&i_this->m3C4C, 1.0f, (REG0_F(0x10) + 2.0f)); + cLib_addCalc0(&i_this->m3C4C, 1.0f, REG0_F(16) + 2.0f); JUTReport(410, 410, "K MAIN COUNT %d", i_this->m3C22); JUTReport(410, 430, "K SUB COUNT %d", i_this->m3C20); i_this->m3C20++; @@ -1885,17 +1873,11 @@ static BOOL daBwd_Execute(bwd_class* i_this) { static s32 jno[] = {0x10, 0x12, 0x13, 0x17, 0x19, 0x1A, 0x04, 0x07, 0x0B}; static f32 jsize[] = {180.0f, 120.0f, 90.0f, 180.0f, 120.0f, 90.0f, 230.0f, 150.0f, 150.0f}; static s16 demo_ang[] = {0x3E80, 0xBB80}; + s32 j; + s32 i; fopAc_ac_c* actor = &i_this->actor; - u8 uVar1; - f32 fVar4; - uint uVar5; - int iVar8; - J3DAnmTextureSRTKey* pJVar11; - J3DModel* pJVar14; - int iVar15; - int iVar16; - uint uVar18; - cM3dGSph* sph; + J3DAnmTextureSRTKey* pBtk; + J3DModel* model; f32 dVar24; f32 fVar26; cXyz local_110; @@ -1903,9 +1885,11 @@ static BOOL daBwd_Execute(bwd_class* i_this) { cXyz local_128; daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); +#if VERSION > VERSION_DEMO if (dComIfGp_getStartStageName()[0] == 'X') { i_this->m3C1C = 0x32; } +#endif calc_mtx = mtx; if (i_this->m3C50 != 0) { if (i_this->m3C50 == 2) { @@ -1915,21 +1899,19 @@ static BOOL daBwd_Execute(bwd_class* i_this) { dCam_getBody()->SetTypeForce("WindBoss", NULL); } } - dBgS_GndChk local_104; + dBgS_GndChk gndChk; Vec pos; pos = actor->current.pos; - pos.x += REG0_F(0xd) + 5500.0f; - local_104.SetPos(&pos); - fVar26 = dComIfG_Bgsp()->GroundCross(&local_104); + pos.y += REG0_F(13) + 5500.0f; + gndChk.SetPos(&pos); + fVar26 = dComIfG_Bgsp()->GroundCross(&gndChk); if ((fVar26 < 850.0f) && (fVar26 != -G_CM3D_F_INF)) { i_this->m3954.y = fVar26; } i_this->m1BB6 = 0; ko_count = 0; - s32 count = ko_count; - s32 i = l_HIO.m26; - for (; i > count; count++) { - ko_ac[count] = NULL; + for (s32 i = 0; i < l_HIO.m26; i++) { + ko_ac[i] = NULL; } fpcM_Search(ko_s_sub, i_this); if (i_this->m1710 > 1) { @@ -1945,8 +1927,7 @@ static BOOL daBwd_Execute(bwd_class* i_this) { } local_110 = player->current.pos - actor->current.pos; local_110.y = 0.0f; - fVar26 = local_110.abs(); - i_this->m1BB8 = fVar26; + i_this->m1BB8 = local_110.abs(); i_this->m170C = 0; i_this->m18AC++; for (s32 i = 0; i < 5; i++) { @@ -1962,58 +1943,51 @@ static BOOL daBwd_Execute(bwd_class* i_this) { } if (l_HIO.m05 == 0) { move(i_this); - i_this->m02C0->play(&actor->eyePos, 0, 0); + i_this->mpHeadMorf->play(&actor->eyePos, 0, 0); local_110.x = 0.0f; local_110.y = 0.0f; local_110.z = REG0_F(0) + -200.0f; - mDoMtx_YrotS(*calc_mtx, (int)actor->current.angle.y); - mDoMtx_XrotM(*calc_mtx, actor->current.angle.x); + cMtx_YrotS(*calc_mtx, actor->current.angle.y); + cMtx_XrotM(*calc_mtx, actor->current.angle.x); MtxPosition(&local_110, &cStack_11c); local_110 = (actor->current.pos + cStack_11c) - i_this->m18F0; - iVar8 = cM_atan2s(local_110.x, local_110.z); - i_this->m1108[i_this->m1708].y = (s16)iVar8; - fVar26 = std::sqrtf(local_110.x * local_110.x + local_110.z * local_110.z); - i_this->m1108[i_this->m1708].x = -cM_atan2s(local_110.y, fVar26); - fVar26 = cM_ssin(i_this->m1902); - fVar4 = REG0_F(0xf) + 5000.0f; - iVar8 = fVar4 * fVar26; + i_this->m1108[i_this->m1708].y = cM_atan2s(local_110.x, local_110.z); + i_this->m1108[i_this->m1708].x = -cM_atan2s(local_110.y, std::sqrtf(SQUARE(local_110.x) + SQUARE(local_110.z))); + int iVar8 = (REG0_F(15) + 5000.0f) * cM_ssin(i_this->m1902); i_this->m1902 += REG0_S(7) + 1000; i_this->m1108[i_this->m1708].z = actor->current.angle.z + iVar8; i_this->m0508[i_this->m1708] = actor->current.pos + cStack_11c; - (i_this->m18F0) = actor->current.pos + cStack_11c; + i_this->m18F0 = actor->current.pos + cStack_11c; if (i_this->m170C != 0) { for (s32 i = 0; i < 20; i++) { - if (i_this->m02D4[i] != 0) { - uVar18 = i_this->m1708 - (i + 1) * i_this->m1904; - uVar5 = uVar18 & 0xff; - mDoMtx_stack_c::transS(i_this->m0508[uVar5].x, i_this->m0508[uVar5].y, i_this->m0508[uVar5].z); - uVar18 = uVar18 & 0xff; + if (i_this->mpBodyModel[i] != 0) { + s32 uVar18 = i_this->m1708 - (i + 1) * i_this->m1904; + uVar18 = uVar18 & 0xFF; + mDoMtx_stack_c::transS(i_this->m0508[uVar18].x, i_this->m0508[uVar18].y, i_this->m0508[uVar18].z); mDoMtx_stack_c::YrotM(i_this->m1108[uVar18].y); mDoMtx_stack_c::XrotM(i_this->m1108[uVar18].x); mDoMtx_stack_c::ZrotM(i_this->m1108[uVar18].z); fVar26 = (REG0_F(2) + 1.1f) - (s32)i * 0.02f; mDoMtx_stack_c::scaleM(fVar26, fVar26, 1.0f); - i_this->m02D4[i]->setBaseTRMtx(mDoMtx_stack_c::get()); + i_this->mpBodyModel[i]->setBaseTRMtx(mDoMtx_stack_c::get()); MTXCopy(mDoMtx_stack_c::get(), *calc_mtx); - local_110.x = REG0_F(0xd); - local_110.y = REG0_F(0xe); - local_110.z = REG0_F(0xf); + local_110.set(REG0_F(13), REG0_F(14), REG0_F(15)); MtxPosition(&local_110, &i_this->m0418[i]); if (((i & 1) == 0) && (i_this->m03C4[i] < 0.1f)) { dComIfGp_particle_setSimple(dPa_name::ID_IT_SN_O_BWO_BODY_SUNA00, &i_this->m0418[i], 0xff, g_whiteColor, g_whiteColor, 0); } - i_this->m0374[i]->setPlaySpeed(i_this->m03C4[i]); - i_this->m0374[i]->play(); + i_this->mpBodyMorf[i]->setPlaySpeed(i_this->m03C4[i]); + i_this->mpBodyMorf[i]->play(); } } } if (actor->speedF > 1.0f) { i_this->m1708++; - i_this->m1708 = i_this->m1708 & 0xff; + i_this->m1708 = i_this->m1708 & 0xFF; } } actor->shape_angle = actor->current.angle; - pJVar14 = i_this->m02C0->getModel(); + model = i_this->mpHeadMorf->getModel(); mDoMtx_stack_c::transS(actor->current.pos.x, actor->current.pos.y, actor->current.pos.z); mDoMtx_stack_c::YrotM(actor->shape_angle.y); mDoMtx_stack_c::XrotM(actor->shape_angle.x); @@ -2024,8 +1998,8 @@ static BOOL daBwd_Execute(bwd_class* i_this) { fVar26 = l_HIO.m20; } mDoMtx_stack_c::scaleM(fVar26, fVar26, fVar26); - pJVar14->setBaseTRMtx(mDoMtx_stack_c::get()); - i_this->m02C0->calc(); + model->setBaseTRMtx(mDoMtx_stack_c::get()); + i_this->mpHeadMorf->calc(); sita_move(i_this); damage_check(i_this); static cXyz joffset[] = { @@ -2040,54 +2014,51 @@ static BOOL daBwd_Execute(bwd_class* i_this) { cXyz(0.0f, 0.0f, 0.0f), }; for (s32 i = 0; i < (s32)ARRAY_SIZE(joffset); i++) { - MTXCopy(i_this->m02C0->getModel()->getAnmMtx(jno[i]), *calc_mtx); + MTXCopy(i_this->mpHeadMorf->getModel()->getAnmMtx(jno[i]), *calc_mtx); local_128 = joffset[i]; MtxPosition(&local_128, &cStack_11c); - sph = &i_this->mDamageSpheres[i]; - sph->SetC(cStack_11c); + i_this->mBodySph[i].SetC(cStack_11c); if (i_this->m18AE == 10) { - sph->SetR(jsize[i]); + i_this->mBodySph[i].SetR(jsize[i]); } else { - sph->SetR(l_HIO.m20 * jsize[i]); + i_this->mBodySph[i].SetR(l_HIO.m20 * jsize[i]); } - dComIfG_Ccsp()->Set(&i_this->mDamageSpheres[i]); + dComIfG_Ccsp()->Set(&i_this->mBodySph[i]); } demo_camera(i_this); if ((i_this->m394C != 0) && (player->current.pos.y < 900.0f)) { local_110 = i_this->m17C8 - player->current.pos; local_110.y = 0.0f; - fVar26 = local_110.abs(); - dVar24 = (1.0f - (REG0_F(4) + 0.00025f) * fVar26); + dVar24 = (1.0f - (REG0_F(4) + 0.00025f) * local_110.abs()); if (dVar24 < 0.0f) { dVar24 = 0.0f; } - iVar8 = cM_atan2s(local_110.x, local_110.z); - player->setOutPower((f32)(l_HIO.m10 * dVar24), (int)(s16)iVar8, 0); + player->setOutPower(l_HIO.m10 * dVar24, (s16)cM_atan2s(local_110.x, local_110.z), 0); i_this->m394C = 0; } - i_this->m02C4->setPlaySpeed(i_this->m02C8); - i_this->m02C4->play(); - pJVar14 = i_this->m1868; + i_this->mpHeadBrkAnm->setPlaySpeed(i_this->m02C8); + i_this->mpHeadBrkAnm->play(); + model = i_this->mpTriforcePlatformModel; if (i_this->m1864 != 0) { i_this->m1864--; - i_this->m18A0.x = cM_rndFX(REG0_F(0x12) + 4.0f); - i_this->m18A0.x = cM_rndFX(REG0_F(0x12) + 4.0f); + i_this->m18A0.x = cM_rndFX(REG0_F(18) + 4.0f); + i_this->m18A0.x = cM_rndFX(REG0_F(18) + 4.0f); } mDoMtx_stack_c::transS(i_this->m18A0.x, l_HIO.m28 + (i_this->m18A0.y + l_HIO.m2C), i_this->m18A0.z); if (i_this->m1865 != 0) { mDoMtx_stack_c::transM(0.0f, -20000.0f, 0.0f); } - pJVar14->setBaseTRMtx(mDoMtx_stack_c::get()); - MTXCopy(mDoMtx_stack_c::get(), i_this->m186C); - i_this->m189C->Move(); - for (s32 i = 0; i < 2; i++) { + model->setBaseTRMtx(mDoMtx_stack_c::get()); + MTXCopy(mDoMtx_stack_c::get(), i_this->mBgwMtx2); + i_this->mpBgW2->Move(); + for (i = 0; i < 2; i++) { if (i_this->m17E4[i] != 0) { - i_this->m185C[i]->Move(); + i_this->mpBgW1[i]->Move(); fVar26 = i_this->m17E0 + 50.0f + REG0_F(8); i_this->m3B3C = 0.0f; i_this->m3B40 = fVar26; i_this->m3B44 = 0.0f; - i_this->m3B48[i].y = REG0_S(i) + 0xc + demo_ang[i]; + i_this->m3B48[i].y = REG0_S(i + 0x6) + demo_ang[i]; switch (i_this->m17E4[i]) { case 3: break; @@ -2097,33 +2068,29 @@ static BOOL daBwd_Execute(bwd_class* i_this) { // fallthrough case 2: if (i_this->m17E6[i] == 0x32) { - for (s32 j = 0; j < 3; j++) { - iVar15 = j + i; - suna_gr_ang[iVar15].z = 0; - suna_gr_ang[iVar15].x = 0; - suna_gr_ang[iVar15].y = cM_atan2s(-suna_gr_pos[iVar15].x, -suna_gr_pos[iVar15].z); + for (j = 0; j < 3; j++) { + //s32 idx = j + (i * 3); + cXyz* pos; + csXyz* ang = &suna_gr_ang[j + (i * 3)]; + ang->z = 0; + ang->x = 0; + pos = &suna_gr_pos[j + (i * 3)]; + ang->y = cM_atan2s(-pos->x, -pos->z); dComIfGp_particle_setToon( - dPa_name::ID_IT_ST_BW_SUNATAKI_SMOKEA, - &suna_gr_pos[iVar15], - &suna_gr_ang[iVar15], - NULL, - eff_col.a, - &i_this->m3B54[iVar15], - (s8)actor->current.roomNo + dPa_name::ID_IT_ST_BW_SUNATAKI_SMOKEA, pos, ang, NULL, eff_col.a, &i_this->m3B54[j + (i * 3)], (s8)actor->current.roomNo ); - i_this->m3B54[iVar15].setColor(eff_col); + i_this->m3B54[j + (i * 3)].setColor(eff_col); } } if (i_this->m17E6[i] == 0xb4) { - pJVar11 = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bwd", BWD_BTK_TAKI_WAIT); - i_this->m17F4[i]->init(i_this->m17EC[i]->getModelData(), pJVar11, true, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, 0); + pBtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bwd", BWD_BTK_TAKI_WAIT); + i_this->m17F4[i]->init(i_this->m17EC[i]->getModelData(), pBtk, true, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, true, 0); i_this->m17E4[i] = 3; } break; case 4: - pJVar11 = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bwd", BWD_BTK_TAKI_END); - iVar16 = i_this->m17F4[i]->init(i_this->m17EC[i]->getModelData(), pJVar11, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, 0); - if (iVar16 == 1) { + pBtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bwd", BWD_BTK_TAKI_END); + if (i_this->m17F4[i]->init(i_this->m17EC[i]->getModelData(), pBtk, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, true, 0) == 1) { i_this->m17E4[i] = 5; i_this->m17E6[i] = 0; } @@ -2132,34 +2099,31 @@ static BOOL daBwd_Execute(bwd_class* i_this) { if (i_this->m17E6[i] >= 0x3C) { i_this->m17E4[i] = 0; for (s32 j = 0; j < 3; j++) { - i_this->m3B54[j + i].remove(); + i_this->m3B54[j + (i * 3)].remove(); } } break; } i_this->m17E6[i]++; i_this->m17F4[i]->play(); - pJVar14 = i_this->m17EC[i]; + model = i_this->m17EC[i]; mDoMtx_stack_c::transS(0.0f, REG0_F(3) + -500.0f + l_HIO.m28, 0.0f); mDoMtx_stack_c::YrotM(i_this->m3B48[i].y); - pJVar14->setBaseTRMtx(mDoMtx_stack_c::get()); - MTXCopy(mDoMtx_stack_c::get(), (i_this->m17FC[i])); + model->setBaseTRMtx(mDoMtx_stack_c::get()); + MTXCopy(mDoMtx_stack_c::get(), i_this->mBgwMtx1[i]); if (((i_this->m17E4[i] == 2) && (i_this->m17E6[i] >= 0x32)) || (i_this->m17E4[i] == 3)) { - pJVar14 = 0; - for (s32 j = 0; j < 3; j++) { - mDoAud_seStart(JA_SE_OBJ_BWD_SANDFALL_L, &suna_gr_pos[j + i], 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + model = NULL; + for (j = 0; j < 3; j++) { + mDoAud_seStart(JA_SE_OBJ_BWD_SANDFALL_L, &suna_gr_pos[j + (i * 3)], 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } } } } - for (s32 i = 0; i < (s32)ARRAY_SIZE(suna_gr_pos); i++) { - Vec pos; + for (i = 0; i < (s32)ARRAY_SIZE(suna_gr_pos); i++) { pos = suna_gr_pos[i]; - pos.x += suna_gr_pos[i].x; - pos.y += (f32)(1000.0f + REG0_F(0xd)); - pos.z += suna_gr_pos[i].z; - local_104.SetPos(&pos); - fVar26 = dComIfG_Bgsp()->GroundCross(&local_104); + pos.y += (f32)(1000.0f + REG0_F(13)); + gndChk.SetPos(&pos); + fVar26 = dComIfG_Bgsp()->GroundCross(&gndChk); if (fVar26 != -G_CM3D_F_INF) { suna_gr_pos[i].y = fVar26; } @@ -2168,7 +2132,9 @@ static BOOL daBwd_Execute(bwd_class* i_this) { if (i_this->m3960 == 1) { i_this->m3960++; i_this->m3AF4.remove(); - dComIfGp_particle_set(dPa_name::ID_IT_SN_BWO_KAODASHI_SUNA00, &i_this->m3954, &actor->shape_angle, NULL, 0xff, &i_this->m3AF4, (s8)actor->current.roomNo); + dComIfGp_particle_set( + dPa_name::ID_IT_SN_BWO_KAODASHI_SUNA00, &i_this->m3954, &actor->shape_angle, NULL, 0xff, &i_this->m3AF4, (s8)actor->current.roomNo + ); } else if (i_this->m3960 < 0) { i_this->m3960 = 0; i_this->m3AF4.remove(); @@ -2176,26 +2142,26 @@ static BOOL daBwd_Execute(bwd_class* i_this) { mDoAud_seStart(JA_SE_CM_BWD_SAND_MOVE, &i_this->m3954, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } } - for (s32 j = 0; j < (s32)ARRAY_SIZE(i_this->m3978); j++) { - if (i_this->m3AE0[j] != 0) { - i_this->m3AE0[j]--; - if (i_this->m3AE0[j] == 0) { - i_this->m3978[j].remove(); - if (j < 2) { - i_this->m3AB8[j].remove(); + for (i = 0; i < (s32)ARRAY_SIZE(i_this->m3978); i++) { + if (i_this->m3AE0[i] != 0) { + i_this->m3AE0[i]--; + if (i_this->m3AE0[i] == 0) { + i_this->m3978[i].remove(); + if (i < 2) { + i_this->m3AB8[i].remove(); } } } } - for (s32 i = 0; i < 2; i++) { + for (i = 0; i < 2; i++) { if (i_this->m3B08[i] != 0) { fVar26 = i_this->m3B08[i] - 1.0f; - i_this->m3B24[i]->setPlaySpeed((s16)fVar26); - i_this->m3B2C[i]->setFrame(fVar26); - i_this->m3B34[i]->setFrame(fVar26); + i_this->mpGspMorf[i]->setFrame(fVar26); + i_this->mpGspBtkAnm[i]->setFrame(fVar26); + i_this->mpGspBrkAnm[i]->setFrame(fVar26); mDoMtx_stack_c::transS(i_this->m3B0C[i].x, i_this->m3B0C[i].y, i_this->m3B0C[i].z); mDoMtx_stack_c::scaleM(l_HIO.m30, l_HIO.m34, l_HIO.m30); - i_this->m3B24[i]->getModel()->setBaseTRMtx(mDoMtx_stack_c::get()); + i_this->mpGspMorf[i]->getModel()->setBaseTRMtx(mDoMtx_stack_c::get()); i_this->m3B08[i]++; if (i_this->m3B08[i] > 0x3c) { i_this->m3B08[i] = 0; @@ -2206,17 +2172,16 @@ static BOOL daBwd_Execute(bwd_class* i_this) { i_this->m18D8 = 1; fopAcM_create(PROC_BWDG, 0, &actor->home.pos, fopAcM_GetRoomNo(actor), NULL, NULL, 0xff, NULL); } - uVar1 = i_this->m17C4; - if (uVar1 != 0) { - if (uVar1 == 0xff) { + if (i_this->m17C4 != 0) { + if (i_this->m17C4 == 0xFF) { cLib_addCalc2(&i_this->m17D4, REG0_F(5) + 0.35f, 0.2f, REG0_F(6) + 0.1f); cLib_addCalcAngleS2(&i_this->m17D8, REG0_S(9) + -0x5dc, 1, 0x1e); cLib_addCalc2(&i_this->m17DC, 1.0f, 1.0f, 0.1f); - } else if (uVar1 == 200) { + } else if (i_this->m17C4 == 200) { cLib_addCalcAngleS2(&i_this->m17D8, 0, 1, 0x1e); - } else if (uVar1 == 0xc9) { + } else if (i_this->m17C4 == 0xC9) { i_this->m17D4 = REG0_F(9) + -0.3f; - } else if (uVar1 == 0xca) { + } else if (i_this->m17C4 == 0xCA) { cLib_addCalc2(&i_this->m17D4, REG0_F(4) + -0.7f, 0.1f, 0.005f); cLib_addCalcAngleS2(&i_this->m17D8, REG0_S(9) + -500, 1, 0x1e); cLib_addCalc2(&i_this->m17DC, 1.0f, 1.0f, 0.005f); @@ -2224,7 +2189,7 @@ static BOOL daBwd_Execute(bwd_class* i_this) { cLib_addCalc2(&i_this->m17D4, -0.75f, 0.1f, 0.01f); cLib_addCalcAngleS2(&i_this->m17D8, REG0_S(7) + 1000, 1, 0x1e); cLib_addCalc2(&i_this->m17DC, 1.0f, 1.0f, 0.01f); - i_this->m17C4 = i_this->m17C4 - 1; + i_this->m17C4--; } } else { cLib_addCalc0(&i_this->m17D4, 0.1f, 0.01f); @@ -2248,9 +2213,9 @@ static BOOL daBwd_Delete(bwd_class* i_this) { hio_set = 0; mDoHIO_deleteChild(l_HIO.mNo); } - dComIfG_Bgsp()->Release(i_this->m189C); - dComIfG_Bgsp()->Release(i_this->m185C[0]); - dComIfG_Bgsp()->Release(i_this->m185C[1]); + dComIfG_Bgsp()->Release(i_this->mpBgW2); + dComIfG_Bgsp()->Release(i_this->mpBgW1[0]); + dComIfG_Bgsp()->Release(i_this->mpBgW1[1]); for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m0418); i++) { mDoAud_seDeleteObject(&i_this->m0418[i]); } @@ -2280,16 +2245,10 @@ static BOOL useHeapInit(fopAc_ac_c* a_this) { static s32 s_brk[] = {BWD_BRK_GSP00, BWD_BRK_GSP01}; static s32 s_bck[] = {BWD_BCK_GSP00, BWD_BCK_GSP01}; bwd_class* i_this = (bwd_class*)a_this; - mDoExt_McaMorf* pmVar1; J3DModelData* modelData; - int iVar8; - int iVar10; - cBgD_t* pcVar13; - uint uVar14; - int iVar16; u16 fileIndex; - pmVar1 = new mDoExt_McaMorf( + i_this->mpHeadMorf = new mDoExt_McaMorf( (J3DModelData*)dComIfG_getObjectRes("Bwd", BWD_BDL_BWD), NULL, NULL, @@ -2303,27 +2262,26 @@ static BOOL useHeapInit(fopAc_ac_c* a_this) { 0, 0x11020203 ); - i_this->m02C0 = pmVar1; - if ((i_this->m02C0 == NULL) || (i_this->m02C0->getModel() == NULL)) { + if ((i_this->mpHeadMorf == NULL) || (i_this->mpHeadMorf->getModel() == NULL)) { return FALSE; } - i_this->m02CC = mDoExt_J3DModel__create(i_this->m02C0->getModel()->getModelData(), 0, 0x11020203); + i_this->m02CC = mDoExt_J3DModel__create(i_this->mpHeadMorf->getModel()->getModelData(), 0, 0x11020203); if (i_this->m02CC == NULL) { return FALSE; } - i_this->m02C4 = new mDoExt_brkAnm(); - iVar8 = i_this->m02C4->init( - i_this->m02C0->getModel()->getModelData(), - (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bwd", BWD_BRK_BWD), - true, - J3DFrameCtrl::EMode_NONE, - 1.0f, - 0, - -1, - false, - 0 - ); - if (iVar8 == 0) { + i_this->mpHeadBrkAnm = new mDoExt_brkAnm(); + if (!i_this->mpHeadBrkAnm->init( + i_this->mpHeadMorf->getModel()->getModelData(), + (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bwd", BWD_BRK_BWD), + true, + J3DFrameCtrl::EMode_NONE, + 1.0f, + 0, + -1, + false, + 0 + )) + { return FALSE; } modelData = (J3DModelData*)dComIfG_getObjectRes("Bwd", BWD_BDL_BERO); @@ -2331,8 +2289,8 @@ static BOOL useHeapInit(fopAc_ac_c* a_this) { if (i == 29) { modelData = (J3DModelData*)dComIfG_getObjectRes("Bwd", BWD_BDL_BERO_SAKI); } - i_this->m1908[i].m00 = mDoExt_J3DModel__create(modelData, 0, 0x11020203); - if (i_this->m1908[i].m00 == 0) { + i_this->mTongueSegments[i].m00 = mDoExt_J3DModel__create(modelData, 0, 0x11020203); + if (i_this->mTongueSegments[i].m00 == 0) { return FALSE; } } @@ -2343,49 +2301,44 @@ static BOOL useHeapInit(fopAc_ac_c* a_this) { modelData = (J3DModelData*)dComIfG_getObjectRes("Bwd", BWD_BDL_BWD_SHIPPOB); fileIndex = BWD_BRK_BWD_SHIPPOB; } - i_this->m02D4[i] = mDoExt_J3DModel__create(modelData, 0, 0x11020203); - if (i_this->m02D4[i] == 0) { + i_this->mpBodyModel[i] = mDoExt_J3DModel__create(modelData, 0, 0x11020203); + if (i_this->mpBodyModel[i] == 0) { return FALSE; } i_this->m0324[i] = mDoExt_J3DModel__create(modelData, 0, 0x11020203); if (i_this->m0324[i] == 0) { return FALSE; } - i_this->m0374[i] = new mDoExt_brkAnm(); - iVar10 = - i_this->m0374[i]->init(modelData, (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bwd", fileIndex), true, J3DFrameCtrl::EMode_NONE); - if (iVar10 == 0) { + i_this->mpBodyMorf[i] = new mDoExt_brkAnm(); + if (!i_this->mpBodyMorf[i]->init(modelData, (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bwd", fileIndex), true, J3DFrameCtrl::EMode_NONE)) { return FALSE; } } modelData = (J3DModelData*)dComIfG_getObjectRes("Bwd", BWD_BDL_HTRYF1); - JUT_ASSERT(0x11c4, modelData != NULL); - i_this->m1868 = mDoExt_J3DModel__create(modelData, 0, 0x11020203); - if (i_this->m1868 == NULL) { + JUT_ASSERT(VERSION_SELECT(4466, 4524, 4548, 4548), modelData != NULL); + i_this->mpTriforcePlatformModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203); + if (i_this->mpTriforcePlatformModel == NULL) { return FALSE; } - i_this->m189C = new dBgW(); - if (i_this->m189C == NULL) { + i_this->mpBgW2 = new dBgW(); + if (i_this->mpBgW2 == NULL) { return FALSE; } - uVar14 = i_this->m189C->Set((cBgD_t*)dComIfG_getObjectRes("Bwd", BWD_DZB_HTRYF1), dBgW::MOVE_BG_e, &i_this->m186C); - if ((uVar14 & 0xff) == 1) { + if (i_this->mpBgW2->Set((cBgD_t*)dComIfG_getObjectRes("Bwd", BWD_DZB_HTRYF1), dBgW::MOVE_BG_e, &i_this->mBgwMtx2) == 1) { return FALSE; } - i_this->m189C->SetCrrFunc(dBgS_MoveBGProc_Typical); + i_this->mpBgW2->SetCrrFunc(dBgS_MoveBGProc_Typical); for (s32 i = 0; i < 2; i++) { - i_this->m185C[i] = new dBgW(); - if (i_this->m185C[i] == 0) { + i_this->mpBgW1[i] = new dBgW(); + if (i_this->mpBgW1[i] == 0) { return FALSE; } - pcVar13 = (cBgD_t*)dComIfG_getObjectRes("Bwd", BWD_DZB_HTAKI1); - uVar14 = i_this->m185C[i]->Set(pcVar13, dBgW::MOVE_BG_e, &i_this->m17FC[i]); - if ((uVar14 & 0xff) == 1) { + if (i_this->mpBgW1[i]->Set((cBgD_t*)dComIfG_getObjectRes("Bwd", BWD_DZB_HTAKI1), dBgW::MOVE_BG_e, &i_this->mBgwMtx1[i]) == 1) { return FALSE; } - i_this->m185C[i]->SetCrrFunc(dBgS_MoveBGProc_Typical); + i_this->mpBgW1[i]->SetCrrFunc(dBgS_MoveBGProc_Typical); modelData = (J3DModelData*)dComIfG_getObjectRes("Bwd", taki_bdl[i]); - JUT_ASSERT(0x11ed, modelData != NULL); + JUT_ASSERT(VERSION_SELECT(4507, 4565, 4589, 4589), modelData != NULL); i_this->m17EC[i] = mDoExt_J3DModel__create(modelData, 0, 0x11020203); if (i_this->m17EC[i] == 0) { return FALSE; @@ -2394,15 +2347,12 @@ static BOOL useHeapInit(fopAc_ac_c* a_this) { if (i_this->m17F4[i] == 0) { return FALSE; } - iVar16 = i_this->m17F4[i]->init( - modelData, (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bwd", BWD_BTK_TAKI_START), true, J3DFrameCtrl::EMode_NONE - ); - if (iVar16 == 0) { + if (!i_this->m17F4[i]->init(modelData, (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bwd", BWD_BTK_TAKI_START), true, J3DFrameCtrl::EMode_NONE)) { return FALSE; } } for (s32 i = 0; i < 2; i++) { - pmVar1 = new mDoExt_McaMorf( + i_this->mpGspMorf[i] = new mDoExt_McaMorf( (J3DModelData*)dComIfG_getObjectRes("Bwd", s_bdl[i]), NULL, NULL, @@ -2416,25 +2366,19 @@ static BOOL useHeapInit(fopAc_ac_c* a_this) { 0, 0x11020203 ); - i_this->m3B24[i] = pmVar1; - if ((i_this->m3B24[i] == NULL) || (i_this->m3B24[i]->getModel() == NULL)) { + if ((i_this->mpGspMorf[i] == NULL) || (i_this->mpGspMorf[i]->getModel() == NULL)) { return FALSE; } - modelData = i_this->m3B24[i]->getModel()->getModelData(); - i_this->m3B2C[i] = new mDoExt_btkAnm(); - if (i_this->m3B2C[i] == 0) { + modelData = i_this->mpGspMorf[i]->getModel()->getModelData(); + i_this->mpGspBtkAnm[i] = new mDoExt_btkAnm(); + if (i_this->mpGspBtkAnm[i] == 0) { return FALSE; } - iVar10 = i_this->m3B2C[i]->init( - modelData, (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bwd", s_btk[i]), true, J3DFrameCtrl::EMode_NONE - ); - if (iVar10 == 0) { + if (!i_this->mpGspBtkAnm[i]->init(modelData, (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Bwd", s_btk[i]), true, J3DFrameCtrl::EMode_NONE)) { return FALSE; } - i_this->m3B34[i] = new mDoExt_brkAnm(); - iVar10 = - i_this->m3B34[i]->init(modelData, (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bwd", s_brk[i]), true, J3DFrameCtrl::EMode_NONE); - if (iVar10 == 0) { + i_this->mpGspBrkAnm[i] = new mDoExt_brkAnm(); + if (!i_this->mpGspBrkAnm[i]->init(modelData, (J3DAnmTevRegKey*)dComIfG_getObjectRes("Bwd", s_brk[i]), true, J3DFrameCtrl::EMode_NONE)) { return FALSE; } } @@ -2448,7 +2392,7 @@ static cPhs_State daBwd_Create(fopAc_ac_c* a_this) { { /* Flags */ 0, /* SrcObjAt Type */ AT_TYPE_UNK800, - /* SrcObjAt Atp */ 8, + /* SrcObjAt Atp */ DEMO_SELECT(2, 8), /* SrcObjAt SPrm */ cCcD_AtSPrm_Set_e | cCcD_AtSPrm_VsPlayer_e, /* SrcObjTg Type */ AT_TYPE_ALL & ~AT_TYPE_WATER & ~AT_TYPE_UNK20000 & ~AT_TYPE_WIND & ~AT_TYPE_UNK400000 & ~AT_TYPE_LIGHT, /* SrcObjTg SPrm */ cCcD_TgSPrm_Set_e | cCcD_TgSPrm_IsEnemy_e, @@ -2528,77 +2472,89 @@ static cPhs_State daBwd_Create(fopAc_ac_c* a_this) { }}, }; f32 fVar1; - cPhs_State res; - fopAcM_ct(a_this, bwd_class); + fopAcM_ct_Retail(a_this, bwd_class); bwd_class* i_this = (bwd_class*)a_this; - fopAc_ac_c* actor = &i_this->actor; - res = dComIfG_resLoad(&i_this->mPhaseBwd, "Bwd"); + cPhs_State res = dComIfG_resLoad(&i_this->mPhaseBwd, "Bwd"); +#if VERSION == VERSION_DEMO + cPhs_State res2 = dComIfG_resLoad(&i_this->mPhaseBwds, "Bwds"); + if (res == cPhs_ERROR_e || res2 == cPhs_ERROR_e) { + return cPhs_ERROR_e; + } if (res != cPhs_COMPLEATE_e) { return res; } - res = dComIfG_resLoad(&i_this->mPhaseBwds, "Bwds"); + if (res2 != cPhs_COMPLEATE_e) { + return res2; + } + fopAcM_SetupActor(a_this, bwd_class); +#else if (res != cPhs_COMPLEATE_e) { return res; } - i_this->m02BC = fopAcM_GetParam(actor) & 0xFF; - if (!fopAcM_entrySolidHeap(actor, useHeapInit, 0x96000)) { + cPhs_State res2 = dComIfG_resLoad(&i_this->mPhaseBwds, "Bwds"); + if (res2 != cPhs_COMPLEATE_e) { + return res2; + } +#endif + i_this->m02BC = fopAcM_GetParam(a_this) & 0xFF; + if (!fopAcM_entrySolidHeap(a_this, useHeapInit, 0x96000)) { return cPhs_ERROR_e; } - if (dComIfG_Bgsp()->Regist(i_this->m189C, actor)) { + if (dComIfG_Bgsp()->Regist(i_this->mpBgW2, a_this)) { return cPhs_ERROR_e; } - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->m185C); i++) { - if (dComIfG_Bgsp()->Regist(i_this->m185C[i], actor)) { + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->mpBgW1); i++) { + if (dComIfG_Bgsp()->Regist(i_this->mpBgW1[i], a_this)) { return cPhs_ERROR_e; } } - actor->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e; - actor->attention_info.distances[2] = 0x22; + a_this->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e; + a_this->attention_info.distances[2] = 0x22; if (hio_set == 0) { i_this->m3C51 = 1; hio_set = 1; l_HIO.mNo = mDoHIO_createChild("風ボス", &l_HIO); // Wind boss } - actor->health = 0xc; - actor->max_health = 0xc; - i_this->mCcD_Stts.Init(0xfa, 0, actor); + a_this->health = 0xc; + a_this->max_health = 0xc; + i_this->mStts.Init(0xfa, 0, a_this); for (s32 i = 0; i < 17; i++) { - i_this->mDamageSpheres[i].SetStts(&i_this->mCcD_Stts); - i_this->mDamageSpheres[i].Set(body_sph_src); + i_this->mBodySph[i].SetStts(&i_this->mStts); + i_this->mBodySph[i].Set(body_sph_src); } - i_this->mCcD_Sph.SetStts(&i_this->mCcD_Stts); - i_this->mCcD_Sph.Set(bero_sph_src); - for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->mCcD_Sph_Array5); i++) { - i_this->mCcD_Sph_Array5[i].SetStts(&i_this->mCcD_Stts); - i_this->mCcD_Sph_Array5[i].Set(bero_co_sph_src); + i_this->mTongueSph.SetStts(&i_this->mStts); + i_this->mTongueSph.Set(bero_sph_src); + for (s32 i = 0; i < (s32)ARRAY_SIZE(i_this->mTongueCoSph); i++) { + i_this->mTongueCoSph[i].SetStts(&i_this->mStts); + i_this->mTongueCoSph[i].Set(bero_co_sph_src); } if (!(dComIfGs_isStageBossDemo()) && (dComIfGp_getStartStageName()[0] != 'X')) { - actor->current.pos.x = 0.0f; - actor->current.pos.y = -20000.0f; - actor->current.pos.z = 0.0f; + a_this->current.pos.x = 0.0f; + a_this->current.pos.y = -20000.0f; + a_this->current.pos.z = 0.0f; i_this->m18AE = 0; i_this->m17DC = 1.0f; i_this->m17E0 = 200.0f; - fopAcM_OnStatus(actor, fopAcStts_SHOWMAP_e); + fopAcM_OnStatus(a_this, fopAcStts_SHOWMAP_e); i_this->m3C50 = 1; } else { if ((dComIfGs_isStageBossEnemy()) && (dComIfGp_getStartStageName()[0] != 'X')) { i_this->m18AE = 0xd; - actor->current.pos.x = 0.0f; - actor->current.pos.y = -20000.0f; - actor->current.pos.z = 0.0f; - i_this->m17E0 = REG0_F(0xb) + 400.0f; + a_this->current.pos.x = 0.0f; + a_this->current.pos.y = -20000.0f; + a_this->current.pos.z = 0.0f; + i_this->m17E0 = REG0_F(11) + 400.0f; i_this->m3C15 = 5; } else { dComIfGs_offTmpBit(dSv_event_tmp_flag_c::UNK_0480); - fopAcM_OnStatus(actor, fopAcStts_SHOWMAP_e); + fopAcM_OnStatus(a_this, fopAcStts_SHOWMAP_e); i_this->m18AE = 1; i_this->m18B0 = -10; - fVar1 = REG0_F(0x11) + -1500.0f; - actor->current.pos.x = 0.0f; - actor->current.pos.y = fVar1; - actor->current.pos.z = 0.0f; + fVar1 = REG0_F(17) + -1500.0f; + a_this->current.pos.x = 0.0f; + a_this->current.pos.y = fVar1; + a_this->current.pos.z = 0.0f; i_this->m17E0 = 900.0f; i_this->m1865 = 1; i_this->m17E4[0] = 1; @@ -2611,20 +2567,22 @@ static cPhs_State daBwd_Create(fopAc_ac_c* a_this) { } } } - i_this->m1B88.y = actor->current.pos.y; + i_this->m1B88.y = a_this->current.pos.y; for (s32 i = 0; i < 30; i++) { - fVar1 = actor->current.pos.y; - i_this->m1908[i].m04.x = 0; - i_this->m1908[i].m04.y = fVar1; - i_this->m1908[i].m04.z = 0; + fVar1 = a_this->current.pos.y; + i_this->mTongueSegments[i].m04.x = 0; + i_this->mTongueSegments[i].m04.y = fVar1; + i_this->mTongueSegments[i].m04.z = 0; } eff_col.r = 0xa0; eff_col.g = 0xa0; eff_col.b = 0x80; eff_col.a = 0x96; - i_this->m1714 = actor->tevStr; +#if VERSION > VERSION_DEMO + i_this->m1714 = a_this->tevStr; +#endif #if VERSION == VERSION_USA - i_this->m1BC0 = fopAcM_create(PROC_ATT, 0x65, &actor->current.pos, fopAcM_GetRoomNo(actor)); + i_this->m1BC0 = fopAcM_create(PROC_ATT, 0x65, &a_this->current.pos, fopAcM_GetRoomNo(a_this)); #endif return cPhs_COMPLEATE_e; }