diff --git a/Progress.md b/Progress.md index c28923e14ab..aa03ae95bef 100644 --- a/Progress.md +++ b/Progress.md @@ -7,22 +7,22 @@ Section | Percentage | Decompiled (bytes) | Total (bytes) .init | 97.972973% | 9280 | 9472 .extab | 100.000000% | 96 | 96 .extabindex | 100.000000% | 96 | 96 -.text | 24.818381% | 892604 | 3596544 +.text | 24.821940% | 892732 | 3596544 .ctors | 100.000000% | 448 | 448 .dtors | 100.000000% | 32 | 32 .rodata | 100.000000% | 193856 | 193856 .data | 100.000000% | 197632 | 197632 .sdata | 100.000000% | 1408 | 1408 .sdata2 | 100.000000% | 20832 | 20832 -Total | 32.744278% | 1316540 | 4020672 +Total | 32.747461% | 1316668 | 4020672 ## Total Section | Percentage | Decompiled (bytes) | Total (bytes) ---|---|---|--- -main.dol | 32.744278% | 1316540 | 4020672 -RELs | 33.371790% | 3837864 | 11500324 -Total | 33.209235% | 5154404 | 15520996 +main.dol | 32.747461% | 1316668 | 4020672 +RELs | 33.375199% | 3838256 | 11500324 +Total | 33.212585% | 5154924 | 15520996 ## RELs @@ -172,7 +172,7 @@ d_a_e_yd | 27.879315% | 7688 | 27576 d_a_e_yd_leaf | 54.022989% | 1128 | 2088 d_a_e_yg | 28.386013% | 7436 | 26196 d_a_e_yh | 26.277603% | 9996 | 38040 -d_a_e_yk | 29.001484% | 5472 | 18868 +d_a_e_yk | 31.079076% | 5864 | 18868 d_a_e_ym | 20.062370% | 13896 | 69264 d_a_e_ym_tag | 100.000000% | 1088 | 1088 d_a_e_ymb | 23.798093% | 14672 | 61652 @@ -785,4 +785,4 @@ d_a_vrbox2 | 34.977578% | 2184 | 6244 d_a_warp_bug | 54.940711% | 1112 | 2024 d_a_ykgr | 44.400631% | 2252 | 5072 f_pc_profile_lst | 100.000000% | 28156 | 28156 -Total | 33.371790% | 3837864 | 11500324 +Total | 33.375199% | 3838256 | 11500324 diff --git a/asm/c/c_damagereaction/cDmrNowMidnaTalk__Fv.s b/asm/c/c_damagereaction/cDmrNowMidnaTalk__Fv.s deleted file mode 100644 index d41d73fb76a..00000000000 --- a/asm/c/c_damagereaction/cDmrNowMidnaTalk__Fv.s +++ /dev/null @@ -1,36 +0,0 @@ -lbl_800182A8: -/* 800182A8 94 21 FF F0 */ stwu r1, -0x10(r1) -/* 800182AC 7C 08 02 A6 */ mflr r0 -/* 800182B0 90 01 00 14 */ stw r0, 0x14(r1) -/* 800182B4 3C 60 80 40 */ lis r3, g_dComIfG_gameInfo@ha /* 0x804061C0@ha */ -/* 800182B8 38 63 61 C0 */ addi r3, r3, g_dComIfG_gameInfo@l /* 0x804061C0@l */ -/* 800182BC 88 03 4F AD */ lbz r0, 0x4fad(r3) -/* 800182C0 28 00 00 00 */ cmplwi r0, 0 -/* 800182C4 41 82 00 50 */ beq lbl_80018314 -/* 800182C8 80 63 5D B4 */ lwz r3, 0x5db4(r3) -/* 800182CC 48 00 38 49 */ bl fopAcM_getTalkEventPartner__FPC10fopAc_ac_c -/* 800182D0 28 03 00 00 */ cmplwi r3, 0 -/* 800182D4 41 82 00 40 */ beq lbl_80018314 -/* 800182D8 A8 03 00 08 */ lha r0, 8(r3) -/* 800182DC 2C 00 00 FF */ cmpwi r0, 0xff -/* 800182E0 41 82 00 2C */ beq lbl_8001830C -/* 800182E4 2C 00 02 C1 */ cmpwi r0, 0x2c1 -/* 800182E8 41 82 00 24 */ beq lbl_8001830C -/* 800182EC 2C 00 02 C4 */ cmpwi r0, 0x2c4 -/* 800182F0 41 82 00 1C */ beq lbl_8001830C -/* 800182F4 2C 00 00 EC */ cmpwi r0, 0xec -/* 800182F8 41 82 00 14 */ beq lbl_8001830C -/* 800182FC 2C 00 02 C3 */ cmpwi r0, 0x2c3 -/* 80018300 41 82 00 0C */ beq lbl_8001830C -/* 80018304 2C 00 02 C7 */ cmpwi r0, 0x2c7 -/* 80018308 40 82 00 0C */ bne lbl_80018314 -lbl_8001830C: -/* 8001830C 38 60 00 01 */ li r3, 1 -/* 80018310 48 00 00 08 */ b lbl_80018318 -lbl_80018314: -/* 80018314 38 60 00 00 */ li r3, 0 -lbl_80018318: -/* 80018318 80 01 00 14 */ lwz r0, 0x14(r1) -/* 8001831C 7C 08 03 A6 */ mtlr r0 -/* 80018320 38 21 00 10 */ addi r1, r1, 0x10 -/* 80018324 4E 80 00 20 */ blr diff --git a/asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/daE_YK_Delete__FP10e_yk_class.s b/asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/daE_YK_Delete__FP10e_yk_class.s deleted file mode 100644 index 03b8a9fc7e8..00000000000 --- a/asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/daE_YK_Delete__FP10e_yk_class.s +++ /dev/null @@ -1,29 +0,0 @@ -lbl_80807094: -/* 80807094 94 21 FF F0 */ stwu r1, -0x10(r1) -/* 80807098 7C 08 02 A6 */ mflr r0 -/* 8080709C 90 01 00 14 */ stw r0, 0x14(r1) -/* 808070A0 93 E1 00 0C */ stw r31, 0xc(r1) -/* 808070A4 7C 7F 1B 78 */ mr r31, r3 -/* 808070A8 38 7F 05 AC */ addi r3, r31, 0x5ac -/* 808070AC 3C 80 80 80 */ lis r4, d_a_e_yk__stringBase0@ha /* 0x80807D64@ha */ -/* 808070B0 38 84 7D 64 */ addi r4, r4, d_a_e_yk__stringBase0@l /* 0x80807D64@l */ -/* 808070B4 4B 82 5F 55 */ bl dComIfG_resDelete__FP30request_of_phase_process_classPCc -/* 808070B8 88 1F 0A 8C */ lbz r0, 0xa8c(r31) -/* 808070BC 28 00 00 00 */ cmplwi r0, 0 -/* 808070C0 41 82 00 10 */ beq lbl_808070D0 -/* 808070C4 38 00 00 00 */ li r0, 0 -/* 808070C8 3C 60 80 80 */ lis r3, data_80807EF8@ha /* 0x80807EF8@ha */ -/* 808070CC 98 03 7E F8 */ stb r0, data_80807EF8@l(r3) /* 0x80807EF8@l */ -lbl_808070D0: -/* 808070D0 80 1F 00 F0 */ lwz r0, 0xf0(r31) -/* 808070D4 28 00 00 00 */ cmplwi r0, 0 -/* 808070D8 41 82 00 0C */ beq lbl_808070E4 -/* 808070DC 80 7F 05 C0 */ lwz r3, 0x5c0(r31) -/* 808070E0 4B 80 A2 31 */ bl stopZelAnime__16mDoExt_McaMorfSOFv -lbl_808070E4: -/* 808070E4 38 60 00 01 */ li r3, 1 -/* 808070E8 83 E1 00 0C */ lwz r31, 0xc(r1) -/* 808070EC 80 01 00 14 */ lwz r0, 0x14(r1) -/* 808070F0 7C 08 03 A6 */ mtlr r0 -/* 808070F4 38 21 00 10 */ addi r1, r1, 0x10 -/* 808070F8 4E 80 00 20 */ blr diff --git a/asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/daE_YK_Draw__FP10e_yk_class.s b/asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/daE_YK_Draw__FP10e_yk_class.s deleted file mode 100644 index 9c85ae7f525..00000000000 --- a/asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/daE_YK_Draw__FP10e_yk_class.s +++ /dev/null @@ -1,43 +0,0 @@ -lbl_80804A90: -/* 80804A90 94 21 FF F0 */ stwu r1, -0x10(r1) -/* 80804A94 7C 08 02 A6 */ mflr r0 -/* 80804A98 90 01 00 14 */ stw r0, 0x14(r1) -/* 80804A9C 93 E1 00 0C */ stw r31, 0xc(r1) -/* 80804AA0 93 C1 00 08 */ stw r30, 8(r1) -/* 80804AA4 7C 7E 1B 78 */ mr r30, r3 -/* 80804AA8 80 63 05 C0 */ lwz r3, 0x5c0(r3) -/* 80804AAC 83 E3 00 04 */ lwz r31, 4(r3) -/* 80804AB0 3C 60 80 43 */ lis r3, g_env_light@ha /* 0x8042CA54@ha */ -/* 80804AB4 38 63 CA 54 */ addi r3, r3, g_env_light@l /* 0x8042CA54@l */ -/* 80804AB8 38 80 00 02 */ li r4, 2 -/* 80804ABC 38 BE 04 D0 */ addi r5, r30, 0x4d0 -/* 80804AC0 38 DE 01 0C */ addi r6, r30, 0x10c -/* 80804AC4 4B 99 ED 01 */ bl settingTevStruct__18dScnKy_env_light_cFiP4cXyzP12dKy_tevstr_c -/* 80804AC8 3C 60 80 43 */ lis r3, g_env_light@ha /* 0x8042CA54@ha */ -/* 80804ACC 38 63 CA 54 */ addi r3, r3, g_env_light@l /* 0x8042CA54@l */ -/* 80804AD0 80 9F 00 04 */ lwz r4, 4(r31) -/* 80804AD4 38 BE 01 0C */ addi r5, r30, 0x10c -/* 80804AD8 4B 9A 02 C9 */ bl setLightTevColorType_MAJI__18dScnKy_env_light_cFP12J3DModelDataP12dKy_tevstr_c -/* 80804ADC 3C 60 80 40 */ lis r3, g_dComIfG_gameInfo@ha /* 0x804061C0@ha */ -/* 80804AE0 38 83 61 C0 */ addi r4, r3, g_dComIfG_gameInfo@l /* 0x804061C0@l */ -/* 80804AE4 80 04 5F 88 */ lwz r0, 0x5f88(r4) -/* 80804AE8 3C 60 80 43 */ lis r3, j3dSys@ha /* 0x80434AC8@ha */ -/* 80804AEC 3B E3 4A C8 */ addi r31, r3, j3dSys@l /* 0x80434AC8@l */ -/* 80804AF0 90 1F 00 48 */ stw r0, 0x48(r31) -/* 80804AF4 80 04 5F 8C */ lwz r0, 0x5f8c(r4) -/* 80804AF8 90 1F 00 4C */ stw r0, 0x4c(r31) -/* 80804AFC 80 7E 05 C0 */ lwz r3, 0x5c0(r30) -/* 80804B00 4B 80 C6 C1 */ bl entryDL__16mDoExt_McaMorfSOFv -/* 80804B04 3C 60 80 40 */ lis r3, g_dComIfG_gameInfo@ha /* 0x804061C0@ha */ -/* 80804B08 38 63 61 C0 */ addi r3, r3, g_dComIfG_gameInfo@l /* 0x804061C0@l */ -/* 80804B0C 80 03 5F 80 */ lwz r0, 0x5f80(r3) -/* 80804B10 90 1F 00 48 */ stw r0, 0x48(r31) -/* 80804B14 80 03 5F 84 */ lwz r0, 0x5f84(r3) -/* 80804B18 90 1F 00 4C */ stw r0, 0x4c(r31) -/* 80804B1C 38 60 00 01 */ li r3, 1 -/* 80804B20 83 E1 00 0C */ lwz r31, 0xc(r1) -/* 80804B24 83 C1 00 08 */ lwz r30, 8(r1) -/* 80804B28 80 01 00 14 */ lwz r0, 0x14(r1) -/* 80804B2C 7C 08 03 A6 */ mtlr r0 -/* 80804B30 38 21 00 10 */ addi r1, r1, 0x10 -/* 80804B34 4E 80 00 20 */ blr diff --git a/asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/shot_b_sub__FPvPv.s b/asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/shot_b_sub__FPvPv.s deleted file mode 100644 index d8ce21449ad..00000000000 --- a/asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/shot_b_sub__FPvPv.s +++ /dev/null @@ -1,33 +0,0 @@ -lbl_80804B38: -/* 80804B38 94 21 FF F0 */ stwu r1, -0x10(r1) -/* 80804B3C 7C 08 02 A6 */ mflr r0 -/* 80804B40 90 01 00 14 */ stw r0, 0x14(r1) -/* 80804B44 93 E1 00 0C */ stw r31, 0xc(r1) -/* 80804B48 7C 7F 1B 78 */ mr r31, r3 -/* 80804B4C 4B 81 41 95 */ bl fopAc_IsActor__FPv -/* 80804B50 2C 03 00 00 */ cmpwi r3, 0 -/* 80804B54 41 82 00 44 */ beq lbl_80804B98 -/* 80804B58 A8 1F 00 08 */ lha r0, 8(r31) -/* 80804B5C 2C 00 00 FE */ cmpwi r0, 0xfe -/* 80804B60 40 82 00 38 */ bne lbl_80804B98 -/* 80804B64 3C 60 80 40 */ lis r3, g_dComIfG_gameInfo@ha /* 0x804061C0@ha */ -/* 80804B68 38 63 61 C0 */ addi r3, r3, g_dComIfG_gameInfo@l /* 0x804061C0@l */ -/* 80804B6C 80 03 5F 18 */ lwz r0, 0x5f18(r3) -/* 80804B70 54 00 03 19 */ rlwinm. r0, r0, 0, 0xc, 0xc -/* 80804B74 40 82 00 24 */ bne lbl_80804B98 -/* 80804B78 4B 95 AD 25 */ bl checkBoomerangCharge__9daPy_py_cFv -/* 80804B7C 54 60 06 3F */ clrlwi. r0, r3, 0x18 -/* 80804B80 41 82 00 18 */ beq lbl_80804B98 -/* 80804B84 80 1F 00 B0 */ lwz r0, 0xb0(r31) -/* 80804B88 28 00 00 01 */ cmplwi r0, 1 -/* 80804B8C 40 82 00 0C */ bne lbl_80804B98 -/* 80804B90 7F E3 FB 78 */ mr r3, r31 -/* 80804B94 48 00 00 08 */ b lbl_80804B9C -lbl_80804B98: -/* 80804B98 38 60 00 00 */ li r3, 0 -lbl_80804B9C: -/* 80804B9C 83 E1 00 0C */ lwz r31, 0xc(r1) -/* 80804BA0 80 01 00 14 */ lwz r0, 0x14(r1) -/* 80804BA4 7C 08 03 A6 */ mtlr r0 -/* 80804BA8 38 21 00 10 */ addi r1, r1, 0x10 -/* 80804BAC 4E 80 00 20 */ blr diff --git a/include/SSystem/SComponent/c_cc_d.h b/include/SSystem/SComponent/c_cc_d.h index 844d8449c6d..f37db70369a 100644 --- a/include/SSystem/SComponent/c_cc_d.h +++ b/include/SSystem/SComponent/c_cc_d.h @@ -48,6 +48,7 @@ enum cCcD_ObjAtType { /* 0x10000000 */ AT_TYPE_10000000 = (1 << 28), /* 0x40000000 */ AT_TYPE_WOLF_CUT_TURN = (1 << 30), /* 0x80000000 */ AT_TYPE_WOLF_ATTACK = (1 << 31), + /* 0xD8000000 */ AT_TYPE_UNK = 0xD8000000 }; class cCcD_ShapeAttr { @@ -454,6 +455,8 @@ public: void OnTgSetBit() { mObjTg.OnSPrmBit(1); } void OffTgSetBit() { mObjTg.ClrSet(); } void OnCoSetBit() { mObjCo.OnSPrmBit(1); } + void OffAtVsPlayerBit() { mObjAt.OffSPrmBit(0xC); } + void OnAtVsPlayerBit() { mObjAt.OnSPrmBit(0xC); } }; // Size = 0x40 diff --git a/include/Z2AudioLib/Z2SeMgr.h b/include/Z2AudioLib/Z2SeMgr.h index d3a63a3562c..3f701467331 100644 --- a/include/Z2AudioLib/Z2SeMgr.h +++ b/include/Z2AudioLib/Z2SeMgr.h @@ -2400,14 +2400,14 @@ enum Z2SoundID { Z2SE_EN_BA_V_FURA = 0x701C5, Z2SE_EN_BA_FIRE = 0x701C6, Z2SE_EN_YK_WING = 0x701C7, - Z2SE_EN_YK_V_NAKU = 0x701C8, - Z2SE_EN_YK_V_ATTACK = 0x701C9, - Z2SE_EN_YK_V_DEATH = 0x701CA, - Z2SE_EN_YK_V_BITE = 0x701CB, - Z2SE_EN_YK_V_DEATH2 = 0x701CC, - Z2SE_EN_YK_V_FURA = 0x701CD, + Z2SE_EN_YK_V_NAKU = 0x701C8, // shadow keese - cry/screech + Z2SE_EN_YK_V_ATTACK = 0x701C9, // shadow keese - attack + Z2SE_EN_YK_V_DEATH = 0x701CA, // shadow keese - death + Z2SE_EN_YK_V_BITE = 0x701CB, // shadow keese - bite + Z2SE_EN_YK_V_DEATH2 = 0x701CC, // shadow keese - death2 + Z2SE_EN_YK_V_FURA = 0x701CD, // shadow keese - unsteady Z2SE_EN_BA_V_SPIN = 0x701CE, - Z2SE_EN_YK_V_SPIN = 0x701CF, + Z2SE_EN_YK_V_SPIN = 0x701CF, // shadow keese - spinning in gale boomerang wind Z2SE_EN_YG_V_NAKU = 0x701D0, Z2SE_EN_YG_V_FIND = 0x701D1, Z2SE_EN_YG_V_DEATH = 0x701D2, @@ -2463,7 +2463,7 @@ enum Z2SoundID { Z2SE_EN_GOB_HELMET_MELT = 0x70204, Z2SE_EN_GOB_KNUCKLES_FRICTION = 0x70205, Z2SE_EN_BA_V_FAINT = 0x70206, - Z2SE_EN_YK_V_FAINT = 0x70207, + Z2SE_EN_YK_V_FAINT = 0x70207, // shadow keese - bouncing on ground during chance Z2SE_EN_HZ_V_WALK = 0x70208, Z2SE_EN_HZ_WALK = 0x70209, Z2SE_EN_HZ_V_WIND_NAKU = 0x7020A, diff --git a/include/d/a/d_a_player.h b/include/d/a/d_a_player.h index 34e238107ae..6ebfbd85265 100644 --- a/include/d/a/d_a_player.h +++ b/include/d/a/d_a_player.h @@ -274,6 +274,7 @@ public: FLG2_UNK_200 = 0x200, FLG2_UNK_80 = 0x80, FLG2_UNK_40 = 0x40, + FLG2_WOLF_ENEMY_LEFT_THROW = 0x20, FLG2_UNK_10 = 0x10, FLG2_UNK_8 = 8, FLG2_UNK_2 = 2, @@ -762,14 +763,18 @@ public: inline BOOL i_checkSwordGet(); inline bool i_checkShieldGet() const; inline static BOOL checkNowWolf(); - inline static BOOL i_checkNowWolf() { - return dComIfGp_getLinkPlayer()->i_checkWolf(); - } + inline static BOOL i_checkNowWolf() { return dComIfGp_getLinkPlayer()->i_checkWolf(); } inline bool checkZoraWearFlg() const; inline bool checkMagicArmorWearFlg() const; static daMidna_c* getMidnaActor() { return m_midnaActor; } + // not sure how to define this properly + // static void onWolfEnemyCatch(fopAc_ac_c* i_actorP) { onWolfEnemyBiteAll(i_actorP,8);} + + bool checkWolfEnemyCatchOwn(fopAc_ac_c* i_actorP) { return checkWolfEnemyBiteAllOwn(i_actorP); } + bool checkWolfEnemyLeftThrow() const { return i_checkNoResetFlg2(FLG2_WOLF_ENEMY_LEFT_THROW); } + static daMidna_c* m_midnaActor; }; diff --git a/include/d/cc/d_cc_d.h b/include/d/cc/d_cc_d.h index 1105b7c0e8d..5c8ed40c72f 100644 --- a/include/d/cc/d_cc_d.h +++ b/include/d/cc/d_cc_d.h @@ -1,6 +1,11 @@ #ifndef D_CC_D_CC_D_H #define D_CC_D_CC_D_H +/** + * d_cc_d.h + * Actor Collision + */ + #include "SSystem/SComponent/c_cc_d.h" #include "dolphin/types.h" @@ -134,6 +139,8 @@ public: class dCcD_GObjInf; typedef void (*dCcD_HitCallback)(fopAc_ac_c*, dCcD_GObjInf*, fopAc_ac_c*, dCcD_GObjInf*); + +// Attack/Defense/Correction Collider Common Base class dCcD_GAtTgCoCommonBase { public: /* 0x00 */ u32 mGFlag; @@ -171,6 +178,8 @@ public: dCcD_HitCallback GetHitCallback() { return mHitCallback; } }; // Size = 0x1C + +// Attack (At) Collider class dCcD_GObjAt : public dCcD_GAtTgCoCommonBase { public: /* 80083944 */ void Set(dCcD_SrcGObjAt const&); @@ -199,6 +208,7 @@ public: /* 0x38 */ cXyz mRVec; }; // Size = 0x44 +// Defense (Tg) Collider class dCcD_GObjTg : public dCcD_GAtTgCoCommonBase { public: /* 800839A0 */ void Set(dCcD_SrcGObjTg const&); @@ -229,11 +239,13 @@ private: /* 0x48 */ s16 mShieldRange; }; // Size = 0x4A ? +// Correction (Co) Collider class dCcD_GObjCo : public dCcD_GAtTgCoCommonBase { public: /* 80083B8C */ virtual ~dCcD_GObjCo() {} }; // Size = 0x1C ? +// Object Info class dCcD_GObjInf : public cCcD_GObjInf { public: /* 80083A28 */ dCcD_GObjInf(); @@ -343,6 +355,7 @@ protected: /* 0x0E8 */ dCcD_GObjCo mGObjCo; }; // Size = 0x104 +// Cylinder class dCcD_Cyl : public dCcD_GObjInf, public cCcD_CylAttr { public: /* 800848B4 */ void Set(dCcD_SrcCyl const&); @@ -354,6 +367,7 @@ public: dCcD_Cyl() {} }; // Size = 0x13C +// Sphere class dCcD_Sph : public dCcD_GObjInf, public cCcD_SphAttr { public: dCcD_Sph() {} @@ -364,6 +378,8 @@ public: /* 80084BF4 */ virtual ~dCcD_Sph() {} }; // Size = 0x138 + +// Capsule class dCcD_Cps : public dCcD_GObjInf, public cCcD_CpsAttr { public: /* 800847D0 */ void Set(dCcD_SrcCps const&); @@ -374,6 +390,7 @@ public: dCcD_Cps() {} }; // Size = 0x144 +// Triangle class dCcD_Tri : public dCcD_GObjInf, public cCcD_TriAttr { public: /* 80084884 */ void Set(dCcD_SrcTri const&); diff --git a/include/d/cc/d_cc_uty.h b/include/d/cc/d_cc_uty.h index 81719f4bf9a..3e5cf8256a1 100644 --- a/include/d/cc/d_cc_uty.h +++ b/include/d/cc/d_cc_uty.h @@ -29,4 +29,6 @@ struct dCcU_AtInfo { /* 0x20 */ u8 mHitType; }; +fopAc_ac_c* cc_at_check(fopAc_ac_c*,dCcU_AtInfo*); + #endif /* D_CC_D_CC_UTY_H */ diff --git a/include/d/s/d_s_play.h b/include/d/s/d_s_play.h index 3e13f3304fa..e497c9c62ec 100644 --- a/include/d/s/d_s_play.h +++ b/include/d/s/d_s_play.h @@ -67,7 +67,7 @@ public: /* 80259BFC */ void offReset(); static bool isPause() { return pauseTimer == 0; } - static void setPauseTimer(s8 time) { nextPauseTimer = time; } + static void setPauseTimer(s8 time) { pauseTimer = time; } static s8 pauseTimer; static s8 nextPauseTimer; diff --git a/include/f_op/f_op_actor.h b/include/f_op/f_op_actor.h index b76d3d9fe25..dbe347e0962 100644 --- a/include/f_op/f_op_actor.h +++ b/include/f_op/f_op_actor.h @@ -137,7 +137,7 @@ public: /* 0x538 */ cXyz mEyePos; /* 0x544 */ actor_attention_types mAttentionInfo; /* 0x560 */ s16 field_0x560; - /* 0x562 */ s16 field_0x562; + /* 0x562 */ s16 mHealth; /* 0x564 */ u8 field_0x564[0x4]; fopAc_ac_c(); diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index 26512744051..e71a40de48a 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -306,6 +306,10 @@ inline bool i_fopAcM_isSwitch(const fopAc_ac_c* item, int sw) { return dComIfGs_isSwitch(sw, fopAcM_GetHomeRoomNo(item)); } +inline fopAc_ac_c* i_fopAcM_SearchByName(s16 proc_id) { + return (fopAc_ac_c*)fopAcIt_Judge(fpcSch_JudgeForPName, &proc_id); +} + inline void dComIfGs_onItem(int bitNo, int roomNo); inline void fopAcM_onItem(const fopAc_ac_c* item, int bitNo) { dComIfGs_onItem(bitNo, fopAcM_GetHomeRoomNo(item)); diff --git a/include/m_Do/m_Do_ext.h b/include/m_Do/m_Do_ext.h index 40d5d75aeec..b68840f1d57 100644 --- a/include/m_Do/m_Do_ext.h +++ b/include/m_Do/m_Do_ext.h @@ -261,6 +261,7 @@ public: u8 getPlayMode() { return mFrameCtrl.getAttribute(); } bool isLoop() { return mFrameCtrl.checkState(2); } f32 getEndFrame() { return mFrameCtrl.getEnd(); } + BOOL checkFrame(f32 frame) { return mFrameCtrl.checkPass(frame); } bool isStop() { bool stopped = true; diff --git a/include/rel/d/a/e/d_a_e_yk/d_a_e_yk.h b/include/rel/d/a/e/d_a_e_yk/d_a_e_yk.h index 9331067bdf7..be52d7f2cdb 100644 --- a/include/rel/d/a/e/d_a_e_yk/d_a_e_yk.h +++ b/include/rel/d/a/e/d_a_e_yk/d_a_e_yk.h @@ -2,5 +2,95 @@ #define D_A_E_YK_H #include "dolphin/types.h" +#include "f_op/f_op_actor_mng.h" +#include "d/com/d_com_inf_game.h" +#include "d/cc/d_cc_uty.h" +#include "d/d_path.h" + +enum daE_YK_Action { + ACT_ROOF, // keese is on roof + ACT_FIGHT_FLY, // keese is transitioning from flying to aggro + ACT_FIGHT, // keese is aggroed + ACT_ATTACK, // keese is attacking + ACT_RETURN, // keese is returning to roof + ACT_FLY, // keese is flying around + ACT_PATH_FLY, // Unconfirmed: keese is flying along its path? + ACT_CHANCE = 10, // keese is stunned/fell down + ACT_WOLFBITE = 13, // keese is being bitten by wolf + ACT_WIND // keese is in the gale boomerang +}; + +// tmp struct to get HIO to match +struct daE_YK_HIO_c_tmp { + void* vtable; + /* 0x04 */ s8 field_0x04; + /* 0x08 */ f32 field_0x08; + /* 0x0C */ f32 field_0x0c; + /* 0x10 */ f32 field_0x10; + /* 0x14 */ f32 field_0x14; + /* 0x18 */ f32 field_0x18; +}; + +class daE_YK_HIO_c { +public: + /* 8080482C */ daE_YK_HIO_c(); + /* 808077E0 */ virtual ~daE_YK_HIO_c(); + + /* 0x00 */ // vtable + /* 0x04 */ s8 field_0x04; // padding after this + /* 0x08 */ f32 field_0x08; + /* 0x0C */ f32 field_0x0c; + /* 0x10 */ f32 field_0x10; + /* 0x14 */ f32 field_0x14; + /* 0x18 */ f32 field_0x18; +}; + +class e_yk_class : public fopEn_enemy_c { +public: + /* 0x5AC */ request_of_phase_process_class mPhase; + /* 0x5B4 */ u8 mParam1; // paramter - used to determine default action? + /* 0x5B5 */ u8 mPlayerTriggerBase; // parameter - base value used to determine mPlayerTrigger below + /* 0x5B6 */ u8 field_0x5b6; + /* 0x5B7 */ u8 mPathIdx; // parameter - used to lookup/set mpPath based on the room + /* 0x5B8 */ u8 field_0x5b8; + /* 0x5B9 */ s8 mPathPntIdx; // tracks the index of the points along the keese's path + /* 0x5BA */ s8 field_0x5ba; + /* 0x5BB */ u8 field_0x5bb; + /* 0x5BC */ dPath* mpPath; // flight path for keese to follow? + /* 0x5C0 */ mDoExt_McaMorfSO* mpMorfSO; // last res loaded + /* 0x5C4 */ Z2CreatureEnemy mCreature; // used for playing keese noises + /* 0x668 */ int mResIdx; // index number of last res loaded + /* 0x66C */ s16 field_0x66c; + /* 0x66E */ s16 mAction; // current action (see daE_YK_Action above) + /* 0x670 */ s16 mActionPhase; // current phase of current action + /* 0x674 */ cXyz mPathPntPos; // tracks the position of the point the keese is along a path + /* 0x680 */ s16 mAngleFromPlayer; // current keese angle from player + /* 0x684 */ f32 mDistanceXZFromPlayer; // current keese distance from player + /* 0x688 */ f32 mPlayerTrigger; // how close to the keese the player has to be before aggro + /* 0x68C */ f32 field_0x68c; + /* 0x690 */ f32 field_0x690; + /* 0x694 */ f32 field_0x694; + /* 0x698 */ s16 field_0x698; + /* 0x69A */ csXyz field_0x69a; + /* 0x6A0 */ s8 field_0x6a0; + /* 0x6A1 */ u8 field_0x6a1; + /* 0x6A2 */ s16 field_0x6a2[4]; + /* 0x6AA */ s16 field_0x6aa; + /* 0x6AC */ s16 field_0x6ac[6]; + /* 0x6B8 */ cXyz mBoomrangPosOffset; // offset position when keese caught in rang + /* 0x6C4 */ s16 mBoomrangXRotOffset; // offset x rotation when keese caught in rang + /* 0x6C8 */ dBgS_AcchCir field_0x6c8; + /* 0x708 */ dBgS_ObjAcch field_0x708; + /* 0x8E0 */ dCcD_Stts mCollisionStatus; // collision status + /* 0x91C */ dCcD_Sph mCollisionSphere; // collision sphere + /* 0xA54 */ dCcU_AtInfo mAtColliderInfo; // attack collider info (used when keese gets hit) + /* 0xA78 */ u32 field_0xa78; + /* 0xA7C */ u32 field_0xa7c; + /* 0xA80 */ u32 field_0xa80; + /* 0xA84 */ u32 mParticleEmitterIds[2]; + /* 0xA8C */ u8 field_0xa8c; +}; + +// size: 0xA90 #endif /* D_A_E_YK_H */ diff --git a/rel/d/a/e/d_a_e_yk/d_a_e_yk.cpp b/rel/d/a/e/d_a_e_yk/d_a_e_yk.cpp index 0e55d0b12b8..2146885a279 100644 --- a/rel/d/a/e/d_a_e_yk/d_a_e_yk.cpp +++ b/rel/d/a/e/d_a_e_yk/d_a_e_yk.cpp @@ -1,226 +1,15 @@ -// -// Generated By: dol2asm -// Translation Unit: d_a_e_yk -// +/** + * d_a_e_yk.cpp + * Enemy - Shadow Keese + */ #include "rel/d/a/e/d_a_e_yk/d_a_e_yk.h" #include "dol2asm.h" #include "dolphin/types.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_yk_class {}; - -struct daPy_py_c { - /* 8015F89C */ void checkBoomerangCharge(); - - static u8 m_midnaActor[4]; -}; - -struct daE_YK_HIO_c { - /* 8080482C */ daE_YK_HIO_c(); - /* 808077E0 */ ~daE_YK_HIO_c(); -}; - -struct Vec {}; - -struct cXyz { - /* 80266AE4 */ void operator+(Vec const&) const; - /* 80266B34 */ void operator-(Vec const&) const; -}; - -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); -}; - -struct dCcU_AtInfo {}; - -struct dCcD_Stts { - /* 80083860 */ void Init(int, int, fopAc_ac_c*); -}; - -struct dCcD_SrcSph {}; - -struct dCcD_Sph { - /* 80084A34 */ void Set(dCcD_SrcSph const&); -}; - -struct dCcD_GStts { - /* 80083760 */ dCcD_GStts(); - /* 80083830 */ void Move(); - /* 8080765C */ ~dCcD_GStts(); -}; - -struct dCcD_GObjInf { - /* 80083A28 */ dCcD_GObjInf(); - /* 80084460 */ void ChkTgHit(); - /* 800844F8 */ void GetTgHitObj(); -}; - -struct dBgS_PolyPassChk { - /* 80078E68 */ void SetObj(); -}; - -struct dBgS_ObjAcch { - /* 808076B8 */ ~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); - /* 80807728 */ ~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 cM3dGSph { - /* 8026F648 */ void SetC(cXyz const&); - /* 8026F708 */ void SetR(f32); - /* 808075CC */ ~cM3dGSph(); -}; - -struct cM3dGCir { - /* 8026EF18 */ ~cM3dGCir(); -}; - -struct cM3dGAab { - /* 80807614 */ ~cM3dGAab(); -}; - -struct cCcD_Obj {}; - -struct cCcS { - /* 80264BA8 */ void Set(cCcD_Obj*); -}; - -struct cCcD_GStts { - /* 80807798 */ ~cCcD_GStts(); -}; - -struct cBgS_PolyInfo { - /* 802680B0 */ ~cBgS_PolyInfo(); -}; - -struct cBgS_LinChk {}; - -struct cBgS { - /* 800743B4 */ void LineCross(cBgS_LinChk*); -}; - -struct JAISoundID {}; - -struct Z2SeMgr { - /* 802AB984 */ void seStart(JAISoundID, Vec const*, u32, s8, f32, f32, f32, f32, u8); -}; - -struct Z2CreatureEnemy { - /* 802C0F64 */ Z2CreatureEnemy(); - /* 802C1094 */ void init(Vec*, Vec*, u8, u8); - /* 802C1B7C */ void setLinkSearch(bool); - /* 802C1B90 */ void setEnemyName(char const*); -}; - -struct Z2AudioMgr { - static u8 mAudioMgrPtr[4 + 4 /* padding */]; -}; - -struct JGeometry { - template - struct TVec3 {}; - /* TVec3 */ - struct TVec3__template0 {}; -}; - -struct J3DFrameCtrl { - /* 8032842C */ void checkPass(f32); -}; +#include "d/s/d_s_play.h" +#include "SSystem/SComponent/c_math.h" +#include "JSystem/JMath/JMath.h" +#include "c/c_damagereaction.h" // // Forward References: @@ -354,11 +143,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 PSVECAdd(); -extern "C" void PSVECSquareMag(); extern "C" void _savegpr_19(); extern "C" void _savegpr_23(); extern "C" void _savegpr_27(); @@ -369,21 +153,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 u8 j3dSys[284]; -extern "C" extern void* calc_mtx[1 + 1 /* padding */]; -extern "C" extern u32 __float_nan; extern "C" u8 m_midnaActor__9daPy_py_c[4]; -extern "C" extern u8 pauseTimer__9dScnPly_c[4]; +// extern "C" extern u8 pauseTimer__9dScnPly_c[4]; extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */]; extern "C" void __register_global_object(); @@ -469,14 +246,14 @@ COMPILER_STRIP_GATE(0x80807CD0, &lit_3964); #pragma pop /* 80807D70-80807D7C 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, }; /* 80807D7C-80807D90 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, @@ -489,7 +266,7 @@ SECTION_DATA static u32 lit_1787[1 + 4 /* padding */] = { /* 80807D90-80807D98 000020 0008+00 0/1 0/0 0/0 .data e_prim$3820 */ #pragma push #pragma force_active on -SECTION_DATA static u8 e_prim[8] = { +static u8 e_prim[8] = { 0xFF, 0x78, 0x00, 0x00, 0xFF, 0x64, 0x78, 0x00, }; #pragma pop @@ -497,7 +274,7 @@ SECTION_DATA static u8 e_prim[8] = { /* 80807D98-80807DA0 000028 0008+00 0/1 0/0 0/0 .data e_env$3821 */ #pragma push #pragma force_active on -SECTION_DATA static u8 e_env[8] = { +static u8 e_env[8] = { 0x5A, 0x2D, 0x2D, 0x00, 0x3C, 0x1E, 0x1E, 0x00, }; #pragma pop @@ -505,7 +282,7 @@ SECTION_DATA static u8 e_env[8] = { /* 80807DA0-80807DA8 000030 0006+02 0/1 0/0 0/0 .data eff_id$3829 */ #pragma push #pragma force_active on -SECTION_DATA static u8 eff_id[6 + 2 /* padding */] = { +static u8 eff_id[6 + 2 /* padding */] = { 0x02, 0x9D, 0x02, @@ -538,20 +315,19 @@ SECTION_DATA static void* lit_4726[15] = { }; /* 80807DE4-80807DE8 000074 0004+00 1/1 0/0 0/0 .data e_name$4766 */ -SECTION_DATA static u8 e_name[4] = { - 0x84, - 0x32, - 0x84, - 0x33, +static u16 e_name[2] = { + 0x8432, + 0x8433, }; /* 80807DE8-80807DF0 000078 0008+00 1/1 0/0 0/0 .data e_idx$4767 */ -SECTION_DATA static u8 e_idx[8] = { - 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, +static u32 e_idx[2] = { + 5, + 9, }; /* 80807DF0-80807E30 000080 0040+00 1/1 0/0 0/0 .data cc_sph_src$4930 */ -SECTION_DATA static u8 cc_sph_src[64] = { +static u8 cc_sph_src[64] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0xD8, 0xFB, 0xFD, 0xFF, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, @@ -559,25 +335,35 @@ SECTION_DATA static u8 cc_sph_src[64] = { }; /* 80807E30-80807E50 -00001 0020+00 1/0 0/0 0/0 .data l_daE_YK_Method */ -SECTION_DATA static void* l_daE_YK_Method[8] = { - (void*)daE_YK_Create__FP10fopAc_ac_c, - (void*)daE_YK_Delete__FP10e_yk_class, - (void*)daE_YK_Execute__FP10e_yk_class, - (void*)daE_YK_IsDelete__FP10e_yk_class, - (void*)daE_YK_Draw__FP10e_yk_class, - (void*)NULL, - (void*)NULL, - (void*)NULL, +static actor_method_class l_daE_YK_Method = { + (process_method_func)daE_YK_Create__FP10fopAc_ac_c, + (process_method_func)daE_YK_Delete__FP10e_yk_class, + (process_method_func)daE_YK_Execute__FP10e_yk_class, + (process_method_func)daE_YK_IsDelete__FP10e_yk_class, + (process_method_func)daE_YK_Draw__FP10e_yk_class }; /* 80807E50-80807E80 -00001 0030+00 0/0 0/0 1/0 .data g_profile_E_YK */ -SECTION_DATA extern void* g_profile_E_YK[12] = { - (void*)0xFFFFFFFD, (void*)0x0007FFFD, - (void*)0x01F90000, (void*)&g_fpcLf_Method, - (void*)0x00000A90, (void*)NULL, - (void*)NULL, (void*)&g_fopAc_Method, - (void*)0x00BC0000, (void*)&l_daE_YK_Method, - (void*)0x10050100, (void*)0x020E0000, +extern actor_process_profile_definition g_profile_E_YK = { + -3, // mLayerID + 7, // mListID + -3, // mListPrio + PROC_E_YK, // mProcName + 0, // padding + &g_fpcLf_Method.mBase, // mSubMtd + sizeof(e_yk_class), // mSize + 0, // mSizeOther + 0, // mParameters + &g_fopAc_Method.base, // mSubMtd + 0x00BC, // mPriority + 0, // padding + 0, // padding + &l_daE_YK_Method, // mSubMtd + 0x10050100, // mStatus + 0x02, // mActorType + 0x0E, // mCullType + 0, // padding + 0, // padding }; /* 80807E80-80807E8C 000110 000C+00 1/1 0/0 0/0 .data __vt__12dBgS_AcchCir */ @@ -636,6 +422,17 @@ SECTION_DATA extern void* __vt__12daE_YK_HIO_c[3] = { }; /* 8080482C-80804870 0000EC 0044+00 1/1 0/0 0/0 .text __ct__12daE_YK_HIO_cFv */ +#ifdef NONMATCHING +// matches with literals +daE_YK_HIO_c::daE_YK_HIO_c() { + field_0x04 = -1; + field_0x08 = 1.0f; + field_0x0c = 15.0f; + field_0x10 = 250.0f; + field_0x14 = 15.0f; + field_0x18 = 40.0f; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -644,6 +441,7 @@ asm daE_YK_HIO_c::daE_YK_HIO_c() { #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/__ct__12daE_YK_HIO_cFv.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80807CD4-80807CD8 000038 0004+00 0/1 0/0 0/0 .rodata @4008 */ @@ -658,6 +456,24 @@ SECTION_RODATA static f32 const lit_4009 = -1.0f; COMPILER_STRIP_GATE(0x80807CD8, &lit_4009); /* 80804870-808049E4 000130 0174+00 2/2 0/0 0/0 .text yk_disappear__FP10e_yk_class */ +#ifdef NONMATCHING +// matches with literals +static void yk_disappear(e_yk_class* i_this) { + cXyz pos(0.65f,0.65f,0.65f); + + dComIfGp_particle_set(0x826c,&i_this->current.pos,0,&pos); // float literal inline + dComIfGp_particle_set(0x826d,&i_this->current.pos,0,&pos); // float literal inline + + fopAcM_seStart(i_this,Z2SE_DARK_VANISH,0); // float literal inline + fopAcM_createItemFromEnemyID(1,&i_this->current.pos,0xffffffff,0xffffffff,0,0,0,0); + + s32 param = fopAcM_GetParam(i_this) >> 0x18; + + if (param != 0xff) { + dComIfGs_onSwitch(param, fopAcM_GetRoomNo(i_this)); + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -666,15 +482,16 @@ static asm void yk_disappear(e_yk_class* param_0) { #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/yk_disappear__FP10e_yk_class.s" } #pragma pop - -/* ############################################################################################## */ -/* 80807D64-80807D64 0000C8 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80807D64 = "E_YK"; -#pragma pop +#endif /* 808049E4-80804A90 0002A4 00AC+00 10/10 0/0 0/0 .text anm_init__FP10e_yk_classifUcf */ +#ifdef NONMATCHING +// matches with literals +static void anm_init(e_yk_class* i_this, int i_resIdx, f32 param_2, u8 param_3, f32 param_4) { + i_this->mpMorfSO->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("E_YK",i_resIdx),param_3,param_2,param_4,0.0f,-1.0f); + i_this->mResIdx = i_resIdx; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -683,37 +500,66 @@ static asm void anm_init(e_yk_class* param_0, int param_1, f32 param_2, u8 param #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/anm_init__FP10e_yk_classifUcf.s" } #pragma pop +#endif /* 80804A90-80804B38 000350 00A8+00 1/0 0/0 0/0 .text daE_YK_Draw__FP10e_yk_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daE_YK_Draw(e_yk_class* param_0) { - nofralloc -#include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/daE_YK_Draw__FP10e_yk_class.s" +static int daE_YK_Draw(e_yk_class* i_this) { + J3DModel* model = i_this->mpMorfSO->getModel(); + + g_env_light.settingTevStruct(2,&i_this->current.pos,&i_this->mTevStr); + g_env_light.setLightTevColorType_MAJI(model,&i_this->mTevStr); + + dComIfGd_setListDark(); + + i_this->mpMorfSO->entryDL(); + dComIfGd_setList(); + return 1; } -#pragma pop /* 80804B38-80804BB0 0003F8 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_yk/d_a_e_yk/shot_b_sub__FPvPv.s" +static void* shot_b_sub(void* param_0, void* param_1) { + if (fopAcM_IsActor(param_0) && fopAcM_GetName(param_0) == PROC_BOOMERANG && + !i_dComIfGp_checkPlayerStatus0(0,0x80000) && + daPy_py_c::checkBoomerangCharge() && + fopAcM_GetParam(param_0) == 1) { + return param_0; + } + + return 0; } -#pragma pop /* 80804BB0-80804C88 000470 00D8+00 1/1 0/0 0/0 .text other_bg_check__FP10e_yk_classP10fopAc_ac_c */ +#ifdef NONMATCHING +// regalloc + literals. i_actorP needs to load in first +static bool other_bg_check(e_yk_class* i_this, fopAc_ac_c* i_actorP) { + dBgS_LinChk lin_chk; + cXyz yk_pos; + cXyz actor_pos; + + actor_pos = i_actorP->current.pos; + actor_pos.y += 100.0f; + + yk_pos = i_this->current.pos; + yk_pos.y = i_this->mEyePos.y; + + lin_chk.Set(&yk_pos,&actor_pos,i_this); + if (dComIfG_Bgsp().LineCross(&lin_chk)) { + return 1; + } else { + return 0; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void other_bg_check(e_yk_class* param_0, fopAc_ac_c* param_1) { +static asm int other_bg_check(e_yk_class* param_0, fopAc_ac_c* param_1) { nofralloc #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/other_bg_check__FP10e_yk_classP10fopAc_ac_c.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80807CDC-80807CE0 000040 0004+00 1/1 0/0 0/0 .rodata @4103 */ @@ -721,14 +567,35 @@ SECTION_RODATA static f32 const lit_4103 = 50000.0f; COMPILER_STRIP_GATE(0x80807CDC, &lit_4103); /* 80804C88-80804D38 000548 00B0+00 5/5 0/0 0/0 .text pl_check__FP10e_yk_classfs */ +#ifdef NONMATCHING +// matches with literals +static int pl_check(e_yk_class* i_this, f32 i_distance, s16 i_angle) { + if (i_distance >= 50000.0f) { + return 1; + } + + if (dComIfGp_getPlayer(0)->current.pos.y < i_this->current.pos.y && i_this->mDistanceXZFromPlayer < i_distance) { + s16 angle_delta = i_this->shape_angle.y - i_this->mAngleFromPlayer; + + if (i_angle == 1 || angle_delta < i_angle && angle_delta > (s16)-i_angle){ + if (!other_bg_check(i_this,dComIfGp_getPlayer(0))) { + return 1; + } + } + } + + return 0; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void pl_check(e_yk_class* param_0, f32 param_1, s16 param_2) { +static asm int pl_check(e_yk_class* param_0, f32 param_1, s16 param_2) { nofralloc #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/pl_check__FP10e_yk_classfs.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80807CE0-80807CE4 000044 0004+00 0/2 0/0 0/0 .rodata @4151 */ @@ -753,14 +620,86 @@ COMPILER_STRIP_GATE(0x80807CE8, &lit_4153); #pragma pop /* 80804D38-80804F68 0005F8 0230+00 1/1 0/0 0/0 .text damage_check__FP10e_yk_class */ +#ifdef NONMATCHING +// matches with literals +static void damage_check(e_yk_class* i_this) { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + + if (i_this->field_0x6aa == 0) { + // Store current AtApid and TgApid then set them to 0 + i_this->mCollisionStatus.Move(); + + // If keese Defense collider was hit + if (i_this->mCollisionSphere.ChkTgHit()) { + // Store the tg collider pointer as the current at collider in the info block + i_this->mAtColliderInfo.mpCollider = i_this->mCollisionSphere.GetTgHitObj(); + + // If keese was hit by the boomerang + if (i_this->mAtColliderInfo.mpCollider->ChkAtType(AT_TYPE_BOOMERANG)) { + i_this->mAction = ACT_WIND; + i_this->mActionPhase = 0; + + } else { + // Run through the default Attack collider checks first + cc_at_check(i_this,&i_this->mAtColliderInfo); + + // If keese was hit by Clawshot or Slingshot, subtract 1 from health + if (i_this->mAtColliderInfo.mpCollider->ChkAtType(AT_TYPE_HOOKSHOT) || i_this->mAtColliderInfo.mpCollider->ChkAtType(AT_TYPE_SLINGSHOT)) { + i_this->mHealth--; + } + + // If keese was hit by shield attack, set some fields and play controller vibration + if (i_this->mAtColliderInfo.mpCollider->ChkAtType(AT_TYPE_SHIELD_ATTACK)) { + i_this->mAction = ACT_CHANCE; + i_this->mActionPhase = 0; + i_this->field_0x694 = 70.0f; + i_this->field_0x698 = i_this->shape_angle.y; + i_this->field_0x6a0 = 0; + + dComIfGp_getVibration().StartShock(2,0x1f,cXyz(0.0f,1.0f,0.0f)); + } else { + // If keese was hit by wolf bite, set some fields, set pause timer to 0, + // play keese wolf bit sound + if (i_this->mAtColliderInfo.mpCollider->ChkAtType(AT_TYPE_WOLF_ATTACK) && (static_cast(player)->onWolfEnemyBiteAll(i_this,daPy_py_c::FLG2_UNK_8) != 0)) { + i_this->mAction = ACT_WOLFBITE; + i_this->mActionPhase = 0; + i_this->field_0x6aa = 200; + dScnPly_c::setPauseTimer(0); + i_this->mCreature.startCreatureVoice(Z2SE_EN_YK_V_BITE,-1); + } else { + // If it was unknown attack, set some fields + if (i_this->mAtColliderInfo.mpCollider->ChkAtType(AT_TYPE_UNK)) { + i_this->field_0x6aa = 20; + } else { + i_this->field_0x6aa = 10; + } + + i_this->field_0x694 = cM_rndF(10.0f) + 70.0f; + i_this->field_0x698 = i_this->mAtColliderInfo.mHitDirection; + + // If keese is dead, play death sound + if (i_this->mHealth <= 0) { + i_this->mCreature.startCreatureVoice(Z2SE_EN_YK_V_DEATH,-1); + i_this->mpMorfSO->setPlaySpeed(0.2f); + i_this->field_0x6a0 = 1; + } + } + } + + } + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void damage_check(e_yk_class* param_0) { +static asm void damage_check(e_yk_class* i_this) { nofralloc #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/damage_check__FP10e_yk_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80807CEC-80807CF0 000050 0004+00 0/5 0/0 0/0 .rodata @4185 */ @@ -771,26 +710,103 @@ COMPILER_STRIP_GATE(0x80807CEC, &lit_4185); #pragma pop /* 80807EF8-80807EFC 000008 0004+00 2/2 0/0 0/0 .bss None */ -static u8 data_80807EF8[4]; +static u8 data_80807EF8; /* 80807EFC-80807F08 00000C 000C+00 1/1 0/0 0/0 .bss @3957 */ static u8 lit_3957[12]; /* 80807F08-80807F24 000018 001C+00 9/9 0/0 0/0 .bss l_HIO */ -static u8 l_HIO[28]; +// static daE_YK_HIO_c l_HIO; +static daE_YK_HIO_c_tmp l_HIO; /* 80807F24-80808023 000034 00FF+00 1/1 0/0 0/0 .bss check_index$4191 */ static u8 check_index[255]; /* 80804F68-808051D0 000828 0268+00 2/3 0/0 0/0 .text path_check__FP10e_yk_class */ +#ifdef NONMATCHING +// literals + float regalloc in the loops +static int path_check(e_yk_class* i_this) { + if (i_this->mpPath) { + dBgS_LinChk lin_chk; + + cXyz current_keese_pos; + cXyz path_point_pos; + current_keese_pos = i_this->current.pos; + current_keese_pos.y += 100.0f; + dStage_dPnt_c* points = i_this->mpPath->m_points; + + // Set/update check_index array based on whether or not path points + // were crossed + for (int i = 0; i < i_this->mpPath->m_num; i++, points++) { + path_point_pos.x = points->m_position.x; + path_point_pos.y = points->m_position.y + 100.0f; + path_point_pos.z = points->m_position.z; + + lin_chk.Set(¤t_keese_pos,&path_point_pos,i_this); + + if (!dComIfG_Bgsp().LineCross(&lin_chk)) { + check_index[i] = 1; + } else { + check_index[i] = 0; + } + } + + f32 f = 0.0f; + bool tmp = false; + + for (int i = 0; i < 100; i++, f+= 50.0f) { + points = i_this->mpPath->m_points; + + for (int j = 0; j < i_this->mpPath->m_num; j++, points++) { + if (check_index[j] != 0) { + f32 x = i_this->current.pos.x - points->m_position.x; + f32 y = i_this->current.pos.y - points->m_position.y; + f32 z = i_this->current.pos.z - points->m_position.z; + + if (JMAFastSqrt(x*x + y*y + z*z) < f) { + i_this->mPathPntIdx = j - i_this->field_0x5ba; + u16 pathNum = i_this->mpPath->m_num; + + if (i_this->mPathPntIdx >= (s8)i_this->mpPath->m_num) { + i_this->mPathPntIdx = i_this->mpPath->m_num; + } else { + if (0 > i_this->mPathPntIdx) { + i_this->mPathPntIdx = 0; + } + } + + tmp = true; + break; + } + } + } + + if (tmp) break; + + } + + if (!tmp) { + i_this->field_0x5b8 = 0; + } else { + i_this->field_0x5b8 = i_this->mPathIdx + 1; + return 1; + } + + + } + + return 0; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void path_check(e_yk_class* param_0) { +static asm int path_check(e_yk_class* i_this) { nofralloc #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/path_check__FP10e_yk_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80807CF0-80807CF4 000054 0004+00 0/1 0/0 0/0 .rodata @4271 */ @@ -808,14 +824,46 @@ COMPILER_STRIP_GATE(0x80807CF4, &lit_4272); #pragma pop /* 808051D0-80805360 000A90 0190+00 5/5 0/0 0/0 .text fly_move__FP10e_yk_class */ +#ifdef NONMATCHING +// matches with literals +static void fly_move(e_yk_class* i_this) { + cXyz pos; + + f32 x = i_this->mPathPntPos.x - i_this->current.pos.x; + f32 y = i_this->mPathPntPos.y - i_this->current.pos.y; + f32 z = i_this->mPathPntPos.z - i_this->current.pos.z; + + s16 angle = cM_atan2s(x,z); + f32 sqrt = JMAFastSqrt(x * x + z * z); // float literal inline + s16 angle2 = -cM_atan2s(y,sqrt); + + cLib_addCalcAngleS2(&i_this->current.angle.y,angle,10,i_this->field_0x690 * i_this->field_0x68c); + + i_this->field_0x690 = 2000.0f; + + cLib_addCalcAngleS2(&i_this->current.angle.x,angle2,10,i_this->field_0x690 * i_this->field_0x68c); + cLib_addCalc2(&i_this->field_0x68c,1.0f,1.0f,0.04f); + + pos.x = 0.0f; + pos.y = 0.0f; + pos.z = i_this->speedF; + + mDoMtx_YrotS((MtxP)calc_mtx,i_this->current.angle.y); + cMtx_XrotM((MtxP)calc_mtx,i_this->current.angle.x); + MtxPosition(&pos,&i_this->speed); + + i_this->current.pos += i_this->speed; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void fly_move(e_yk_class* param_0) { +static asm void fly_move(e_yk_class* i_this) { nofralloc #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/fly_move__FP10e_yk_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80807CF8-80807CFC 00005C 0004+00 0/1 0/0 0/0 .rodata @4304 */ @@ -840,6 +888,30 @@ COMPILER_STRIP_GATE(0x80807D00, &lit_4306); #pragma pop /* 80805360-808054A8 000C20 0148+00 1/1 0/0 0/0 .text e_yk_roof__FP10e_yk_class */ +#ifdef NONMATCHING +// matches with literals +static void e_yk_roof(e_yk_class* i_this) { + switch (i_this->mActionPhase) { + case 0: + anm_init(i_this,9,15.0f,2,cM_rndF(0.1f) + 0.9f); // random number between 0.9 and 1.0 + i_this->mActionPhase = 1; + break; + case 1: + if ((i_this->field_0x66c & 0x1f) == 0 && cM_rndF(1.0f) < 0.5f) { + i_this->mCreature.startCreatureVoice(Z2SE_EN_YK_V_NAKU,-1); + } + } + + cLib_addCalc2(&i_this->current.pos.x,i_this->orig.pos.x,0.5f,fabsf(i_this->speed.x)); + cLib_addCalc2(&i_this->current.pos.y,i_this->orig.pos.y,0.5f,fabsf(i_this->speed.y)); + cLib_addCalc2(&i_this->current.pos.z,i_this->orig.pos.z,0.5f,fabsf(i_this->speed.z)); + + if (pl_check(i_this,i_this->mPlayerTrigger,1)) { + i_this->mAction = ACT_FIGHT_FLY; + i_this->mActionPhase = 0; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -848,6 +920,7 @@ static asm void e_yk_roof(e_yk_class* param_0) { #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/e_yk_roof__FP10e_yk_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80807D04-80807D08 000068 0004+00 0/6 0/0 0/0 .rodata @4334 */ @@ -865,6 +938,48 @@ COMPILER_STRIP_GATE(0x80807D08, &lit_4335); #pragma pop /* 808054A8-80805660 000D68 01B8+00 1/1 0/0 0/0 .text e_yk_fight_fly__FP10e_yk_class */ +#ifdef NONMATCHING +// matches with literals +static void e_yk_fight_fly(e_yk_class* i_this) { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + + switch (i_this->mActionPhase) { + case 0: + anm_init(i_this,5,3.0f,2,1.0f); + i_this->mActionPhase = 1; + i_this->field_0x68c = 0.0f; + break; + case 1: + if ((i_this->field_0x66c & 0xfU) == 0 && cM_rndF(1.0f) < 0.5f) { + i_this->mCreature.startCreatureVoice(Z2SE_EN_YK_V_NAKU,-1); + } + } + + cLib_addCalc2(&i_this->speedF,l_HIO.field_0x0c, 1.0f, 0.3f * l_HIO.field_0x0c); + i_this->mPathPntPos = player->current.pos; + fly_move(i_this); + + if (!pl_check(i_this,50.0f + i_this->mPlayerTrigger,1)) { + if (!path_check(i_this)) { + if (i_this->mParam1 == 0) { + i_this->mAction = ACT_RETURN; + i_this->mActionPhase = 0; + } else { + i_this->mAction = ACT_FLY; + i_this->mActionPhase = 0; + } + } else { + i_this->mAction = ACT_PATH_FLY; + i_this->mActionPhase = 0; + } + } else { + if (pl_check(i_this,l_HIO.field_0x10,1)) { + i_this->mAction = ACT_FIGHT; + i_this->mActionPhase = 0; + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -873,6 +988,7 @@ static asm void e_yk_fight_fly(e_yk_class* param_0) { #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/e_yk_fight_fly__FP10e_yk_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80807D0C-80807D10 000070 0004+00 0/3 0/0 0/0 .rodata @4398 */ @@ -904,14 +1020,84 @@ COMPILER_STRIP_GATE(0x80807D18, &lit_4401); #pragma pop /* 80805660-808059BC 000F20 035C+00 1/1 0/0 0/0 .text e_yk_fight__FP10e_yk_class */ +#ifdef NONMATCHING +// matches with literals +static void e_yk_fight(e_yk_class* i_this) { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + s16 player_shape_angle_y = player->shape_angle.y; + + switch (i_this->mActionPhase) { + case 0: + anm_init(i_this,8,2.0f,2,cM_rndF(0.1f) + 1.0f); + i_this->mActionPhase = 1; + i_this->field_0x6a2[0] = 0; + i_this->field_0x6a2[1] = cM_rndF(100.0f) + 30.0f; + break; + case 1: + if (i_this->field_0x6a2[0] == 0) { + mDoMtx_YrotS((MtxP)calc_mtx,player_shape_angle_y + (s16)cM_rndFX(12288.0f)); + + cXyz pos; + pos.x = 0.0f; + pos.y = cM_rndF(100.0f) + 150.0f; + pos.z = cM_rndF(150.0f) + 150.0f; + + MtxPosition(&pos,&i_this->mPathPntPos); + i_this->mPathPntPos += player->current.pos; + + pos = i_this->mPathPntPos - i_this->current.pos; + mDoMtx_YrotS((MtxP)calc_mtx,cM_atan2s(pos.x,pos.z)); + cMtx_XrotM((MtxP)calc_mtx,-cM_atan2s(pos.y,JMAFastSqrt(pos.x*pos.x + pos.z*pos.z))); // float literal inline + + pos.x = 0.0f; + pos.y = 0.0f; + pos.z = l_HIO.field_0x14; + + MtxPosition(&pos,&i_this->speed); + + i_this->field_0x6a2[0] = cM_rndF(30.0f) + 10.0f; + i_this->field_0x68c = 0.0f; + } + + if (i_this->field_0x6a2[1] == 0) { + i_this->field_0x6a2[1] = cM_rndF(100.0f) + 30.0f; + i_this->mAction = ACT_ATTACK; + i_this->mActionPhase = 0; + } + } + + cLib_addCalc2(&i_this->current.pos.x,i_this->mPathPntPos.x,0.2f,i_this->field_0x68c * fabsf(i_this->speed.x)); + cLib_addCalc2(&i_this->current.pos.y,i_this->mPathPntPos.y,0.2f,i_this->field_0x68c * fabsf(i_this->speed.y)); + cLib_addCalc2(&i_this->current.pos.z,i_this->mPathPntPos.z,0.2f,i_this->field_0x68c * fabsf(i_this->speed.z)); + cLib_addCalc2(&i_this->field_0x68c,1.0f,1.0f,0.1f); + + cLib_addCalcAngleS2(&i_this->current.angle.y,i_this->mAngleFromPlayer,4,0x800); + + if (!pl_check(i_this,i_this->mPlayerTrigger + 50.0f,1)) { + if (!path_check(i_this)) { + if (i_this->mParam1 == 0) { + i_this->mAction = ACT_RETURN; + i_this->mActionPhase = 0; + } else { + i_this->mAction = ACT_FLY; + i_this->mActionPhase = 0; + } + } else { + i_this->mAction = ACT_PATH_FLY; + i_this->mActionPhase = 0; + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void e_yk_fight(e_yk_class* param_0) { +static asm void e_yk_fight(e_yk_class* i_this) { nofralloc #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/e_yk_fight__FP10e_yk_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80807D1C-80807D20 000080 0004+00 0/1 0/0 0/0 .rodata @4438 */ @@ -922,14 +1108,69 @@ COMPILER_STRIP_GATE(0x80807D1C, &lit_4438); #pragma pop /* 808059BC-80805BB4 00127C 01F8+00 1/1 0/0 0/0 .text e_yk_attack__FP10e_yk_class */ +#ifdef NONMATCHING +// matches with literals +static void e_yk_attack(e_yk_class* i_this) { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + + f32 value = 0.0f; + i_this->field_0x68c = 0.0f; + + switch (i_this->mActionPhase) { + case 0: + anm_init(i_this,5,3.0f,2,2.0f); + i_this->mActionPhase = 1; + i_this->field_0x6a2[1] = 0x14; + break; + case 1: + i_this->mPathPntPos = player->current.pos; + i_this->mPathPntPos.y += 120.0f; + i_this->field_0x68c = 2.0f; + + if (i_this->field_0x6a2[1] == 0) { + i_this->mActionPhase = 2; + i_this->field_0x6a2[0] = 0xf; + i_this->mCreature.startCreatureVoice(Z2SE_EN_YK_V_ATTACK,-1); + } + break; + case 2: + value = l_HIO.field_0x18; + + if (i_this->mCollisionSphere.ChkAtShieldHit()) { + i_this->mAction = ACT_CHANCE; + i_this->mActionPhase = 0; + i_this->field_0x694 = 70.0f; + i_this->field_0x698 = i_this->shape_angle.y; + i_this->field_0x6a0 = 0; + + dComIfGp_getVibration().StartShock(2,0x1f,cXyz(0.0f,1.0f,0.0f)); + + } else { + if (i_this->field_0x6a2[0] == 0) { + i_this->mActionPhase = 3; + } + } + break; + case 3: + if ((i_this->speedF <= 1.0f)) { + i_this->mAction = ACT_FIGHT; + i_this->mActionPhase = 0; + } + } + + cLib_addCalc2(&i_this->speedF,value,1.0f,0.2f * l_HIO.field_0x18); + fly_move(i_this); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void e_yk_attack(e_yk_class* param_0) { +static asm void e_yk_attack(e_yk_class* i_this) { nofralloc #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/e_yk_attack__FP10e_yk_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80807D20-80807D24 000084 0004+00 0/1 0/0 0/0 .rodata @4480 */ @@ -947,34 +1188,167 @@ COMPILER_STRIP_GATE(0x80807D24, &lit_4481); #pragma pop /* 80805BB4-80805DE0 001474 022C+00 1/1 0/0 0/0 .text e_yk_fly__FP10e_yk_class */ +#ifdef NONMATCHING +// matches with literals +static void e_yk_fly(e_yk_class* i_this) { + switch (i_this->mActionPhase) { + case 0: + anm_init(i_this,5,3.0f,2,1.0f); + i_this->mActionPhase = 1; + break; + case 1: + if ((i_this->field_0x66c & 0x1f) == 0 && cM_rndF(1.0f) < 0.5f) { + i_this->mCreature.startCreatureVoice(Z2SE_EN_YK_V_NAKU,-1); + } + + if (i_this->field_0x6a2[0] == 0) { + i_this->mPathPntPos.x = i_this->orig.pos.x + cM_rndFX(500.0f); + i_this->mPathPntPos.y = i_this->orig.pos.y + cM_rndFX(200.0f); + i_this->mPathPntPos.z = i_this->orig.pos.z + cM_rndFX(500.0f); + + cXyz pos = i_this->mPathPntPos - i_this->current.pos; + + mDoMtx_YrotS((MtxP)calc_mtx,cM_atan2s(pos.x,pos.z)); + cMtx_XrotM((MtxP)calc_mtx,-cM_atan2s(pos.y,JMAFastSqrt(pos.x*pos.x + pos.z*pos.z))); // float literal inline + + pos.x = 0.0f; + pos.y = 0.0f; + pos.z = l_HIO.field_0x14; + + MtxPosition(&pos,&i_this->speed); + i_this->field_0x6a2[0] = cM_rndF(30.0f) + 10.0f; + i_this->field_0x68c = 0.0f; + } + } + + cLib_addCalc2(&i_this->speedF,l_HIO.field_0x0c,1.0f,0.3f * l_HIO.field_0x0c); + fly_move(i_this); + + if (pl_check(i_this,i_this->mPlayerTrigger,1)) { + i_this->mAction = ACT_FIGHT_FLY; + i_this->mActionPhase = 0; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void e_yk_fly(e_yk_class* param_0) { +static asm void e_yk_fly(e_yk_class* i_this) { nofralloc #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/e_yk_fly__FP10e_yk_class.s" } #pragma pop +#endif /* 80805DE0-80805FF0 0016A0 0210+00 1/1 0/0 0/0 .text e_yk_return__FP10e_yk_class */ +#ifdef NONMATCHING +// matches with literals +static void e_yk_return(e_yk_class* i_this) { + switch (i_this->mActionPhase) { + case 0: + anm_init(i_this,5,3.0f,2,1.0f); + i_this->mActionPhase = 1; + i_this->field_0x68c = 0.0f; + case 1: + break; + } + + cLib_addCalc2(&i_this->speedF,l_HIO.field_0x0c,1.0f, 0.3f * l_HIO.field_0x0c); + + i_this->mPathPntPos = i_this->orig.pos; + fly_move(i_this); + + cXyz pos = i_this->current.pos - i_this->mPathPntPos; + + if (pos.abs() < 100.0f) { // multiple float literal inlines + i_this->mAction = ACT_ROOF; + i_this->mActionPhase = 0; + + } else { + if (pl_check(i_this,i_this->mPlayerTrigger,1)) { + i_this->mAction = ACT_FIGHT_FLY; + i_this->mActionPhase = 0; + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void e_yk_return(e_yk_class* param_0) { +static asm void e_yk_return(e_yk_class* i_this) { nofralloc #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/e_yk_return__FP10e_yk_class.s" } #pragma pop +#endif /* 80805FF0-80806308 0018B0 0318+00 1/1 0/0 0/0 .text e_yk_path_fly__FP10e_yk_class */ +#ifdef NONMATCHING +// matches with literals +static void e_yk_path_fly(e_yk_class* i_this) { + switch (i_this->mActionPhase) { + case 0: + anm_init(i_this,5,3.0f,2,1.0f); + i_this->mActionPhase = 1; + case 1: + if ((i_this->field_0x66c & 0x1fU) == 0 && cM_rndF(1.0f) < 0.5f) { + i_this->mCreature.startCreatureVoice(Z2SE_EN_YK_V_NAKU,-1); + } + + i_this->mPathPntIdx += i_this->field_0x5ba; + if (i_this->mPathPntIdx >= (s8)i_this->mpPath->m_num) { + if ((dPath_ChkClose(i_this->mpPath)) != 0) { + i_this->mPathPntIdx = 0; + + } else { + i_this->field_0x5ba = 0xff; + i_this->mPathPntIdx = i_this->mpPath->m_num - 2; + } + + int roomNo = i_this->mpPath->m_nextID; + + if (roomNo != 0xFFFF) { + i_this->mpPath = dPath_GetRoomPath(roomNo,fopAcM_GetRoomNo(i_this)); + } + } else { + if (i_this->mPathPntIdx < 0) { + i_this->field_0x5ba = 1; + i_this->mPathPntIdx = 1; + } + + } + case 2: + i_this->mActionPhase = 3; + + dStage_dPnt_c* point = i_this->mpPath->m_points; + point = &point[i_this->mPathPntIdx]; + + i_this->field_0x68c = 0.0f; + i_this->mPathPntPos.x = point->m_position.x + cM_rndFX(150.0f); + i_this->mPathPntPos.y = point->m_position.y + cM_rndFX(150.0f); + i_this->mPathPntPos.z = point->m_position.z + cM_rndFX(150.0f); + break; + case 3: + cXyz pos = i_this->mPathPntPos - i_this->current.pos; + + if (pos.abs() < 200.0f) { // float literal inlines + i_this->mActionPhase = 1; + } + } + + cLib_addCalc2(&i_this->speedF,l_HIO.field_0x0c,1.0f,0.3f * l_HIO.field_0x0c); + fly_move(i_this); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void e_yk_path_fly(e_yk_class* param_0) { +static asm void e_yk_path_fly(e_yk_class* i_this) { nofralloc #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/e_yk_path_fly__FP10e_yk_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80807D28-80807D2C 00008C 0004+00 0/1 0/0 0/0 .rodata @4608 */ @@ -999,6 +1373,53 @@ COMPILER_STRIP_GATE(0x80807D30, &lit_4610); #pragma pop /* 80806308-80806500 001BC8 01F8+00 1/1 0/0 0/0 .text e_yk_chance__FP10e_yk_class */ +#ifdef NONMATCHING +// matches with literals +static void e_yk_chance(e_yk_class* i_this) { + switch (i_this->mActionPhase) { + case 0: + anm_init(i_this,8,2.0f,2,1.5f); + i_this->mActionPhase = 1; + i_this->field_0x6a2[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->mCreature.startCreatureVoice(Z2SE_EN_YK_V_BITE,-1); + break; + case 1: + if (i_this->field_0x708.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->field_0x69a.z = 0; + } else { + i_this->field_0x69a.z = 0x8000; + } + + i_this->field_0x69a.y = cM_rndF(65536.0f); + fopAcM_effSmokeSet1(&i_this->field_0xa78,&i_this->field_0xa7c, + &i_this->current.pos,&i_this->shape_angle, + 0.8f,&i_this->mTevStr,1); + + i_this->mCreature.startCreatureVoice(Z2SE_EN_YK_V_FAINT,-1); + } + + if (i_this->field_0x6a2[0] == 0) { + i_this->current.angle.z = 0; + i_this->mAction = ACT_FIGHT; + i_this->mActionPhase = 0; + return; + } + } + + i_this->current.pos += i_this->speed; + i_this->speed.y -= 2.0f; + cLib_addCalcAngleS2(&i_this->current.angle.y,i_this->field_0x69a.y,2,0x1000); + cLib_addCalcAngleS2(&i_this->current.angle.z,i_this->field_0x69a.z,2,0x1000); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1007,6 +1428,7 @@ static asm void e_yk_chance(e_yk_class* param_0) { #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/e_yk_chance__FP10e_yk_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80807D34-80807D38 000098 0004+00 0/1 0/0 0/0 .rodata @4650 */ @@ -1024,14 +1446,74 @@ COMPILER_STRIP_GATE(0x80807D38, &lit_4651); #pragma pop /* 80806500-80806740 001DC0 0240+00 1/1 0/0 0/0 .text e_yk_wolfbite__FP10e_yk_class */ +#ifdef NONMATCHING +// matches with literals +static void e_yk_wolfbite(e_yk_class* i_this) { + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + switch(i_this->mActionPhase) { + case 0: + anm_init(i_this,7,0.0f,2,1.0f); + i_this->mActionPhase = 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->mCreature.startCreatureVoice(Z2SE_EN_YK_V_DEATH,-1); + + anm_init(i_this,4,1.0f,0,1.0f); + + i_this->field_0x6a2[0] = 0x3c; + i_this->mActionPhase = 2; + } + break; + case 2: + if (i_this->field_0x708.ChkGroundHit()) { + i_this->mCreature.startCreatureVoice(Z2SE_EN_YK_V_DEATH2,-1); + i_this->mCreature.startCreatureSound(Z2SE_CM_BODYFALL_S,0,-1); + i_this->mActionPhase = 3; + } + // break; + case 3: + if (i_this->field_0x6a2[0] == 0) { + yk_disappear(i_this); + fopAcM_delete(i_this); + } + } + + cXyz pos, pos2; + pos.x = 0.0f; + pos.y = 0.0f; + pos.z = i_this->speedF; + + mDoMtx_YrotS((MtxP)calc_mtx,i_this->current.angle.y); + MtxPosition(&pos, &pos2); + i_this->speed.x = pos2.x; + i_this->speed.z = pos2.z; + + i_this->current.pos += i_this->speed; + i_this->speed.y -= 4.0f; + + if (i_this->field_0x708.ChkGroundHit()) { + cLib_addCalc0(&i_this->speedF,1.0f,15.0f); + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void e_yk_wolfbite(e_yk_class* param_0) { +static asm void e_yk_wolfbite(e_yk_class* i_this) { nofralloc #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/e_yk_wolfbite__FP10e_yk_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80807D3C-80807D40 0000A0 0004+00 0/1 0/0 0/0 .rodata @4675 */ @@ -1048,7 +1530,53 @@ SECTION_RODATA static f32 const lit_4676 = 1000.0f; COMPILER_STRIP_GATE(0x80807D40, &lit_4676); #pragma pop +/* 80807D44-80807D48 0000A8 0004+00 0/0 0/0 0/0 .rodata @4725 */ +#pragma push +#pragma force_active on +SECTION_RODATA static f32 const lit_4725 = 5.0f; +COMPILER_STRIP_GATE(0x80807D44, &lit_4725); +#pragma pop + /* 80806740-808068E4 002000 01A4+00 1/1 0/0 0/0 .text e_yk_wind__FP10e_yk_class */ +#ifdef NONMATCHING +// matches with literals +static void e_yk_wind(e_yk_class* i_this) { + e_yk_class* yk = (e_yk_class*)i_fpcM_Search(shot_b_sub,i_this); + i_this->speedF = 0.0f; + + switch(i_this->mActionPhase) { + case 0: + anm_init(i_this,6,3.0f,2,1.0f); + i_this->mActionPhase = 1; + i_this->mBoomrangXRotOffset = -(cM_rndFX(1000.0f) + 15000.0f); + i_this->mBoomrangPosOffset.x = cM_rndFX(50.0f); + i_this->mBoomrangPosOffset.y = cM_rndFX(50.0f); + i_this->mBoomrangPosOffset.z = cM_rndFX(50.0f); + case 1: + if (!yk) { + i_this->mActionPhase = 2; + i_this->field_0x6a2[0] = 0x3c; + break; + + } else { + i_this->current.pos = yk->current.pos + i_this->mBoomrangPosOffset; + i_this->mCreature.startCreatureVoiceLevel(Z2SE_EN_YK_V_SPIN,-1); + break; + } + case 2: + cLib_addCalcAngleS2(&i_this->mBoomrangXRotOffset,0,4,0x1c2); + + if (i_this->field_0x6a2[0] == 0) { + i_this->mAction = ACT_FIGHT_FLY; + i_this->mActionPhase = 0; + } + } + + i_this->current.angle.y += i_this->mBoomrangXRotOffset; + 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 @@ -1057,25 +1585,110 @@ static asm void e_yk_wind(e_yk_class* param_0) { #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/e_yk_wind__FP10e_yk_class.s" } #pragma pop +#endif /* 808068E4-80806B78 0021A4 0294+00 2/1 0/0 0/0 .text action__FP10e_yk_class */ +#ifdef NONMATCHING +// matches with literals +static void action(e_yk_class* i_this) { + cXyz pos; + cXyz pos2; + + i_this->mAngleFromPlayer = fopAcM_searchPlayerAngleY(i_this); + i_this->mDistanceXZFromPlayer = fopAcM_searchPlayerDistanceXZ(i_this); + + damage_check(i_this); + + i_this->mCollisionSphere.OffAtVsPlayerBit(); + s8 searchForLink = 0; + + switch(i_this->mAction) { + case ACT_ROOF: + e_yk_roof(i_this); + break; + case ACT_FIGHT_FLY: + e_yk_fight_fly(i_this); + break; + case ACT_FIGHT: + e_yk_fight(i_this); + searchForLink = 1; + break; + case ACT_ATTACK: + e_yk_attack(i_this); + i_this->mCollisionSphere.OnAtVsPlayerBit(); + searchForLink = 1; + break; + case ACT_RETURN: + e_yk_return(i_this); + break; + case ACT_FLY: + e_yk_fly(i_this); + break; + case ACT_PATH_FLY: + e_yk_path_fly(i_this); + break; + case ACT_CHANCE: + e_yk_chance(i_this); + break; + case ACT_WOLFBITE: + e_yk_wolfbite(i_this); + break; + case ACT_WIND: + e_yk_wind(i_this); + } + + searchForLink ? i_this->mCreature.setLinkSearch(true) : i_this->mCreature.setLinkSearch(false); + + if (i_this->field_0x694 > 0.1f) { + cXyz pos; + cXyz pos2; + + pos.x = 0.0f; + pos.y = 0.0f; + pos.z = -i_this->field_0x694; + + mDoMtx_YrotS((MtxP)calc_mtx,i_this->field_0x698); + MtxPosition(&pos,&pos2); + i_this->current.pos += pos2; + cLib_addCalc0(&i_this->field_0x694,1.0f,5.0f); + + if (i_this->field_0x6a0 != 0) { + i_this->shape_angle.y += 0x1300; + i_this->shape_angle.z += 0x1700; + + if (i_this->field_0x694 <= 1.0f || i_this->field_0x708.ChkWallHit()) { + yk_disappear(i_this); + fopAcM_delete(i_this); + } + } + } else { + if (i_this->mAction != 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->next.pos.y -= 30.0f; + + i_this->field_0x708.CrrPos(dComIfG_Bgsp()); + + i_this->current.pos.y += 30.0f; + i_this->next.pos.y += 30.0f; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void action(e_yk_class* param_0) { +static asm void action(e_yk_class* i_this) { nofralloc #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/action__FP10e_yk_class.s" } #pragma pop +#endif /* ############################################################################################## */ -/* 80807D44-80807D48 0000A8 0004+00 0/0 0/0 0/0 .rodata @4725 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4725 = 5.0f; -COMPILER_STRIP_GATE(0x80807D44, &lit_4725); -#pragma pop - /* 80807D48-80807D4C 0000AC 0004+00 0/1 0/0 0/0 .rodata @4867 */ #pragma push #pragma force_active on @@ -1091,39 +1704,168 @@ COMPILER_STRIP_GATE(0x80807D4C, &lit_4868); #pragma pop /* 80806B78-8080708C 002438 0514+00 2/1 0/0 0/0 .text daE_YK_Execute__FP10e_yk_class */ +#ifdef NONMATCHING +// float literals / regalloc +static void setMidnaBindEffect(fopEn_enemy_c* param_0, Z2CreatureEnemy* param_1, cXyz* param_2, + cXyz* param_3); +static int daE_YK_Execute(e_yk_class* i_this) { + cXyz pos, pos2; + + if (cDmrNowMidnaTalk()) { + return 1; + } else { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + i_this->field_0x66c++; + + for (int i = 0; i < 4; i++) { + if (i_this->field_0x6a2[i] != 0) { + i_this->field_0x6a2[i]--; + } + } + + if (i_this->field_0x6aa != 0) { + i_this->field_0x6aa--; + } + + action(i_this); + + i_this->mpMorfSO->play(0,dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + J3DModel* model = i_this->mpMorfSO->getModel(); + + if (i_this->mAction == ACT_WOLFBITE && i_this->mActionPhase < 2) { + fopAcM_OffStatus(i_this,0); + i_this->mAttentionInfo.mFlags = 0; + + // need to define inline here + PSMTXCopy(daPy_getLinkPlayerActorClass()->getWolfMouthMatrix(),mDoMtx_stack_c::now); + model->i_setBaseTRMtx(mDoMtx_stack_c::get()); + mDoMtx_stack_c::multVecZero(&i_this->current.pos); + } else { + if (i_this->mHealth > 0 && i_this->field_0x6a0 == 0 && i_this->current.pos.y < player->current.pos.y) { + i_this->mAttentionInfo.mFlags = 4; + } else { + fopAcM_OffStatus(i_this,0); + i_this->mAttentionInfo.mFlags = 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.field_0x08,l_HIO.field_0x08,l_HIO.field_0x08); + + model->i_setBaseTRMtx(mDoMtx_stack_c::get()); + } + + i_this->mpMorfSO->modelCalc(); + int res_idx = i_this->mResIdx; + + if (res_idx == 8 || res_idx == 5) { + if (i_this->mpMorfSO->checkFrame(4.0f)) { + if (i_this->mResIdx == 8) { + i_this->mCreature.startCreatureSound(Z2SE_EN_YK_WING,0,-1); + } else { + i_this->mCreature.startCreatureSound(Z2SE_EN_YK_WING,0,-1); + } + } + } else if (res_idx == 6 && i_this->mpMorfSO->checkFrame(0.0)) { + i_this->mCreature.startCreatureVoice(Z2SE_EN_YK_V_FURA,-1); + } + + if (i_this->mResIdx != 4) { + i_this->field_0xa80 = dComIfGp_particle_set(i_this->field_0xa80,0x8434,&i_this->current.pos,0,0); + + if (i_this->mResIdx != 9) { + for (int i = 0; i < 2; i++) { + i_this->mParticleEmitterIds[i] = dComIfGp_particle_set(i_this->mParticleEmitterIds[i],e_name[i],&i_this->current.pos,0,0); + + JPABaseEmitter* emitter = dComIfGp_particle_getEmitter(i_this->mParticleEmitterIds[i]); + if (emitter) { + emitter->setGlobalRTMatrix(model->i_getAnmMtx(e_idx[i])); + }; + } + } + } + + + + PSMTXCopy(model->i_getAnmMtx(2),(MtxP)calc_mtx); + pos.set(0.0f,0.0f,0.0f); + + MtxPosition(&pos,&i_this->mEyePos); + i_this->mAttentionInfo.mPosition = i_this->mEyePos; + i_this->mAttentionInfo.mPosition.y += 20.0f; + + pos.set(0.0f,0.0f,0.0f); + MtxPosition(&pos,&pos2); + + if (i_this->field_0x6aa != 0) { + pos2.z -= 20000.0f; + } + + i_this->mCollisionSphere.SetC(pos2); + i_this->mCollisionSphere.SetR(30.0f * l_HIO.field_0x08); + + dComIfG_Ccsp()->Set(&i_this->mCollisionSphere); + setMidnaBindEffect(i_this,&i_this->mCreature,&i_this->mEyePos,&cXyz(0.5f,0.5f,0.5f)); + } + + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void daE_YK_Execute(e_yk_class* param_0) { +static asm int daE_YK_Execute(e_yk_class* i_this) { nofralloc #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/daE_YK_Execute__FP10e_yk_class.s" } #pragma pop +#endif /* 8080708C-80807094 00294C 0008+00 1/0 0/0 0/0 .text daE_YK_IsDelete__FP10e_yk_class */ -static bool daE_YK_IsDelete(e_yk_class* param_0) { - return true; +static int daE_YK_IsDelete(e_yk_class* param_0) { + return 1; } /* 80807094-808070FC 002954 0068+00 1/0 0/0 0/0 .text daE_YK_Delete__FP10e_yk_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daE_YK_Delete(e_yk_class* param_0) { - nofralloc -#include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/daE_YK_Delete__FP10e_yk_class.s" +static int daE_YK_Delete(e_yk_class* i_this) { + dComIfG_resDelete(&i_this->mPhase,"E_YK"); + + if (i_this->field_0xa8c != 0) { + data_80807EF8 = 0; + } + + if (i_this->mHeap) { + i_this->mpMorfSO->stopZelAnime(); + } + + return 1; } -#pragma pop /* 808070FC-808071F4 0029BC 00F8+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_yk_class* yk = (e_yk_class*)i_this; + + yk->mpMorfSO = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_YK", 12), + NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_YK",9), 2, 1.0f, 0, -1, &yk->mCreature, 0x80000,0x11000084); + if (!yk->mpMorfSO || !yk->mpMorfSO->mpModel) { + return 0; + } + + 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_yk/d_a_e_yk/useHeapInit__FP10fopAc_ac_c.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80807D50-80807D54 0000B4 0004+00 0/1 0/0 0/0 .rodata @5027 */ @@ -1163,20 +1905,119 @@ SECTION_DEAD static char const* const stringBase_80807D69 = "E_yk"; #pragma pop /* 808071F4-808075CC 002AB4 03D8+00 1/0 0/0 0/0 .text daE_YK_Create__FP10fopAc_ac_c */ +#ifdef NONMATCHING +// matches with literals +static int daE_YK_Create(fopAc_ac_c* i_this) { + if (!fopAcM_CheckCondition(i_this, 8)) { + new (i_this) e_yk_class(); + fopAcM_OnCondition(i_this, 8); + } + + e_yk_class* yk = (e_yk_class*)i_this; + + int phase_step = dComIfG_resLoad(&yk->mPhase,"E_YK"); + + if (phase_step == cPhs_COMPLEATE_e) { + s32 param = fopAcM_GetParam(yk) >> 24; + + if (param != 0xFF && dComIfGs_isSwitch(param,fopAcM_GetRoomNo(yk))) { + return cPhs_ERROR_e; + } + + yk->mParam1 = fopAcM_GetParam(yk); + yk->mPlayerTriggerBase = (fopAcM_GetParam(yk) >> 8) & 0xf; + yk->mPathIdx = fopAcM_GetParam(yk) >> 16; + + if (yk->mParam1 == 0xff) { + yk->mParam1 = 0; + } + + if (yk->mPlayerTriggerBase == 0xf) { + yk->mPlayerTriggerBase = 10; + } + + yk->mPlayerTrigger = 100.0f * yk->mPlayerTriggerBase; + + if (i_fopAcM_SearchByName(PROC_E_PZ)) { + // For phantom zant fights. Used in pl_check above + yk->mPlayerTrigger = 100000.0f; + } + + if (!fopAcM_entrySolidHeap(yk,useHeapInit,0x1740)) { + return cPhs_ERROR_e; + } else { + if (yk->mPathIdx != 0xff) { + yk->mpPath = dPath_GetRoomPath(yk->mPathIdx,fopAcM_GetRoomNo(yk)); + + if (!yk->mpPath) { + return cPhs_ERROR_e; + } + + yk->field_0x5b8 = yk->mPathIdx + 1; + yk->field_0x5ba = 1; + yk->mAction = ACT_PATH_FLY; + + } else { + if (yk->mParam1 == 1) { + yk->mAction = ACT_FLY; + } + } + + if (data_80807EF8 == 0) { + yk->field_0xa8c = 1; + data_80807EF8 = 1; + l_HIO.field_0x04 = -1; + } + + yk->mAttentionInfo.mFlags = 4; + + fopAcM_SetMtx(yk,yk->mpMorfSO->getModel()->getBaseTRMtx()); + fopAcM_SetMin(yk,-200.0f,-200.0f,-200.0f); + fopAcM_SetMax(yk,200.0f,200.0f,200.0f); + + yk->mHealth = 1; + yk->field_0x560 = 1; + + yk->mCollisionStatus.Init(0x1e,0,yk); + yk->mCollisionSphere.Set(*(dCcD_SrcSph*)&e_idx); // something weird going on here + yk->mCollisionSphere.SetStts(&yk->mCollisionStatus); + + yk->field_0x708.Set(&fopAcM_GetPosition_p(yk), + &fopAcM_GetOldPosition_p(yk),yk,1, + &yk->field_0x6c8, &fopAcM_GetSpeed_p(yk), + 0,0); + + yk->field_0x6c8.SetWall(50.0f,50.0f); + yk->mCreature.init(&yk->current.pos,&yk->mEyePos,3,1); + yk->mCreature.setEnemyName("E_yk"); + + yk->mAtColliderInfo.mpSound = &yk->mCreature; + yk->mAtColliderInfo.mPowerType = 1; + yk->field_0x66c = cM_rndF(65535.0f); + + daE_YK_Execute(yk); + } + } + + return phase_step; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void daE_YK_Create(fopAc_ac_c* param_0) { +static asm void daE_YK_Create(fopAc_ac_c* i_this) { nofralloc #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/daE_YK_Create__FP10fopAc_ac_c.s" } #pragma pop +#endif /* 808075CC-80807614 002E8C 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGSphFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm cM3dGSph::~cM3dGSph() { +// asm cM3dGSph::~cM3dGSph() { +extern "C" asm void __dt__8cM3dGSphFv() { nofralloc #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/__dt__8cM3dGSphFv.s" } @@ -1186,7 +2027,8 @@ asm cM3dGSph::~cM3dGSph() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm cM3dGAab::~cM3dGAab() { +// asm cM3dGAab::~cM3dGAab() { +extern "C" asm void __dt__8cM3dGAabFv() { nofralloc #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/__dt__8cM3dGAabFv.s" } @@ -1196,7 +2038,8 @@ asm cM3dGAab::~cM3dGAab() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm dCcD_GStts::~dCcD_GStts() { +// asm dCcD_GStts::~dCcD_GStts() { +extern "C" asm void __dt__10dCcD_GSttsFv() { nofralloc #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/__dt__10dCcD_GSttsFv.s" } @@ -1206,7 +2049,8 @@ asm dCcD_GStts::~dCcD_GStts() { #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_yk/d_a_e_yk/__dt__12dBgS_ObjAcchFv.s" } @@ -1216,7 +2060,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_yk/d_a_e_yk/__dt__12dBgS_AcchCirFv.s" } @@ -1226,7 +2071,8 @@ asm dBgS_AcchCir::~dBgS_AcchCir() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm cCcD_GStts::~cCcD_GStts() { +// asm cCcD_GStts::~cCcD_GStts() { +extern "C" asm void __dt__10cCcD_GSttsFv() { nofralloc #include "asm/rel/d/a/e/d_a_e_yk/d_a_e_yk/__dt__10cCcD_GSttsFv.s" } diff --git a/rel/d/a/obj/d_a_obj_web0/d_a_obj_web0.cpp b/rel/d/a/obj/d_a_obj_web0/d_a_obj_web0.cpp index bdb030c7638..be657d584b2 100644 --- a/rel/d/a/obj/d_a_obj_web0/d_a_obj_web0.cpp +++ b/rel/d/a/obj/d_a_obj_web0/d_a_obj_web0.cpp @@ -411,7 +411,7 @@ static int daObj_Web0_Create(fopAc_ac_c* i_this) { fopAcM_SetMtx(_this, _this->mpModel->getBaseTRMtx()); fopAcM_SetMin(_this, -1000.0f, -1000.0f, -1000.0f); fopAcM_SetMax(_this, 1000.0f, 1000.0f, 1000.0f); - _this->field_0x562 = 30; + _this->mHealth = 30; _this->field_0x560 = 30; _this->mStts.Init(250, 0, _this); diff --git a/src/c/c_damagereaction.cpp b/src/c/c_damagereaction.cpp index 5a871927909..e01e46c5d32 100644 --- a/src/c/c_damagereaction.cpp +++ b/src/c/c_damagereaction.cpp @@ -6,29 +6,17 @@ #include "c/c_damagereaction.h" #include "dol2asm.h" #include "dolphin/types.h" +#include "d/com/d_com_inf_game.h" // // Types: // -struct fopAc_ac_c {}; - -struct JPABaseParticle {}; - -struct JPABaseEmitter {}; - struct JPTraceParticleCallBack4 { /* 8001817C */ void execute(JPABaseEmitter*, JPABaseParticle*); /* 800182A4 */ void draw(JPABaseEmitter*, JPABaseParticle*); /* 80018328 */ ~JPTraceParticleCallBack4(); }; - -struct JPAParticleCallBack { - /* 800183D4 */ void execute(JPABaseEmitter*, JPABaseParticle*); - /* 800183D8 */ void draw(JPABaseEmitter*, JPABaseParticle*); - /* 8027EFA4 */ ~JPAParticleCallBack(); -}; - // // Forward References: // @@ -49,7 +37,7 @@ extern "C" void fopAcM_getTalkEventPartner__FPC10fopAc_ac_c(); extern "C" void __dt__19JPAParticleCallBackFv(); extern "C" void __dl__FPv(); extern "C" void __register_global_object(); -extern "C" extern u8 g_dComIfG_gameInfo[122384]; +// extern "C" extern u8 g_dComIfG_gameInfo[122384]; // // Declarations: @@ -105,14 +93,20 @@ void JPTraceParticleCallBack4::draw(JPABaseEmitter* param_0, JPABaseParticle* pa } /* 800182A8-80018328 012BE8 0080+00 0/0 0/0 22/22 .text cDmrNowMidnaTalk__Fv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm BOOL cDmrNowMidnaTalk() { - nofralloc -#include "asm/c/c_damagereaction/cDmrNowMidnaTalk__Fv.s" +BOOL cDmrNowMidnaTalk() { + if (i_dComIfGp_event_runCheck()) { + fopAc_ac_c* actor = (fopAc_ac_c*)fopAcM_getTalkEventPartner(daPy_getLinkPlayerActorClass()); + if (actor) { + if (fopAcM_GetName(actor) == PROC_MIDNA || fopAcM_GetName(actor) == PROC_Tag_Mhint || + fopAcM_GetName(actor) == PROC_Tag_Mstop || fopAcM_GetName(actor) == PROC_Tag_Hstop || + fopAcM_GetName(actor) == PROC_Tag_Mwait || fopAcM_GetName(actor) == PROC_Tag_Wljump) { + return 1; + } + } + } + + return 0; } -#pragma pop /* ############################################################################################## */ /* 803A3568-803A357C 000688 0014+00 2/2 0/0 0/0 .data __vt__24JPTraceParticleCallBack4 */