diff --git a/asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/ba_disappear__FP10fopAc_ac_c.s b/asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/ba_disappear__FP10fopAc_ac_c.s deleted file mode 100644 index eb2a971168a..00000000000 --- a/asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/ba_disappear__FP10fopAc_ac_c.s +++ /dev/null @@ -1,26 +0,0 @@ -lbl_8067ED30: -/* 8067ED30 94 21 FF F0 */ stwu r1, -0x10(r1) -/* 8067ED34 7C 08 02 A6 */ mflr r0 -/* 8067ED38 90 01 00 14 */ stw r0, 0x14(r1) -/* 8067ED3C 93 E1 00 0C */ stw r31, 0xc(r1) -/* 8067ED40 7C 7F 1B 78 */ mr r31, r3 -/* 8067ED44 38 9F 04 D0 */ addi r4, r31, 0x4d0 -/* 8067ED48 38 A0 00 06 */ li r5, 6 -/* 8067ED4C 38 C0 00 00 */ li r6, 0 -/* 8067ED50 38 E0 00 03 */ li r7, 3 -/* 8067ED54 4B 99 DD 85 */ bl fopAcM_createDisappear__FPC10fopAc_ac_cPC4cXyzUcUcUc -/* 8067ED58 80 1F 00 B0 */ lwz r0, 0xb0(r31) -/* 8067ED5C 54 04 46 3E */ srwi r4, r0, 0x18 -/* 8067ED60 2C 04 00 FF */ cmpwi r4, 0xff -/* 8067ED64 41 82 00 18 */ beq lbl_8067ED7C -/* 8067ED68 3C 60 80 40 */ lis r3, g_dComIfG_gameInfo@ha /* 0x804061C0@ha */ -/* 8067ED6C 38 63 61 C0 */ addi r3, r3, g_dComIfG_gameInfo@l /* 0x804061C0@l */ -/* 8067ED70 88 1F 04 E2 */ lbz r0, 0x4e2(r31) -/* 8067ED74 7C 05 07 74 */ extsb r5, r0 -/* 8067ED78 4B 9B 64 89 */ bl onSwitch__10dSv_info_cFii -lbl_8067ED7C: -/* 8067ED7C 83 E1 00 0C */ lwz r31, 0xc(r1) -/* 8067ED80 80 01 00 14 */ lwz r0, 0x14(r1) -/* 8067ED84 7C 08 03 A6 */ mtlr r0 -/* 8067ED88 38 21 00 10 */ addi r1, r1, 0x10 -/* 8067ED8C 4E 80 00 20 */ blr diff --git a/asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/daE_BA_Draw__FP10e_ba_class.s b/asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/daE_BA_Draw__FP10e_ba_class.s deleted file mode 100644 index 3f0332b3b05..00000000000 --- a/asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/daE_BA_Draw__FP10e_ba_class.s +++ /dev/null @@ -1,29 +0,0 @@ -lbl_8067EE38: -/* 8067EE38 94 21 FF F0 */ stwu r1, -0x10(r1) -/* 8067EE3C 7C 08 02 A6 */ mflr r0 -/* 8067EE40 90 01 00 14 */ stw r0, 0x14(r1) -/* 8067EE44 93 E1 00 0C */ stw r31, 0xc(r1) -/* 8067EE48 93 C1 00 08 */ stw r30, 8(r1) -/* 8067EE4C 7C 7E 1B 78 */ mr r30, r3 -/* 8067EE50 80 63 05 C4 */ lwz r3, 0x5c4(r3) -/* 8067EE54 83 E3 00 04 */ lwz r31, 4(r3) -/* 8067EE58 3C 60 80 43 */ lis r3, g_env_light@ha /* 0x8042CA54@ha */ -/* 8067EE5C 38 63 CA 54 */ addi r3, r3, g_env_light@l /* 0x8042CA54@l */ -/* 8067EE60 38 80 00 00 */ li r4, 0 -/* 8067EE64 38 BE 04 D0 */ addi r5, r30, 0x4d0 -/* 8067EE68 38 DE 01 0C */ addi r6, r30, 0x10c -/* 8067EE6C 4B B2 49 59 */ bl settingTevStruct__18dScnKy_env_light_cFiP4cXyzP12dKy_tevstr_c -/* 8067EE70 3C 60 80 43 */ lis r3, g_env_light@ha /* 0x8042CA54@ha */ -/* 8067EE74 38 63 CA 54 */ addi r3, r3, g_env_light@l /* 0x8042CA54@l */ -/* 8067EE78 80 9F 00 04 */ lwz r4, 4(r31) -/* 8067EE7C 38 BE 01 0C */ addi r5, r30, 0x10c -/* 8067EE80 4B B2 5F 21 */ bl setLightTevColorType_MAJI__18dScnKy_env_light_cFP12J3DModelDataP12dKy_tevstr_c -/* 8067EE84 80 7E 05 C4 */ lwz r3, 0x5c4(r30) -/* 8067EE88 4B 99 23 39 */ bl entryDL__16mDoExt_McaMorfSOFv -/* 8067EE8C 38 60 00 01 */ li r3, 1 -/* 8067EE90 83 E1 00 0C */ lwz r31, 0xc(r1) -/* 8067EE94 83 C1 00 08 */ lwz r30, 8(r1) -/* 8067EE98 80 01 00 14 */ lwz r0, 0x14(r1) -/* 8067EE9C 7C 08 03 A6 */ mtlr r0 -/* 8067EEA0 38 21 00 10 */ addi r1, r1, 0x10 -/* 8067EEA4 4E 80 00 20 */ blr diff --git a/asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/pl_check__FP10e_ba_classfs.s b/asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/pl_check__FP10e_ba_classfs.s deleted file mode 100644 index 335a3be22bc..00000000000 --- a/asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/pl_check__FP10e_ba_classfs.s +++ /dev/null @@ -1,51 +0,0 @@ -lbl_8067EFF8: -/* 8067EFF8 94 21 FF F0 */ stwu r1, -0x10(r1) -/* 8067EFFC 7C 08 02 A6 */ mflr r0 -/* 8067F000 90 01 00 14 */ stw r0, 0x14(r1) -/* 8067F004 3C A0 80 40 */ lis r5, g_dComIfG_gameInfo@ha /* 0x804061C0@ha */ -/* 8067F008 38 A5 61 C0 */ addi r5, r5, g_dComIfG_gameInfo@l /* 0x804061C0@l */ -/* 8067F00C 80 C5 5D AC */ lwz r6, 0x5dac(r5) -/* 8067F010 80 06 05 70 */ lwz r0, 0x570(r6) -/* 8067F014 54 00 05 EF */ rlwinm. r0, r0, 0, 0x17, 0x17 -/* 8067F018 41 82 00 10 */ beq lbl_8067F028 -/* 8067F01C 88 05 4F AD */ lbz r0, 0x4fad(r5) -/* 8067F020 28 00 00 00 */ cmplwi r0, 0 -/* 8067F024 41 82 00 0C */ beq lbl_8067F030 -lbl_8067F028: -/* 8067F028 38 60 00 00 */ li r3, 0 -/* 8067F02C 48 00 00 70 */ b lbl_8067F09C -lbl_8067F030: -/* 8067F030 C0 46 04 D4 */ lfs f2, 0x4d4(r6) -/* 8067F034 C0 03 04 D4 */ lfs f0, 0x4d4(r3) -/* 8067F038 FC 02 00 40 */ fcmpo cr0, f2, f0 -/* 8067F03C 40 80 00 5C */ bge lbl_8067F098 -/* 8067F040 C0 03 06 88 */ lfs f0, 0x688(r3) -/* 8067F044 FC 00 08 40 */ fcmpo cr0, f0, f1 -/* 8067F048 40 80 00 50 */ bge lbl_8067F098 -/* 8067F04C A8 A3 06 84 */ lha r5, 0x684(r3) -/* 8067F050 A8 03 04 E6 */ lha r0, 0x4e6(r3) -/* 8067F054 7C 05 00 50 */ subf r0, r5, r0 -/* 8067F058 7C 05 07 34 */ extsh r5, r0 -/* 8067F05C 7C 80 07 34 */ extsh r0, r4 -/* 8067F060 2C 00 00 01 */ cmpwi r0, 1 -/* 8067F064 41 82 00 1C */ beq lbl_8067F080 -/* 8067F068 7C 05 00 00 */ cmpw r5, r0 -/* 8067F06C 40 80 00 2C */ bge lbl_8067F098 -/* 8067F070 7C 04 00 D0 */ neg r0, r4 -/* 8067F074 7C 00 07 34 */ extsh r0, r0 -/* 8067F078 7C 05 00 00 */ cmpw r5, r0 -/* 8067F07C 40 81 00 1C */ ble lbl_8067F098 -lbl_8067F080: -/* 8067F080 7C C4 33 78 */ mr r4, r6 -/* 8067F084 4B FF FE 9D */ bl other_bg_check__FP10e_ba_classP10fopAc_ac_c -/* 8067F088 2C 03 00 00 */ cmpwi r3, 0 -/* 8067F08C 40 82 00 0C */ bne lbl_8067F098 -/* 8067F090 38 60 00 01 */ li r3, 1 -/* 8067F094 48 00 00 08 */ b lbl_8067F09C -lbl_8067F098: -/* 8067F098 38 60 00 00 */ li r3, 0 -lbl_8067F09C: -/* 8067F09C 80 01 00 14 */ lwz r0, 0x14(r1) -/* 8067F0A0 7C 08 03 A6 */ mtlr r0 -/* 8067F0A4 38 21 00 10 */ addi r1, r1, 0x10 -/* 8067F0A8 4E 80 00 20 */ blr diff --git a/asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/shot_b_sub__FPvPv.s b/asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/shot_b_sub__FPvPv.s deleted file mode 100644 index 36ade131d0e..00000000000 --- a/asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/shot_b_sub__FPvPv.s +++ /dev/null @@ -1,33 +0,0 @@ -lbl_8067EEA8: -/* 8067EEA8 94 21 FF F0 */ stwu r1, -0x10(r1) -/* 8067EEAC 7C 08 02 A6 */ mflr r0 -/* 8067EEB0 90 01 00 14 */ stw r0, 0x14(r1) -/* 8067EEB4 93 E1 00 0C */ stw r31, 0xc(r1) -/* 8067EEB8 7C 7F 1B 78 */ mr r31, r3 -/* 8067EEBC 4B 99 9E 25 */ bl fopAc_IsActor__FPv -/* 8067EEC0 2C 03 00 00 */ cmpwi r3, 0 -/* 8067EEC4 41 82 00 44 */ beq lbl_8067EF08 -/* 8067EEC8 A8 1F 00 08 */ lha r0, 8(r31) -/* 8067EECC 2C 00 00 FE */ cmpwi r0, 0xfe -/* 8067EED0 40 82 00 38 */ bne lbl_8067EF08 -/* 8067EED4 3C 60 80 40 */ lis r3, g_dComIfG_gameInfo@ha /* 0x804061C0@ha */ -/* 8067EED8 38 63 61 C0 */ addi r3, r3, g_dComIfG_gameInfo@l /* 0x804061C0@l */ -/* 8067EEDC 80 03 5F 18 */ lwz r0, 0x5f18(r3) -/* 8067EEE0 54 00 03 19 */ rlwinm. r0, r0, 0, 0xc, 0xc -/* 8067EEE4 40 82 00 24 */ bne lbl_8067EF08 -/* 8067EEE8 4B AE 09 B5 */ bl checkBoomerangCharge__9daPy_py_cFv -/* 8067EEEC 54 60 06 3F */ clrlwi. r0, r3, 0x18 -/* 8067EEF0 41 82 00 18 */ beq lbl_8067EF08 -/* 8067EEF4 80 1F 00 B0 */ lwz r0, 0xb0(r31) -/* 8067EEF8 28 00 00 01 */ cmplwi r0, 1 -/* 8067EEFC 40 82 00 0C */ bne lbl_8067EF08 -/* 8067EF00 7F E3 FB 78 */ mr r3, r31 -/* 8067EF04 48 00 00 08 */ b lbl_8067EF0C -lbl_8067EF08: -/* 8067EF08 38 60 00 00 */ li r3, 0 -lbl_8067EF0C: -/* 8067EF0C 83 E1 00 0C */ lwz r31, 0xc(r1) -/* 8067EF10 80 01 00 14 */ lwz r0, 0x14(r1) -/* 8067EF14 7C 08 03 A6 */ mtlr r0 -/* 8067EF18 38 21 00 10 */ addi r1, r1, 0x10 -/* 8067EF1C 4E 80 00 20 */ blr diff --git a/include/d/a/d_a_player.h b/include/d/a/d_a_player.h index d15a6ba4cf1..c2c708741cf 100644 --- a/include/d/a/d_a_player.h +++ b/include/d/a/d_a_player.h @@ -769,6 +769,8 @@ public: } } + bool onWolfEnemyCatch(fopAc_ac_c* i_actor) { return onWolfEnemyBiteAll(i_actor, FLG2_UNK_8); } + void offGoronSideMove() { if (checkGoronSideMove()) { mSpecialMode = 0; diff --git a/include/rel/d/a/e/d_a_e_ba/d_a_e_ba.h b/include/rel/d/a/e/d_a_e_ba/d_a_e_ba.h index f1dcc89c7be..0c3a7bffc85 100644 --- a/include/rel/d/a/e/d_a_e_ba/d_a_e_ba.h +++ b/include/rel/d/a/e/d_a_e_ba/d_a_e_ba.h @@ -1,4 +1,109 @@ #ifndef D_A_E_BA_H #define D_A_E_BA_H +#include "Z2AudioLib/Z2Creature.h" +#include "f_op/f_op_actor_mng.h" +#include "d/cc/d_cc_d.h" +#include "d/bg/d_bg_s_acch.h" +#include "d/cc/d_cc_uty.h" +#include "d/d_path.h" + +class e_ba_class : public fopEn_enemy_c { +public: + enum Type { + /* 0 */ TYPE_NORMAL, + /* 1 */ TYPE_FIRE, + /* 2 */ TYPE_ICE, + }; + + enum HomeType { + /* 0 */ HOME_ROOF, + /* 1 */ HOME_FLY, + /* 2 */ HOME_APPEAR, + }; + + enum Action { + /* 0x0 */ ACT_ROOF, + /* 0x1 */ ACT_FIGHT_FLY, + /* 0x2 */ ACT_FIGHT, + /* 0x3 */ ACT_ATTACK, + /* 0x4 */ ACT_RETURN, + /* 0x5 */ ACT_FLY, + /* 0x6 */ ACT_PATH_FLY, + /* 0xA */ ACT_CHANCE = 10, + /* 0xD */ ACT_WOLFBITE = 13, + /* 0xE */ ACT_WIND, + /* 0xF */ ACT_APPEAR, + }; + + enum Animation { + /* 0x4 */ ANM_APPEAR = 4, + /* 0x5 */ ANM_DEAD, + /* 0x6 */ ANM_FLY, + /* 0x7 */ ANM_FURA2, + /* 0x8 */ ANM_HOLDWAIT, + /* 0x9 */ ANM_HOVERING, + /* 0xA */ ANM_WAIT, + }; + + /* 0x5AC */ request_of_phase_process_class mPhase; + /* 0x5B4 */ u8 mHomeType; + /* 0x5B5 */ u8 mDistanceParam; + /* 0x5B6 */ u8 mType; + /* 0x5B7 */ u8 mPathIndex; + /* 0x5B8 */ char* mArcName; + /* 0x5BC */ u8 field_0x5bc; + /* 0x5BD */ s8 mPathPoint; + /* 0x5BE */ s8 mPathStep; + /* 0x5C0 */ dPath* mpPath; + /* 0x5C4 */ mDoExt_McaMorfSO* mpMorf; + /* 0x5C8 */ Z2CreatureEnemy mCreatureSound; + /* 0x66C */ int mAnm; + /* 0x670 */ s16 mCounter; + /* 0x672 */ s16 mAction; + /* 0x674 */ s16 mMode; + /* 0x678 */ cXyz mTargetPos; + /* 0x684 */ s16 mPlayerAngleY; + /* 0x688 */ f32 mPlayerDistanceXZ; + /* 0x68C */ f32 mFightFlyDistance; + /* 0x690 */ f32 mSpeedRatio; + /* 0x694 */ f32 mBaseAngleSpeed; + /* 0x698 */ f32 mKnockbackSpeed; + /* 0x69C */ s16 mKnockbackAngle; + /* 0x69E */ csXyz mChanceAngle; + /* 0x6A4 */ bool mIsDying; + /* 0x6A6 */ s16 mTimer[4]; + /* 0x6AE */ s16 mIFrames; + /* 0x6B0 */ cXyz field_0x6b0; + /* 0x6BC */ cXyz mWindOffset; + /* 0x6C8 */ s16 mWindSpinSpeed; + /* 0x6CC */ dBgS_AcchCir mAcchCir; + /* 0x70C */ dBgS_ObjAcch mAcch; + /* 0x8E4 */ dCcD_Stts mStts; + /* 0x920 */ dCcD_Sph mSph; + /* 0xA58 */ dCcU_AtInfo mAtInfo; + /* 0xA7C */ u32 mSmokeKey1; + /* 0xA80 */ u32 mSmokeKey2; + /* 0xA84 */ u32 mParticleKey[4]; + /* 0xA94 */ u8 field_0xa94[0xc]; + /* 0xAA0 */ bool mHIOInit; +}; + +STATIC_ASSERT(sizeof(e_ba_class) == 0xAA4); + +class daE_BA_HIO_c { +public: + /* 8067ECEC */ daE_BA_HIO_c(); + /* 80681F00 */ virtual ~daE_BA_HIO_c() {} + + /* 0x04 */ s8 field_0x04; + /* 0x08 */ f32 mScale; + /* 0x0C */ f32 mFlySpeed; + /* 0x10 */ f32 mFightDistance; + /* 0x14 */ f32 mFightSpeed; + /* 0x18 */ f32 mAttackSpeed; +}; + +STATIC_ASSERT(sizeof(daE_BA_HIO_c) == 0x1C); + #endif /* D_A_E_BA_H */ diff --git a/rel/d/a/e/d_a_e_ba/d_a_e_ba.cpp b/rel/d/a/e/d_a_e_ba/d_a_e_ba.cpp index 2c4fbe74062..476500b45f3 100644 --- a/rel/d/a/e/d_a_e_ba/d_a_e_ba.cpp +++ b/rel/d/a/e/d_a_e_ba/d_a_e_ba.cpp @@ -1,167 +1,19 @@ -// -// Generated By: dol2asm -// Translation Unit: d_a_e_ba -// +/** + * d_a_e_ba.cpp + * Enemy - Keese + */ + +// Matches except for the weak function setMidnaBindEffect #include "rel/d/a/e/d_a_e_ba/d_a_e_ba.h" -#include "d/cc/d_cc_d.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "SSystem/SComponent/c_math.h" +#include "d/com/d_com_inf_game.h" +#include "d/s/d_s_play.h" +#include "d/a/d_a_player.h" +#include "d/d_procname.h" #include "dol2asm.h" -// -// Types: -// - -struct request_of_phase_process_class {}; - -struct mDoMtx_stack_c { - /* 8000CE38 */ void scaleM(f32, f32, f32); - - static u8 now[48]; -}; - -struct mDoExt_McaMorfCallBack2_c {}; - -struct mDoExt_McaMorfCallBack1_c {}; - -struct J3DAnmTransform {}; - -struct J3DModelData {}; - -struct Z2Creature {}; - -struct mDoExt_McaMorfSO { - /* 800107D0 */ mDoExt_McaMorfSO(J3DModelData*, mDoExt_McaMorfCallBack1_c*, - mDoExt_McaMorfCallBack2_c*, J3DAnmTransform*, int, f32, int, - int, Z2Creature*, u32, u32); - /* 80010E70 */ void setAnm(J3DAnmTransform*, int, f32, f32, f32, f32); - /* 800110B0 */ void play(u32, s8); - /* 800111C0 */ void entryDL(); - /* 800111EC */ void modelCalc(); - /* 80011310 */ void stopZelAnime(); -}; - -struct fopEn_enemy_c {}; - -struct fopAc_ac_c { - /* 80018B64 */ fopAc_ac_c(); -}; - -struct e_ba_class {}; - -struct daPy_py_c { - /* 8015F89C */ void checkBoomerangCharge(); - - static u8 m_midnaActor[4]; -}; - -struct daE_BA_HIO_c { - /* 8067ECEC */ daE_BA_HIO_c(); - /* 80681F00 */ ~daE_BA_HIO_c(); -}; - -struct dVibration_c { - /* 8006FA24 */ void StartShock(int, int, cXyz); -}; - -struct dSv_info_c { - /* 80035200 */ void onSwitch(int, int); - /* 80035360 */ void isSwitch(int, int) const; -}; - -struct dKy_tevstr_c {}; - -struct dScnKy_env_light_c { - /* 801A37C4 */ void settingTevStruct(int, cXyz*, dKy_tevstr_c*); - /* 801A4DA0 */ void setLightTevColorType_MAJI(J3DModelData*, dKy_tevstr_c*); -}; - -struct dRes_info_c {}; - -struct dRes_control_c { - /* 8003C2EC */ void getRes(char const*, s32, dRes_info_c*, int); -}; - -struct dPa_levelEcallBack {}; - -struct csXyz {}; - -struct _GXColor {}; - -struct dPa_control_c { - struct level_c { - /* 8004B918 */ void getEmitter(u32); - }; - - /* 8004CA90 */ void set(u8, u16, cXyz const*, dKy_tevstr_c const*, csXyz const*, cXyz const*, - u8, dPa_levelEcallBack*, s8, _GXColor const*, _GXColor const*, - cXyz const*, f32); - /* 8004D4CC */ void set(u32, u8, u16, cXyz const*, dKy_tevstr_c const*, csXyz const*, - cXyz const*, u8, dPa_levelEcallBack*, s8, _GXColor const*, - _GXColor const*, cXyz const*, f32); - - static u8 mParticleTracePCB[4 + 4 /* padding */]; -}; - -struct dCcU_AtInfo {}; - -struct dBgS_PolyPassChk { - /* 80078E68 */ void SetObj(); -}; - -struct dBgS_ObjAcch { - /* 80681DD8 */ ~dBgS_ObjAcch(); -}; - -struct dBgS_LinChk { - /* 80077C68 */ dBgS_LinChk(); - /* 80077CDC */ ~dBgS_LinChk(); - /* 80077D64 */ void Set(cXyz const*, cXyz const*, fopAc_ac_c const*); -}; - -struct dBgS_AcchCir { - /* 80075EAC */ dBgS_AcchCir(); - /* 80075F58 */ void SetWall(f32, f32); - /* 80681E48 */ ~dBgS_AcchCir(); -}; - -struct dBgS {}; - -struct dBgS_Acch { - /* 80075F94 */ ~dBgS_Acch(); - /* 800760A0 */ dBgS_Acch(); - /* 80076248 */ void Set(cXyz*, cXyz*, fopAc_ac_c*, int, dBgS_AcchCir*, cXyz*, csXyz*, csXyz*); - /* 80076AAC */ void CrrPos(dBgS&); -}; - -struct cM3dGCir { - /* 8026EF18 */ ~cM3dGCir(); -}; - -struct cCcS { - /* 80264BA8 */ void Set(cCcD_Obj*); -}; - -struct cBgS_PolyInfo { - /* 802680B0 */ ~cBgS_PolyInfo(); -}; - -struct cBgS_LinChk {}; - -struct cBgS { - /* 800743B4 */ void LineCross(cBgS_LinChk*); -}; - -struct Z2CreatureEnemy { - /* 802C0F64 */ Z2CreatureEnemy(); - /* 802C1094 */ void init(Vec*, Vec*, u8, u8); - /* 802C1B7C */ void setLinkSearch(bool); - /* 802C1B90 */ void setEnemyName(char const*); -}; - -struct J3DFrameCtrl { - /* 8032842C */ void checkPass(f32); -}; - // // Forward References: // @@ -205,6 +57,12 @@ extern "C" static void func_80681F84(); extern "C" static void func_80681F8C(); extern "C" static void setMidnaBindEffect__FP13fopEn_enemy_cP15Z2CreatureEnemyP4cXyzP4cXyz(); extern "C" extern char const* const d_a_e_ba__stringBase0; +static cPhs__Step daE_BA_Create(fopAc_ac_c*); +static int daE_BA_Delete(e_ba_class*); +static int daE_BA_Execute(e_ba_class*); +static int daE_BA_IsDelete(e_ba_class*); +static int daE_BA_Draw(e_ba_class*); +static int setMidnaBindEffect(fopEn_enemy_c*, Z2CreatureEnemy*, cXyz*, cXyz*); // // External References: @@ -294,9 +152,6 @@ extern "C" void setEnemyName__15Z2CreatureEnemyFPCc(); extern "C" void* __nw__FUl(); extern "C" void __dl__FPv(); extern "C" void checkPass__12J3DFrameCtrlFf(); -extern "C" void PSMTXCopy(); -extern "C" void PSMTXTrans(); -extern "C" void PSMTXMultVec(); extern "C" void _savegpr_19(); extern "C" void _savegpr_23(); extern "C" void _savegpr_27(); @@ -307,20 +162,14 @@ extern "C" void _restgpr_23(); extern "C" void _restgpr_27(); extern "C" void _restgpr_28(); extern "C" void _restgpr_29(); -extern "C" extern void* g_fopAc_Method[8]; -extern "C" extern void* g_fpcLf_Method[5 + 1 /* padding */]; extern "C" extern void* __vt__8dCcD_Sph[36]; extern "C" extern void* __vt__9dCcD_Stts[11]; extern "C" extern void* __vt__12cCcD_SphAttr[25]; extern "C" extern void* __vt__14cCcD_ShapeAttr[22]; extern "C" extern void* __vt__9cCcD_Stts[8]; extern "C" u8 now__14mDoMtx_stack_c[48]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; -extern "C" extern u8 g_env_light[4880]; -extern "C" extern void* calc_mtx[1 + 1 /* padding */]; extern "C" u8 mParticleTracePCB__13dPa_control_c[4 + 4 /* padding */]; extern "C" u8 m_midnaActor__9daPy_py_c[4]; -extern "C" extern u8 pauseTimer__9dScnPly_c[4]; extern "C" void __register_global_object(); // @@ -413,14 +262,14 @@ SECTION_DEAD static char const* const stringBase_80682496 = "E_ib"; #pragma pop /* 8068249C-806824A8 000000 000C+00 1/1 0/0 0/0 .data cNullVec__6Z2Calc */ -SECTION_DATA static u8 cNullVec__6Z2Calc[12] = { +static u8 cNullVec__6Z2Calc[12] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; /* 806824A8-806824BC 00000C 0004+10 0/0 0/0 0/0 .data @1787 */ #pragma push #pragma force_active on -SECTION_DATA static u32 lit_1787[1 + 4 /* padding */] = { +static u32 lit_1787[1 + 4 /* padding */] = { 0x02000201, /* padding */ 0x40080000, @@ -521,25 +370,30 @@ static dCcD_SrcSph cc_sph_src = { }; /* 80682570-80682590 -00001 0020+00 1/0 0/0 0/0 .data l_daE_BA_Method */ -SECTION_DATA static void* l_daE_BA_Method[8] = { - (void*)daE_BA_Create__FP10fopAc_ac_c, - (void*)daE_BA_Delete__FP10e_ba_class, - (void*)daE_BA_Execute__FP10e_ba_class, - (void*)daE_BA_IsDelete__FP10e_ba_class, - (void*)daE_BA_Draw__FP10e_ba_class, - (void*)NULL, - (void*)NULL, - (void*)NULL, +static actor_method_class l_daE_BA_Method = { + (process_method_func)daE_BA_Create, + (process_method_func)daE_BA_Delete, + (process_method_func)daE_BA_Execute, + (process_method_func)daE_BA_IsDelete, + (process_method_func)daE_BA_Draw, }; /* 80682590-806825C0 -00001 0030+00 0/0 0/0 1/0 .data g_profile_E_BA */ -SECTION_DATA extern void* g_profile_E_BA[12] = { - (void*)0xFFFFFFFD, (void*)0x0007FFFD, - (void*)0x01EA0000, (void*)&g_fpcLf_Method, - (void*)0x00000AA4, (void*)NULL, - (void*)NULL, (void*)&g_fopAc_Method, - (void*)0x00B40000, (void*)&l_daE_BA_Method, - (void*)0x10050100, (void*)0x020E0000, +extern actor_process_profile_definition g_profile_E_BA = { + fpcLy_CURRENT_e, + 7, + fpcPi_CURRENT_e, + PROC_E_BA, + &g_fpcLf_Method.mBase, + sizeof(e_ba_class), + 0, + 0, + &g_fopAc_Method.base, + 0xB4, + &l_daE_BA_Method, + 0x10050100, + fopAc_ENEMY_e, + fopAc_CULLBOX_CUSTOM_e, }; /* 806825C0-806825CC 000124 000C+00 1/1 0/0 0/0 .data __vt__12dBgS_AcchCir */ @@ -598,6 +452,17 @@ SECTION_DATA extern void* __vt__12daE_BA_HIO_c[3] = { }; /* 8067ECEC-8067ED30 0000EC 0044+00 1/1 0/0 0/0 .text __ct__12daE_BA_HIO_cFv */ +#ifdef NONMATCHING +// matches with literals +daE_BA_HIO_c::daE_BA_HIO_c() { + field_0x04 = -1; + mScale = 1.0f; + mFlySpeed = 15.0f; + mFightDistance = 250.0f; + mFightSpeed = 15.0f; + mAttackSpeed = 40.0f; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -606,16 +471,16 @@ asm daE_BA_HIO_c::daE_BA_HIO_c() { #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/__ct__12daE_BA_HIO_cFv.s" } #pragma pop +#endif /* 8067ED30-8067ED90 000130 0060+00 2/2 0/0 0/0 .text ba_disappear__FP10fopAc_ac_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void ba_disappear(fopAc_ac_c* param_0) { - nofralloc -#include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/ba_disappear__FP10fopAc_ac_c.s" +static void ba_disappear(fopAc_ac_c* i_this) { + fopAcM_createDisappear(i_this, &i_this->current.pos, 6, 0, 3); + int sw = fopAcM_GetParam(i_this) >> 24; + if (sw != 0xff) { + dComIfGs_onSwitch(sw, fopAcM_GetRoomNo(i_this)); + } } -#pragma pop /* ############################################################################################## */ /* 806823F4-806823F8 000038 0004+00 1/1 0/0 0/0 .rodata @3996 */ @@ -623,6 +488,15 @@ SECTION_RODATA static f32 const lit_3996 = -1.0f; COMPILER_STRIP_GATE(0x806823F4, &lit_3996); /* 8067ED90-8067EE38 000190 00A8+00 11/11 0/0 0/0 .text anm_init__FP10e_ba_classifUcf */ +#ifdef NONMATCHING +// matches with literals +static void anm_init(e_ba_class* i_this, int i_index, f32 i_morf, u8 i_attr, f32 i_rate) { + J3DAnmTransform* anm = + static_cast(dComIfG_getObjectRes(i_this->mArcName, i_index)); + i_this->mpMorf->setAnm(anm, i_attr, i_morf, i_rate, 0.0f, -1.0f); + i_this->mAnm = i_index; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -631,47 +505,78 @@ static asm void anm_init(e_ba_class* param_0, int param_1, f32 param_2, u8 param #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/anm_init__FP10e_ba_classifUcf.s" } #pragma pop +#endif /* 8067EE38-8067EEA8 000238 0070+00 1/0 0/0 0/0 .text daE_BA_Draw__FP10e_ba_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daE_BA_Draw(e_ba_class* param_0) { - nofralloc -#include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/daE_BA_Draw__FP10e_ba_class.s" +static int daE_BA_Draw(e_ba_class* i_this) { + J3DModel* model = i_this->mpMorf->getModel(); + g_env_light.settingTevStruct(0, &i_this->current.pos, &i_this->tevStr); + g_env_light.setLightTevColorType_MAJI(model, &i_this->tevStr); + i_this->mpMorf->entryDL(); + return 1; } -#pragma pop /* 8067EEA8-8067EF20 0002A8 0078+00 1/1 0/0 0/0 .text shot_b_sub__FPvPv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void shot_b_sub(void* param_0, void* param_1) { - nofralloc -#include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/shot_b_sub__FPvPv.s" +static void* shot_b_sub(void* i_proc, void* i_this) { + if (fopAcM_IsActor(i_proc) && fopAcM_GetName(i_proc) == PROC_BOOMERANG + && !dComIfGp_checkPlayerStatus0(0, 0x80000) && daPy_py_c::checkBoomerangCharge() + && fopAcM_GetParam(i_proc) == 1) + { + return i_proc; + } + return NULL; } -#pragma pop /* 8067EF20-8067EFF8 000320 00D8+00 1/1 0/0 0/0 .text other_bg_check__FP10e_ba_classP10fopAc_ac_c */ +#ifdef NONMATCHING +// matches with literals +static BOOL other_bg_check(e_ba_class* i_this, fopAc_ac_c* i_other) { + fopAc_ac_c* _this = static_cast(i_this); + dBgS_LinChk lin_chk; + cXyz vec1, vec2; + vec2 = i_other->current.pos; + vec2.y += 100.0f; + vec1 = _this->current.pos; + vec1.y = _this->eyePos.y; + lin_chk.Set(&vec1, &vec2, _this); + if (dComIfG_Bgsp().LineCross(&lin_chk)) { + return true; + } else { + return false; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void other_bg_check(e_ba_class* param_0, fopAc_ac_c* param_1) { +static asm BOOL other_bg_check(e_ba_class* param_0, fopAc_ac_c* param_1) { nofralloc #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/other_bg_check__FP10e_ba_classP10fopAc_ac_c.s" } #pragma pop +#endif /* 8067EFF8-8067F0AC 0003F8 00B4+00 5/5 0/0 0/0 .text pl_check__FP10e_ba_classfs */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void pl_check(e_ba_class* param_0, f32 param_1, s16 param_2) { - nofralloc -#include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/pl_check__FP10e_ba_classfs.s" +static BOOL pl_check(e_ba_class* i_this, f32 i_maxDistance, s16 i_maxAngle) { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + + if (!daPy_getPlayerActorClass()->checkSwimUp() || dComIfGp_event_runCheck()) { + return false; + } + + if (player->current.pos.y < i_this->current.pos.y && i_this->mPlayerDistanceXZ < i_maxDistance) + { + s16 angle = i_this->shape_angle.y - i_this->mPlayerAngleY; + if (i_maxAngle == 1 || (angle < i_maxAngle && angle > (s16)-i_maxAngle)) { + if (!other_bg_check(i_this, player)) { + return true; + } + } + } + + return false; } -#pragma pop /* ############################################################################################## */ /* 806823F8-806823FC 00003C 0004+00 0/2 0/0 0/0 .rodata @4122 */ @@ -696,6 +601,60 @@ COMPILER_STRIP_GATE(0x80682400, &lit_4124); #pragma pop /* 8067F0AC-8067F2DC 0004AC 0230+00 1/1 0/0 0/0 .text damage_check__FP10e_ba_class */ +#ifdef NONMATCHING +// matches with literals +static void damage_check(e_ba_class* i_this) { + daPy_py_c* player = static_cast(dComIfGp_getPlayer(0)); + if (i_this->mIFrames == 0) { + i_this->mStts.Move(); + if (i_this->mSph.ChkTgHit()) { + i_this->mAtInfo.mpCollider = i_this->mSph.GetTgHitObj(); + if (i_this->mAtInfo.mpCollider->ChkAtType(AT_TYPE_BOOMERANG)) { + i_this->mAction = e_ba_class::ACT_WIND; + i_this->mMode = 0; + i_this->mType = e_ba_class::TYPE_NORMAL; + i_this->mSph.SetAtType(AT_TYPE_CSTATUE_SWING); + } else { + cc_at_check(i_this, &i_this->mAtInfo); + if (i_this->mAtInfo.mpCollider->ChkAtType(AT_TYPE_HOOKSHOT) + || i_this->mAtInfo.mpCollider->ChkAtType(AT_TYPE_SLINGSHOT)) + { + i_this->health--; + } + + if (i_this->mAtInfo.mpCollider->ChkAtType(AT_TYPE_SHIELD_ATTACK)) { + i_this->mAction = e_ba_class::ACT_CHANCE; + i_this->mMode = 0; + i_this->mKnockbackSpeed = 70.0f; + i_this->mKnockbackAngle = i_this->shape_angle.y; + i_this->mIsDying = false; + dComIfGp_getVibration().StartShock(2, 0x1f, cXyz(0.0f, 1.0f, 0.0f)); + } else if (i_this->mAtInfo.mpCollider->ChkAtType(AT_TYPE_WOLF_ATTACK) + && player->onWolfEnemyCatch(i_this)) { + i_this->mAction = e_ba_class::ACT_WOLFBITE; + i_this->mMode = 0; + i_this->mIFrames = 200; + dScnPly_c::setPauseTimer(0); + i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_BA_V_BITE, -1); + } else { + if (i_this->mAtInfo.mpCollider->ChkAtType(AT_TYPE_UNK)) { + i_this->mIFrames = 20; + } else { + i_this->mIFrames = 10; + } + i_this->mKnockbackSpeed = 80.0f; + i_this->mKnockbackAngle = i_this->mAtInfo.mHitDirection; + if (i_this->health <= 0) { + i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_BA_V_DEATH, -1); + i_this->mpMorf->setPlaySpeed(0.2f); + i_this->mIsDying = true; + } + } + } + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -704,6 +663,7 @@ static asm void damage_check(e_ba_class* param_0) { #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/damage_check__FP10e_ba_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80682404-80682408 000048 0004+00 0/5 0/0 0/0 .rodata @4156 */ @@ -714,26 +674,99 @@ COMPILER_STRIP_GATE(0x80682404, &lit_4156); #pragma pop /* 80682638-8068263C 000008 0004+00 2/2 0/0 0/0 .bss None */ +#ifdef NONMATCHING +static bool hioInit; +#else static u8 data_80682638[4]; +#endif +#ifndef NONMATCHING /* 8068263C-80682648 00000C 000C+00 1/1 0/0 0/0 .bss @3963 */ static u8 lit_3963[12]; /* 80682648-80682664 000018 001C+00 9/9 0/0 0/0 .bss l_HIO */ static u8 l_HIO[28]; +#else +/* 80682648-80682664 000018 001C+00 9/9 0/0 0/0 .bss l_HIO */ +static daE_BA_HIO_c l_HIO; +#endif +#ifndef NONMATCHING /* 80682664-80682763 000034 00FF+00 1/1 0/0 0/0 .bss check_index$4162 */ static u8 check_index[255]; +#endif /* 8067F2DC-8067F544 0006DC 0268+00 2/3 0/0 0/0 .text path_check__FP10e_ba_class */ +#ifdef NONMATCHING +// matches with literals +static BOOL path_check(e_ba_class* i_this) { + if (i_this->mpPath != NULL) { + dBgS_LinChk lin_chk; + cXyz vec1, vec2; + vec1 = i_this->current.pos; + vec1.y += 100.0f; + static bool check_index[255]; + dStage_dPnt_c* point = i_this->mpPath->m_points; + for (int i = 0; i < i_this->mpPath->m_num; i++, point++) { + vec2.x = point->m_position.x; + vec2.y = point->m_position.y + 100.0f; + vec2.z = point->m_position.z; + lin_chk.Set(&vec1, &vec2, i_this); + if (!dComIfG_Bgsp().LineCross(&lin_chk)) { + check_index[i] = true; + } else { + check_index[i] = false; + } + } + + f32 threshold = 0.0f; + bool bvar5 = false; + for (int i = 0; i < 100; i++, threshold += 50.0f) { + point = i_this->mpPath->m_points; + for (int j = 0; j < i_this->mpPath->m_num; j++, point++) { + if (check_index[j]) { + f32 delta_x = i_this->current.pos.x - point->m_position.x; + f32 delta_y = i_this->current.pos.y - point->m_position.y; + f32 delta_z = i_this->current.pos.z - point->m_position.z; + f32 dist = + JMAFastSqrt(delta_x * delta_x + delta_y * delta_y + delta_z * delta_z); + if (dist < threshold) { + i_this->mPathPoint = j - i_this->mPathStep; + if (i_this->mPathPoint >= (s8)i_this->mpPath->m_num) { + i_this->mPathPoint = i_this->mpPath->m_num; + } else if (i_this->mPathPoint < 0) { + i_this->mPathPoint = 0; + } + bvar5 = true; + break; + } + } + } + if (bvar5) { + break; + } + } + + if (!bvar5) { + i_this->field_0x5bc = 0; + } else { + i_this->field_0x5bc = i_this->mPathIndex + 1; + return true; + } + } + + return false; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void path_check(e_ba_class* param_0) { +static asm BOOL path_check(e_ba_class* param_0) { nofralloc #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/path_check__FP10e_ba_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80682408-8068240C 00004C 0004+00 0/1 0/0 0/0 .rodata @4242 */ @@ -751,6 +784,32 @@ COMPILER_STRIP_GATE(0x8068240C, &lit_4243); #pragma pop /* 8067F544-8067F6D4 000944 0190+00 6/6 0/0 0/0 .text fly_move__FP10e_ba_class */ +#ifdef NONMATCHING +// matches with literals +static void fly_move(e_ba_class* i_this) { + f32 delta_x = i_this->mTargetPos.x - i_this->current.pos.x; + f32 delta_y = i_this->mTargetPos.y - i_this->current.pos.y; + f32 delta_z = i_this->mTargetPos.z - i_this->current.pos.z; + s16 angle_y = cM_atan2s(delta_x, delta_z); + f32 dist_xz = JMAFastSqrt(delta_x * delta_x + delta_z * delta_z); + s16 angle_x = -cM_atan2s(delta_y, dist_xz); + cLib_addCalcAngleS2(&i_this->current.angle.y, angle_y, 10, + i_this->mBaseAngleSpeed * i_this->mSpeedRatio); + i_this->mBaseAngleSpeed = 2000.0f; + cLib_addCalcAngleS2(&i_this->current.angle.x, angle_x, 10, + i_this->mBaseAngleSpeed * i_this->mSpeedRatio); + cLib_addCalc2(&i_this->mSpeedRatio, 1.0f, 1.0f, 0.04f); + + cXyz vec; + vec.x = 0.0f; + vec.y = 0.0f; + vec.z = i_this->speedF; + mDoMtx_YrotS(*calc_mtx, i_this->current.angle.y); + mDoMtx_XrotM(*calc_mtx, i_this->current.angle.x); + MtxPosition(&vec, &i_this->speed); + i_this->current.pos += i_this->speed; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -759,6 +818,7 @@ static asm void fly_move(e_ba_class* param_0) { #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/fly_move__FP10e_ba_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80682410-80682414 000054 0004+00 0/1 0/0 0/0 .rodata @4275 */ @@ -783,6 +843,33 @@ COMPILER_STRIP_GATE(0x80682418, &lit_4277); #pragma pop /* 8067F6D4-8067F81C 000AD4 0148+00 1/1 0/0 0/0 .text e_ba_roof__FP10e_ba_class */ +#ifdef NONMATCHING +// matches with literals +static void e_ba_roof(e_ba_class* i_this) { + switch (i_this->mMode) { + case 0: + anm_init(i_this, e_ba_class::ANM_WAIT, 15.0f, + J3DFrameCtrl::LOOP_REPEAT_e, cM_rndF(0.1f) + 0.9f); + i_this->mMode = 1; + break; + + case 1: + if ((i_this->mCounter & 0x1f) == 0 && cM_rndF(1.0f) < 0.5f) { + i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_BA_V_NAKU, -1); + } + break; + } + + cLib_addCalc2(&i_this->current.pos.x, i_this->home.pos.x, 0.5f, fabsf(i_this->speed.x)); + cLib_addCalc2(&i_this->current.pos.y, i_this->home.pos.y, 0.5f, fabsf(i_this->speed.y)); + cLib_addCalc2(&i_this->current.pos.z, i_this->home.pos.z, 0.5f, fabsf(i_this->speed.z)); + + if (pl_check(i_this, i_this->mFightFlyDistance, 1)) { + i_this->mAction = e_ba_class::ACT_FIGHT_FLY; + i_this->mMode = 0; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -791,6 +878,7 @@ static asm void e_ba_roof(e_ba_class* param_0) { #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/e_ba_roof__FP10e_ba_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8068241C-80682420 000060 0004+00 0/6 0/0 0/0 .rodata @4307 */ @@ -808,6 +896,52 @@ COMPILER_STRIP_GATE(0x80682420, &lit_4308); #pragma pop /* 8067F81C-8067F9E0 000C1C 01C4+00 1/1 0/0 0/0 .text e_ba_fight_fly__FP10e_ba_class */ +#ifdef NONMATCHING +// matches with literals +static void e_ba_fight_fly(e_ba_class* i_this) { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + + switch (i_this->mMode) { + case 0: + anm_init(i_this, e_ba_class::ANM_FLY, 3.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f); + i_this->mMode = 1; + i_this->mSpeedRatio = 0.0f; + break; + + case 1: + if ((i_this->mCounter & 0xf) == 0 && cM_rndF(1.0f) < 0.5f) { + i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_BA_V_NAKU, -1); + } + break; + } + + cLib_addCalc2(&i_this->speedF, l_HIO.mFlySpeed, 1.0f, l_HIO.mFlySpeed * 0.3f); + i_this->mTargetPos = player->current.pos; + fly_move(i_this); + + if (!pl_check(i_this, i_this->mFightFlyDistance + 50.0f, 1)) { + if (i_this->mHomeType != e_ba_class::HOME_APPEAR) { + if (!path_check(i_this)) { + if (i_this->mHomeType == e_ba_class::HOME_ROOF) { + i_this->mAction = e_ba_class::ACT_RETURN; + i_this->mMode = 0; + } else { + i_this->mAction = e_ba_class::ACT_FLY; + i_this->mMode = 0; + } + } else { + i_this->mAction = e_ba_class::ACT_PATH_FLY; + i_this->mMode = 0; + } + } + } else { + if (pl_check(i_this, l_HIO.mFightDistance, 1)) { + i_this->mAction = e_ba_class::ACT_FIGHT; + i_this->mMode = 0; + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -816,6 +950,7 @@ static asm void e_ba_fight_fly(e_ba_class* param_0) { #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/e_ba_fight_fly__FP10e_ba_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80682424-80682428 000068 0004+00 0/3 0/0 0/0 .rodata @4376 */ @@ -854,6 +989,79 @@ COMPILER_STRIP_GATE(0x80682434, &lit_4380); #pragma pop /* 8067F9E0-8067FD68 000DE0 0388+00 1/1 0/0 0/0 .text e_ba_fight__FP10e_ba_class */ +#ifdef NONMATCHING +// matches with literals +static void e_ba_fight(e_ba_class* i_this) { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + s16 player_angle = player->shape_angle.y; + + switch (i_this->mMode) { + case 0: + anm_init(i_this, e_ba_class::ANM_HOVERING, 2.0f, + J3DFrameCtrl::LOOP_REPEAT_e, cM_rndF(0.1f) + 1.0f); + i_this->mMode = 1; + i_this->mTimer[0] = 0; + i_this->mTimer[1] = cM_rndF(100.0f) + 30.0f; + break; + + case 1: + if (i_this->mTimer[0] == 0) { + mDoMtx_YrotS(*calc_mtx, player_angle + (s16)cM_rndFX(12288.0f)); + cXyz vec; + vec.x = 0.0f; + vec.y = cM_rndF(100.0f) + 150.0f; + vec.z = cM_rndF(150.0f) + 150.0f; + MtxPosition(&vec, &i_this->mTargetPos); + i_this->mTargetPos += player->current.pos; + vec = i_this->mTargetPos - i_this->current.pos; + mDoMtx_YrotS(*calc_mtx, cM_atan2s(vec.x, vec.z)); + f32 dist_xz = JMAFastSqrt(vec.x * vec.x + vec.z * vec.z); + mDoMtx_XrotM(*calc_mtx, -cM_atan2s(vec.y, dist_xz)); + vec.x = 0.0f; + vec.y = 0.0f; + vec.z = l_HIO.mFightSpeed; + MtxPosition(&vec, &i_this->speed); + i_this->mTimer[0] = cM_rndF(30.0f) + 10.0f; + i_this->mSpeedRatio = 0.0f; + } + + if (i_this->mTimer[1] == 0) { + i_this->mTimer[1] = cM_rndF(100.0f) + 30.0f; + if (i_this->mHomeType != e_ba_class::HOME_APPEAR || cM_rndF(1.0f) < 0.2f) { + i_this->mAction = e_ba_class::ACT_ATTACK; + i_this->mMode = 0; + } + } + break; + } + + cLib_addCalc2(&i_this->current.pos.x, i_this->mTargetPos.x, 0.2f, + i_this->mSpeedRatio * fabsf(i_this->speed.x)); + cLib_addCalc2(&i_this->current.pos.y, i_this->mTargetPos.y, 0.2f, + i_this->mSpeedRatio * fabsf(i_this->speed.y)); + cLib_addCalc2(&i_this->current.pos.z, i_this->mTargetPos.z, 0.2f, + i_this->mSpeedRatio * fabsf(i_this->speed.z)); + cLib_addCalc2(&i_this->mSpeedRatio, 1.0f, 1.0f, 0.1f); + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mPlayerAngleY, 4, 0x800); + + if (i_this->mHomeType != e_ba_class::HOME_APPEAR + && !pl_check(i_this, i_this->mFightFlyDistance + 50.0f, 1)) + { + if (!path_check(i_this)) { + if (i_this->mHomeType == e_ba_class::HOME_ROOF) { + i_this->mAction = e_ba_class::ACT_RETURN; + i_this->mMode = 0; + } else { + i_this->mAction = e_ba_class::ACT_FLY; + i_this->mMode = 0; + } + } else { + i_this->mAction = e_ba_class::ACT_PATH_FLY; + i_this->mMode = 0; + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -862,6 +1070,7 @@ static asm void e_ba_fight(e_ba_class* param_0) { #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/e_ba_fight__FP10e_ba_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80682438-8068243C 00007C 0004+00 0/1 0/0 0/0 .rodata @4417 */ @@ -872,6 +1081,59 @@ COMPILER_STRIP_GATE(0x80682438, &lit_4417); #pragma pop /* 8067FD68-8067FF60 001168 01F8+00 1/1 0/0 0/0 .text e_ba_attack__FP10e_ba_class */ +#ifdef NONMATCHING +// matches with literals +static void e_ba_attack(e_ba_class* i_this) { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + f32 target_speed = 0.0f; + i_this->mSpeedRatio = 0.0f; + + switch (i_this->mMode) { + case 0: + anm_init(i_this, e_ba_class::ANM_FLY, 3.0f, J3DFrameCtrl::LOOP_REPEAT_e, 2.0f); + i_this->mMode = 1; + i_this->mTimer[1] = 20; + break; + + case 1: + i_this->mTargetPos = player->current.pos; + i_this->mTargetPos.y += 120.0f; + i_this->mSpeedRatio = 2.0f; + if (i_this->mTimer[1] == 0) { + i_this->mMode = 2; + i_this->mTimer[0] = 15; + i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_BA_V_ATTACK, -1); + } + break; + + case 2: + target_speed = l_HIO.mAttackSpeed; + if (i_this->mSph.ChkAtShieldHit()) { + i_this->mAction = e_ba_class::ACT_CHANCE; + i_this->mMode = 0; + i_this->mKnockbackSpeed = 70.0f; + i_this->mKnockbackAngle = i_this->shape_angle.y; + i_this->mIsDying = false; + dComIfGp_getVibration().StartShock(2, 0x1f, cXyz(0.0f, 1.0f, 0.0f)); + } else { + if (i_this->mTimer[0] == 0) { + i_this->mMode = 3; + } + } + break; + + case 3: + if (i_this->speedF <= 1.0f) { + i_this->mAction = e_ba_class::ACT_FIGHT; + i_this->mMode = 0; + } + break; + } + + cLib_addCalc2(&i_this->speedF, target_speed, 1.0f, l_HIO.mAttackSpeed * 0.2f); + fly_move(i_this); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -880,6 +1142,7 @@ static asm void e_ba_attack(e_ba_class* param_0) { #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/e_ba_attack__FP10e_ba_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8068243C-80682440 000080 0004+00 0/1 0/0 0/0 .rodata @4459 */ @@ -897,6 +1160,44 @@ COMPILER_STRIP_GATE(0x80682440, &lit_4460); #pragma pop /* 8067FF60-8068018C 001360 022C+00 1/1 0/0 0/0 .text e_ba_fly__FP10e_ba_class */ +#ifdef NONMATCHING +// matches with literals +static void e_ba_fly(e_ba_class* i_this) { + switch (i_this->mMode) { + case 0: + anm_init(i_this, e_ba_class::ANM_FLY, 3.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f); + i_this->mMode = 1; + break; + + case 1: + if ((i_this->mCounter & 0x1f) == 0 && cM_rndF(1.0f) < 0.5f) { + i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_BA_V_NAKU, -1); + } + if (i_this->mTimer[0] == 0) { + i_this->mTargetPos.x = i_this->home.pos.x + cM_rndFX(500.0f); + i_this->mTargetPos.y = i_this->home.pos.y + cM_rndFX(200.0f); + i_this->mTargetPos.z = i_this->home.pos.z + cM_rndFX(500.0f); + cXyz vec = i_this->mTargetPos - i_this->current.pos; + mDoMtx_YrotS(*calc_mtx, cM_atan2s(vec.x, vec.z)); + mDoMtx_XrotM(*calc_mtx, -cM_atan2s(vec.y, JMAFastSqrt(vec.x * vec.x + vec.z * vec.z))); + vec.x = 0.0f; + vec.y = 0.0f; + vec.z = l_HIO.mFightSpeed; + MtxPosition(&vec, &i_this->speed); + i_this->mTimer[0] = cM_rndF(30.0f) + 10.0f; + i_this->mSpeedRatio = 0.0f; + } + break; + } + + cLib_addCalc2(&i_this->speedF, l_HIO.mFlySpeed, 1.0f, l_HIO.mFlySpeed * 0.3f); + fly_move(i_this); + if (pl_check(i_this, i_this->mFightFlyDistance, 1)) { + i_this->mAction = e_ba_class::ACT_FIGHT_FLY; + i_this->mMode = 0; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -905,8 +1206,38 @@ static asm void e_ba_fly(e_ba_class* param_0) { #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/e_ba_fly__FP10e_ba_class.s" } #pragma pop +#endif /* 8068018C-8068039C 00158C 0210+00 1/1 0/0 0/0 .text e_ba_return__FP10e_ba_class */ +#ifdef NONMATCHING +// matches with literals +static void e_ba_return(e_ba_class* i_this) { + switch (i_this->mMode) { + case 0: + anm_init(i_this, e_ba_class::ANM_FLY, 3.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f); + i_this->mMode = 1; + i_this->mSpeedRatio = 0.0f; + + case 1: + break; + } + + cLib_addCalc2(&i_this->speedF, l_HIO.mFlySpeed, 1.0f, l_HIO.mFlySpeed * 0.3f); + i_this->mTargetPos = i_this->home.pos; + fly_move(i_this); + + cXyz delta = i_this->current.pos - i_this->mTargetPos; + if (delta.abs() < 100.0f) { + i_this->mAction = e_ba_class::ACT_ROOF; + i_this->mMode = 0; + } else { + if (pl_check(i_this, i_this->mFightFlyDistance, 1)) { + i_this->mAction = e_ba_class::ACT_FIGHT_FLY; + i_this->mMode = 0; + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -915,8 +1246,66 @@ static asm void e_ba_return(e_ba_class* param_0) { #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/e_ba_return__FP10e_ba_class.s" } #pragma pop +#endif /* 8068039C-806806B4 00179C 0318+00 1/1 0/0 0/0 .text e_ba_path_fly__FP10e_ba_class */ +#ifdef NONMATCHING +// matches with literals +static void e_ba_path_fly(e_ba_class* i_this) { + dStage_dPnt_c* point; + + switch (i_this->mMode) { + case 0: + anm_init(i_this, e_ba_class::ANM_FLY, 3.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f); + i_this->mMode = 1; + // fallthrough + + case 1: + if ((i_this->mCounter & 0x1f) == 0 && cM_rndF(1.0f) < 0.5f) { + i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_BA_V_NAKU, -1); + } + i_this->mPathPoint += i_this->mPathStep; + if (i_this->mPathPoint >= (s8)i_this->mpPath->m_num) { + if (dPath_ChkClose(i_this->mpPath)) { + i_this->mPathPoint = 0; + } else { + i_this->mPathStep = -1; + i_this->mPathPoint = i_this->mpPath->m_num - 2; + } + int next_id = i_this->mpPath->m_nextID; + if (next_id != 0xffff) { + i_this->mpPath = dPath_GetRoomPath(next_id, fopAcM_GetRoomNo(i_this)); + } + } else { + if (i_this->mPathPoint < 0) { + i_this->mPathStep = 1; + i_this->mPathPoint = 1; + } + } + // fallthrough + + case 2: + i_this->mMode = 3; + point = i_this->mpPath->m_points; + point = &point[i_this->mPathPoint]; + i_this->mSpeedRatio = 0.0f; + i_this->mTargetPos.x = point->m_position.x + cM_rndFX(150.0f); + i_this->mTargetPos.y = point->m_position.y + cM_rndFX(150.0f); + i_this->mTargetPos.z = point->m_position.z + cM_rndFX(150.0f); + break; + + case 3: + cXyz delta = i_this->mTargetPos - i_this->current.pos; + if (delta.abs() < 200.0f) { + i_this->mMode = 1; + } + break; + } + + cLib_addCalc2(&i_this->speedF, l_HIO.mFlySpeed, 1.0f, l_HIO.mFlySpeed * 0.3f); + fly_move(i_this); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -925,6 +1314,7 @@ static asm void e_ba_path_fly(e_ba_class* param_0) { #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/e_ba_path_fly__FP10e_ba_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80682444-80682448 000088 0004+00 0/1 0/0 0/0 .rodata @4587 */ @@ -949,6 +1339,52 @@ COMPILER_STRIP_GATE(0x8068244C, &lit_4589); #pragma pop /* 806806B4-806808AC 001AB4 01F8+00 1/1 0/0 0/0 .text e_ba_chance__FP10e_ba_class */ +#ifdef NONMATCHING +// matches with literals +static void e_ba_chance(e_ba_class* i_this) { + switch (i_this->mMode) { + case 0: + anm_init(i_this, e_ba_class::ANM_HOVERING, 2.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.5f); + i_this->mMode = 1; + i_this->mTimer[0] = cM_rndF(30.0f) + 100.0f; + i_this->speed.x = 0.0f; + i_this->speed.y = 0.0f; + i_this->speed.z = 0.0f; + i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_BA_V_BITE, -1); + break; + + case 1: + if (i_this->mAcch.ChkGroundHit()) { + i_this->speed.y = cM_rndF(10.0f) + 10.0f; + i_this->speed.x = cM_rndFX(10.0f); + i_this->speed.z = cM_rndFX(10.0f); + if ( cM_rndF(1.0f) < 0.5f) { + i_this->mChanceAngle.z = 0; + } else { + i_this->mChanceAngle.z = -0x8000; + } + i_this->mChanceAngle.y = cM_rndF(0x10000); + fopAcM_effSmokeSet1(&i_this->mSmokeKey1, &i_this->mSmokeKey2, + &i_this->current.pos, &i_this->shape_angle, 0.8f, + &i_this->tevStr, 1); + i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_BA_V_FAINT, -1); + } + + if (i_this->mTimer[0] == 0) { + i_this->current.angle.z = 0; + i_this->mAction = e_ba_class::ACT_FIGHT; + i_this->mMode = 0; + return; + } + break; + } + + i_this->current.pos += i_this->speed; + i_this->speed.y -= 2.0f; + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mChanceAngle.y, 2, 0x1000); + cLib_addCalcAngleS2(&i_this->current.angle.z, i_this->mChanceAngle.z, 2, 0x1000); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -957,6 +1393,7 @@ static asm void e_ba_chance(e_ba_class* param_0) { #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/e_ba_chance__FP10e_ba_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80682450-80682454 000094 0004+00 0/1 0/0 0/0 .rodata @4629 */ @@ -974,6 +1411,65 @@ COMPILER_STRIP_GATE(0x80682454, &lit_4630); #pragma pop /* 806808AC-80680AF4 001CAC 0248+00 1/1 0/0 0/0 .text e_ba_wolfbite__FP10e_ba_class */ +#ifdef NONMATCHING +// matches with literals +static void e_ba_wolfbite(e_ba_class* i_this) { + daPy_py_c* player = static_cast(dComIfGp_getPlayer(0)); + + switch (i_this->mMode) { + case 0: + anm_init(i_this, e_ba_class::ANM_HOLDWAIT, 0.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f); + i_this->mMode = 1; + break; + + case 1: + if (!player->checkWolfEnemyCatchOwn(i_this)) { + if (player->checkWolfEnemyLeftThrow()) { + i_this->current.angle.y = player->shape_angle.y + 0x4000; + } else { + i_this->current.angle.y = player->shape_angle.y - 0x4000; + } + i_this->speedF = 40.0f; + i_this->speed.y = -20.0f; + i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_BA_V_DEATH, -1); + anm_init(i_this, e_ba_class::ANM_DEAD, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f); + i_this->mTimer[0] = 60; + i_this->mMode = 2; + i_this->health = 0; + } + break; + + case 2: + if (i_this->mAcch.ChkGroundHit()) { + i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_BA_V_DEATH2, -1); + i_this->mCreatureSound.startCreatureSound(Z2SE_CM_BODYFALL_S, 0, -1); + i_this->mMode = 3; + } + // fallthrough + + case 3: + if (i_this->mTimer[0] == 0) { + ba_disappear(i_this); + fopAcM_delete(i_this); + } + break; + } + + cXyz vec1, vec2; + vec1.x = 0.0f; + vec1.y = 0.0f; + vec1.z = i_this->speedF; + mDoMtx_YrotS(*calc_mtx, i_this->current.angle.y); + MtxPosition(&vec1, &vec2); + i_this->speed.x = vec2.x; + i_this->speed.z = vec2.z; + i_this->current.pos += i_this->speed; + i_this->speed.y -= 4.0f; + if (i_this->mAcch.ChkGroundHit()) { + cLib_addCalc0(&i_this->speedF, 1.0f, 15.0f); + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -982,6 +1478,7 @@ static asm void e_ba_wolfbite(e_ba_class* param_0) { #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/e_ba_wolfbite__FP10e_ba_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80682458-8068245C 00009C 0004+00 0/1 0/0 0/0 .rodata @4654 */ @@ -999,6 +1496,45 @@ COMPILER_STRIP_GATE(0x8068245C, &lit_4655); #pragma pop /* 80680AF4-80680C98 001EF4 01A4+00 1/1 0/0 0/0 .text e_ba_wind__FP10e_ba_class */ +#ifdef NONMATCHING +// matches with literals +static void e_ba_wind(e_ba_class* i_this) { + fopAc_ac_c* boomerang = (fopAc_ac_c*)fpcM_Search(shot_b_sub, i_this); + i_this->speedF = 0.0f; + + switch (i_this->mMode) { + case 0: + anm_init(i_this, e_ba_class::ANM_FURA2, 3.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f); + i_this->mMode = 1; + i_this->mWindSpinSpeed = -(cM_rndFX(1000.0f) + 15000.0f); + i_this->mWindOffset.x = cM_rndFX(50.0f); + i_this->mWindOffset.y = cM_rndFX(50.0f); + i_this->mWindOffset.z = cM_rndFX(50.0f); + // fallthrough + + case 1: + if (boomerang == NULL) { + i_this->mMode = 2; + i_this->mTimer[0] = 60; + } else { + i_this->current.pos = boomerang->current.pos + i_this->mWindOffset; + i_this->mCreatureSound.startCreatureVoiceLevel(Z2SE_EN_BA_V_SPIN, -1); + } + break; + + case 2: + cLib_addCalcAngleS2(&i_this->mWindSpinSpeed, 0, 4, 450); + if (i_this->mTimer[0] == 0) { + i_this->mAction = e_ba_class::ACT_FIGHT_FLY; + i_this->mMode = 0; + } + } + + i_this->current.angle.y += i_this->mWindSpinSpeed; + i_this->shape_angle.y = i_this->current.angle.y; + i_this->current.angle.z = 0; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1007,6 +1543,7 @@ static asm void e_ba_wind(e_ba_class* param_0) { #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/e_ba_wind__FP10e_ba_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80682460-80682464 0000A4 0004+00 0/2 0/0 0/0 .rodata @4678 */ @@ -1031,6 +1568,38 @@ COMPILER_STRIP_GATE(0x80682468, &lit_4680); #pragma pop /* 80680C98-80680DCC 002098 0134+00 1/1 0/0 0/0 .text e_ba_appear__FP10e_ba_class */ +#ifdef NONMATCHING +// matches with literals +static void e_ba_appear(e_ba_class* i_this) { + cXyz vec; + i_this->mIFrames = 60; + + switch (i_this->mMode) { + case 0: + anm_init(i_this, e_ba_class::ANM_APPEAR, 0.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f); + i_this->mMode = 1; + i_this->mTimer[0] = cM_rndF(20.0f) + 40.0f; + i_this->speedF = 30.0f; + mDoMtx_YrotS(*calc_mtx, i_this->current.angle.y); + vec.x = 0.0f; + vec.y = 0.0f; + vec.z = 100000.0f; + MtxPosition(&vec, &i_this->mTargetPos); + i_this->mTargetPos += i_this->current.pos; + // fallthrough + + case 1: + cLib_addCalc0(&i_this->speedF, 1.0f, 0.7f); + if (i_this->mTimer[0] == 0 || i_this->speedF < 0.1f || i_this->mAcch.ChkWallHit()) { + i_this->mAction = e_ba_class::ACT_FIGHT_FLY; + i_this->mMode = 0; + } + break; + } + + fly_move(i_this); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1039,8 +1608,113 @@ static asm void e_ba_appear(e_ba_class* param_0) { #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/e_ba_appear__FP10e_ba_class.s" } #pragma pop +#endif /* 80680DCC-80681128 0021CC 035C+00 2/1 0/0 0/0 .text action__FP10e_ba_class */ +#ifdef NONMATCHING +// matches with literals +static void action(e_ba_class* i_this) { + cXyz vec1, vec2, vec3; + i_this->mPlayerAngleY = fopAcM_searchPlayerAngleY(i_this); + i_this->mPlayerDistanceXZ = fopAcM_searchPlayerDistanceXZ(i_this); + i_this->field_0x566 = 0; + damage_check(i_this); + i_this->mSph.OffAtVsPlayerBit(); + + s8 link_search = false; + switch (i_this->mAction) { + case e_ba_class::ACT_ROOF: + e_ba_roof(i_this); + break; + case e_ba_class::ACT_FIGHT_FLY: + e_ba_fight_fly(i_this); + i_this->field_0x566 = 1; + link_search = true; + break; + case e_ba_class::ACT_FIGHT: + e_ba_fight(i_this); + i_this->field_0x566 = 1; + link_search = true; + break; + case e_ba_class::ACT_ATTACK: + e_ba_attack(i_this); + i_this->mSph.OnAtVsPlayerBit(); + i_this->field_0x566 = 1; + link_search = true; + break; + case e_ba_class::ACT_RETURN: + e_ba_return(i_this); + break; + case e_ba_class::ACT_FLY: + e_ba_fly(i_this); + i_this->field_0x566 = 1; + break; + case e_ba_class::ACT_PATH_FLY: + e_ba_path_fly(i_this); + break; + case e_ba_class::ACT_CHANCE: + e_ba_chance(i_this); + break; + case e_ba_class::ACT_WOLFBITE: + e_ba_wolfbite(i_this); + break; + case e_ba_class::ACT_WIND: + e_ba_wind(i_this); + break; + case e_ba_class::ACT_APPEAR: + e_ba_appear(i_this); + link_search = true; + break; + } + + if (link_search) { + i_this->mCreatureSound.setLinkSearch(true); + } else { + i_this->mCreatureSound.setLinkSearch(false); + } + + if (i_this->mKnockbackSpeed > 0.1f) { + vec1.x = 0.0f; + vec1.y = 0.0f; + vec1.z = -i_this->mKnockbackSpeed; + mDoMtx_YrotS(*calc_mtx, i_this->mKnockbackAngle); + MtxPosition(&vec1, &vec2); + i_this->current.pos += vec2; + cLib_addCalc0(&i_this->mKnockbackSpeed, 1.0f, 5.0f); + if (i_this->mIsDying) { + i_this->shape_angle.y += 0x1300; + i_this->shape_angle.z += 0x1700; + if (i_this->mKnockbackSpeed <= 1.0f || i_this->mAcch.ChkWallHit()) { + fopAcM_delete(i_this); + if (i_this->mHomeType == e_ba_class::HOME_APPEAR) { + int item_no = dComIfGs_getLife() <= 4 ? HEART : ARROW_10; + fopAcM_createItem(&i_this->current.pos, item_no, -1, -1, NULL, NULL, 0); + fopAcM_createDisappear(i_this, &i_this->current.pos, 6, 0, 0xff); + } else { + ba_disappear(i_this); + } + } + } + } else { + if (i_this->mAction != e_ba_class::ACT_WIND) { + cLib_addCalcAngleS2(&i_this->shape_angle.y, i_this->current.angle.y, 4, 0x2000); + cLib_addCalcAngleS2(&i_this->shape_angle.x, 0, 4, 0x2000); + cLib_addCalcAngleS2(&i_this->shape_angle.z, i_this->current.angle.z, 4, 0x2000); + } + } + + i_this->current.pos.y -= 30.0f; + i_this->old.pos.y -= 30.0f; + i_this->mAcch.CrrPos(dComIfG_Bgsp()); + i_this->current.pos.y += 30.0f; + i_this->old.pos.y += 30.0f; + + vec3.x = 0.5f; + vec3.y = 0.5f; + vec3.z = 0.5f; + setMidnaBindEffect(i_this, &i_this->mCreatureSound, &i_this->eyePos, &vec3); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1049,6 +1723,7 @@ static asm void action(e_ba_class* param_0) { #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/action__FP10e_ba_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8068246C-80682470 0000B0 0004+00 0/0 0/0 0/0 .rodata @4747 */ @@ -1073,39 +1748,184 @@ COMPILER_STRIP_GATE(0x80682474, &lit_4939); #pragma pop /* 80681128-80681734 002528 060C+00 2/1 0/0 0/0 .text daE_BA_Execute__FP10e_ba_class */ +#ifdef NONMATCHING +// matches with literals +static int daE_BA_Execute(e_ba_class* i_this) { + daPy_py_c* player = static_cast(dComIfGp_getPlayer(0)); + + i_this->mCounter++; + for (int i = 0; i < 4; i++) { + if (i_this->mTimer[i] != 0) { + i_this->mTimer[i]--; + } + } + if (i_this->mIFrames != 0) { + i_this->mIFrames--; + } + + action(i_this); + + i_this->mpMorf->play(0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + + if ((i_this->mAnm == e_ba_class::ANM_HOVERING || i_this->mAnm == e_ba_class::ANM_FLY)) { + if (i_this->mpMorf->checkFrame(4.0f)) { + if (i_this->mAnm == e_ba_class::ANM_HOVERING) { + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_BA_WING, 0, -1); + } else { + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_BA_WING, 0, -1); + } + } + } else if (i_this->mAnm == e_ba_class::ANM_FURA2) { + if (i_this->mpMorf->checkFrame(0.0f)) { + i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_BA_V_FURA, -1); + } + } + + J3DModel* model = i_this->mpMorf->getModel(); + if (i_this->mAction == e_ba_class::ACT_WOLFBITE && i_this->mMode < 2) { + fopAcM_OffStatus(i_this, 0); + i_this->attention_info.flags = 0; + MTXCopy(daPy_getLinkPlayerActorClass()->getWolfMouthMatrix(), mDoMtx_stack_c::get()); + model->setBaseTRMtx(mDoMtx_stack_c::get()); + mDoMtx_stack_c::multVecZero(&i_this->current.pos); + } else { + if (i_this->health > 0 && !i_this->mIsDying + && player->current.pos.y < i_this->current.pos.y) { + fopAcM_OnStatus(i_this, 0); + i_this->attention_info.flags = 4; + } else { + fopAcM_OffStatus(i_this, 0); + i_this->attention_info.flags = 0; + } + mDoMtx_stack_c::transS(i_this->current.pos.x, i_this->current.pos.y, i_this->current.pos.z); + mDoMtx_stack_c::YrotM(i_this->shape_angle.y); + mDoMtx_stack_c::ZrotM(i_this->shape_angle.z); + mDoMtx_stack_c::scaleM(l_HIO.mScale, l_HIO.mScale, l_HIO.mScale); + model->setBaseTRMtx(mDoMtx_stack_c::get()); + } + + i_this->mpMorf->modelCalc(); + MTXCopy(model->getAnmMtx(2), *calc_mtx); + + cXyz zero; + zero.set(0.0f, 0.0f, 0.0f); + MtxPosition(&zero, &i_this->eyePos); + i_this->attention_info.position = i_this->eyePos; + i_this->attention_info.position.y += 20.0f; + + cXyz center; + zero.set(0.0f, 0.0f, 0.0f); + MtxPosition(&zero, ¢er); + if (i_this->mIFrames != 0) { + center.z -= 20000.0f; + } + i_this->mSph.SetC(center); + i_this->mSph.SetR(l_HIO.mScale * 30.0f); + dComIfG_Ccsp()->Set(&i_this->mSph); + + if (i_this->mType != e_ba_class::TYPE_NORMAL) { + i_this->field_0x6b0 = i_this->current.pos - i_this->old.pos; + i_this->field_0x6b0 *= 0.6f; + if (i_this->mType == e_ba_class::TYPE_FIRE) { + static u16 fire_name[4] = {0x8216, 0x8217, 0x8218, 0x8219}; + if (i_this->mAction != e_ba_class::ACT_APPEAR) { + for (int i = 0; i < 4; i++) { + i_this->mParticleKey[i] = + dComIfGp_particle_set(i_this->mParticleKey[i], fire_name[i], + &i_this->current.pos, NULL, NULL); + JPABaseEmitter* emitter = dComIfGp_particle_getEmitter(i_this->mParticleKey[i]); + if (emitter != NULL) { + emitter->setGlobalSRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(18)); + emitter->setParticleCallBackPtr(dPa_control_c::getParticleTracePCB()); + emitter->setUserWork((u32)&i_this->field_0x6b0); + } + } + i_this->mCreatureSound.startCreatureSoundLevel(Z2SE_EN_BA_FIRE, 0, -1); + } + } else { + static u16 ice_name[3] = {0x821a, 0x821b, 0x821c}; + for (int i = 0; i < 3; i++) { + i_this->mParticleKey[i] = + dComIfGp_particle_set(i_this->mParticleKey[i], ice_name[i], + &i_this->current.pos, NULL, NULL); + JPABaseEmitter* emitter = dComIfGp_particle_getEmitter(i_this->mParticleKey[i]); + if (emitter != NULL) { + emitter->setGlobalSRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(18)); + emitter->setParticleCallBackPtr(dPa_control_c::getParticleTracePCB()); + emitter->setUserWork((u32)&i_this->field_0x6b0); + } + } + } + } + + i_this->attention_info.flags |= 0x200000; + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void daE_BA_Execute(e_ba_class* param_0) { +static asm int daE_BA_Execute(e_ba_class* param_0) { nofralloc #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/daE_BA_Execute__FP10e_ba_class.s" } #pragma pop +#endif /* 80681734-8068173C 002B34 0008+00 1/0 0/0 0/0 .text daE_BA_IsDelete__FP10e_ba_class */ -static bool daE_BA_IsDelete(e_ba_class* param_0) { +static int daE_BA_IsDelete(e_ba_class* i_this) { return true; } /* 8068173C-806817A0 002B3C 0064+00 1/0 0/0 0/0 .text daE_BA_Delete__FP10e_ba_class */ +#ifdef NONMATCHING +// matches with static data +static int daE_BA_Delete(e_ba_class* i_this) { + dComIfG_resDelete(&i_this->mPhase, i_this->mArcName); + if (i_this->mHIOInit) { + hioInit = false; + } + if (i_this->heap != NULL) { + i_this->mpMorf->stopZelAnime(); + } + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void daE_BA_Delete(e_ba_class* param_0) { +static asm int daE_BA_Delete(e_ba_class* param_0) { nofralloc #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/daE_BA_Delete__FP10e_ba_class.s" } #pragma pop +#endif /* 806817A0-80681890 002BA0 00F0+00 1/1 0/0 0/0 .text useHeapInit__FP10fopAc_ac_c */ +#ifdef NONMATCHING +// matches with literals +static int useHeapInit(fopAc_ac_c* i_this) { + e_ba_class* _this = static_cast(i_this); + _this->mpMorf = new mDoExt_McaMorfSO( + static_cast(dComIfG_getObjectRes(_this->mArcName, 13)), NULL, NULL, + static_cast(dComIfG_getObjectRes(_this->mArcName, 10)), + 2, 1.0f, 0, -1, &_this->mCreatureSound, 0x80000, 0x11000084); + if (_this->mpMorf == NULL || _this->mpMorf->mpModel == NULL) { + return 0; + } else { + return 1; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void useHeapInit(fopAc_ac_c* param_0) { +static asm int useHeapInit(fopAc_ac_c* param_0) { nofralloc #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/useHeapInit__FP10fopAc_ac_c.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80682478-8068247C 0000BC 0004+00 0/1 0/0 0/0 .rodata @5134 */ @@ -1136,15 +1956,126 @@ COMPILER_STRIP_GATE(0x80682484, &lit_5137); #pragma pop /* 80681890-80681CEC 002C90 045C+00 1/0 0/0 0/0 .text daE_BA_Create__FP10fopAc_ac_c */ +#ifdef NONMATCHING +// matches with literals +static cPhs__Step daE_BA_Create(fopAc_ac_c* i_this) { + static char* arc_name[3] = {"E_ba", "E_fb", "E_ib"}; + + static dCcD_SrcSph cc_sph_src = { + { + {0x0, {{AT_TYPE_CSTATUE_SWING, 0x1, 0xd}, {0xd8fbfdff, 0x3}, 0x75}}, // mObj + {dCcD_SE_HARD_BODY, 0x0, 0x0, 0x0, 0x0}, // mGObjAt + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg + {0x0}, // mGObjCo + }, // mObjInf + { + {{0.0f, 0.0f, 0.0f}, 40.0f} // mSph + } // mSphAttr + }; + + fopAcM_SetupActor(i_this, e_ba_class); + e_ba_class* _this = static_cast(i_this); + + _this->mType = (fopAcM_GetParam(_this) & 0xf000) >> 12; + if (_this->mType > 2) { + _this->mType = e_ba_class::TYPE_NORMAL; + } + _this->mArcName = arc_name[_this->mType]; + + cPhs__Step step = (cPhs__Step)dComIfG_resLoad(&_this->mPhase, _this->mArcName); + + if (step == cPhs_COMPLEATE_e) { + int sw = fopAcM_GetParam(_this) >> 24; + if (sw != 0xff && dComIfGs_isSwitch(sw, fopAcM_GetRoomNo(_this))) { + return cPhs_ERROR_e; + } + + _this->mHomeType = fopAcM_GetParam(_this) & 0xff; + _this->mDistanceParam = (fopAcM_GetParam(_this) >> 8) & 0xf; + _this->mPathIndex = (fopAcM_GetParam(_this) >> 16) & 0xff; + if (_this->mHomeType == 0xff) { + _this->mHomeType = e_ba_class::HOME_ROOF; + } + if (_this->mDistanceParam == 0xf) { + _this->mDistanceParam = 10; + } + + _this->mFightFlyDistance = (f32)_this->mDistanceParam * 100.0f; + if (fopAcM_SearchByName(PROC_E_PZ) != NULL) { + _this->mFightFlyDistance = 100000.0f; + } + + if (!fopAcM_entrySolidHeap(_this, useHeapInit, 0x2000)) { + return cPhs_ERROR_e; + } + + if (_this->mPathIndex != 0xff) { + _this->mpPath = dPath_GetRoomPath(_this->mPathIndex, fopAcM_GetRoomNo(_this)); + if (_this->mpPath == NULL) { + return cPhs_ERROR_e; + } + _this->field_0x5bc = _this->mPathIndex + 1; + _this->mPathStep = 1; + _this->mAction = e_ba_class::ACT_PATH_FLY; + } else { + if (_this->mHomeType == e_ba_class::HOME_FLY) { + _this->mAction = e_ba_class::ACT_FLY; + } else if (_this->mHomeType == e_ba_class::HOME_APPEAR) { + _this->mAction = e_ba_class::ACT_APPEAR; + _this->mIFrames = 10; + } + } + + if (!hioInit) { + _this->mHIOInit = true; + hioInit = true; + l_HIO.field_0x04 = -1; + } + + _this->attention_info.flags = 4; + fopAcM_SetMtx(_this, _this->mpMorf->getModel()->getBaseTRMtx()); + fopAcM_SetMin(_this, -200.0f, -200.0f, -200.0f); + fopAcM_SetMax(_this, 200.0f, 200.0f, 200.0f); + _this->health = 1; + _this->field_0x560 = 1; + + _this->mStts.Init(30, 0, _this); + _this->mSph.Set(cc_sph_src); + _this->mSph.SetStts(&_this->mStts); + if (_this->mType == e_ba_class::TYPE_FIRE) { + _this->mSph.SetAtType(0x100); + _this->mSph.SetAtMtrl(1); + } else if (_this->mType == e_ba_class::TYPE_ICE) { + _this->mSph.SetAtType(0x100); + _this->mSph.SetAtMtrl(2); + } + + _this->mAcch.Set(fopAcM_GetPosition_p(_this), fopAcM_GetOldPosition_p(_this), _this, + 1, &_this->mAcchCir, fopAcM_GetSpeed_p(_this), NULL, NULL); + _this->mAcchCir.SetWall(50.0f, 50.0f); + + _this->mCreatureSound.init(&_this->current.pos, &_this->eyePos, 3, 1); + _this->mCreatureSound.setEnemyName("E_ba"); + _this->mAtInfo.mpSound = &_this->mCreatureSound; + _this->mAtInfo.mPowerType = 1; + _this->mCounter = cM_rndF(0x10000); + + daE_BA_Execute(_this); + } + return step; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void daE_BA_Create(fopAc_ac_c* param_0) { +static asm cPhs__Step daE_BA_Create(fopAc_ac_c* param_0) { nofralloc #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/daE_BA_Create__FP10fopAc_ac_c.s" } #pragma pop +#endif +#ifndef NONMATCHING /* 80681CEC-80681D34 0030EC 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGSphFv */ #pragma push #pragma optimization_level 0 @@ -1182,7 +2113,8 @@ extern "C" asm void __dt__10dCcD_GSttsFv() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm dBgS_ObjAcch::~dBgS_ObjAcch() { +// asm dBgS_ObjAcch::~dBgS_ObjAcch() { +extern "C" asm void __dt__12dBgS_ObjAcchFv() { nofralloc #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/__dt__12dBgS_ObjAcchFv.s" } @@ -1192,7 +2124,8 @@ asm dBgS_ObjAcch::~dBgS_ObjAcch() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm dBgS_AcchCir::~dBgS_AcchCir() { +// asm dBgS_AcchCir::~dBgS_AcchCir() { +extern "C" asm void __dt__12dBgS_AcchCirFv() { nofralloc #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/__dt__12dBgS_AcchCirFv.s" } @@ -1213,7 +2146,8 @@ extern "C" asm void __dt__10cCcD_GSttsFv() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm daE_BA_HIO_c::~daE_BA_HIO_c() { +// asm daE_BA_HIO_c::~daE_BA_HIO_c() { +extern "C" asm void __dt__12daE_BA_HIO_cFv() { nofralloc #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/__dt__12daE_BA_HIO_cFv.s" } @@ -1253,13 +2187,14 @@ static asm void func_80681F8C() { #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/func_80681F8C.s" } #pragma pop +#endif /* 80681F94-806823A8 003394 0414+00 1/1 0/0 0/0 .text * setMidnaBindEffect__FP13fopEn_enemy_cP15Z2CreatureEnemyP4cXyzP4cXyz */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void setMidnaBindEffect(fopEn_enemy_c* param_0, Z2CreatureEnemy* param_1, cXyz* param_2, +static asm int setMidnaBindEffect(fopEn_enemy_c* param_0, Z2CreatureEnemy* param_1, cXyz* param_2, cXyz* param_3) { nofralloc #include "asm/rel/d/a/e/d_a_e_ba/d_a_e_ba/setMidnaBindEffect__FP13fopEn_enemy_cP15Z2CreatureEnemyP4cXyzP4cXyz.s"