From de30e871af895a1c8227b0a3a5da213861bab9e6 Mon Sep 17 00:00:00 2001 From: Max Roncace Date: Sun, 25 May 2025 16:23:41 -0400 Subject: [PATCH] d_a_e_yd equivalent (func order) (#2455) --- include/d/actor/d_a_e_yd.h | 88 +- include/d/actor/d_a_player.h | 12 +- src/d/actor/d_a_alink.cpp | 6 +- src/d/actor/d_a_alink_damage.inc | 28 +- src/d/actor/d_a_e_rb.cpp | 2 +- src/d/actor/d_a_e_yd.cpp | 2438 +++++++++++++++++------------- 6 files changed, 1531 insertions(+), 1043 deletions(-) diff --git a/include/d/actor/d_a_e_yd.h b/include/d/actor/d_a_e_yd.h index c74149e3cff..f12d3dc3bb9 100644 --- a/include/d/actor/d_a_e_yd.h +++ b/include/d/actor/d_a_e_yd.h @@ -1,26 +1,98 @@ #ifndef D_A_E_YD_H #define D_A_E_YD_H +#include "SSystem/SComponent/c_cc_d.h" +#include "d/d_bg_s_acch.h" +#include "d/d_cc_d.h" +#include "d/d_cc_uty.h" #include "f_op/f_op_actor_mng.h" /** * @ingroup actors-enemies * @class e_yd_class * @brief Twilight Deku Baba - * - * @details - * + * + * @details + * */ -class e_yd_class : public fopEn_enemy_c { -private: - /* 0x5ac */ u8 field_0x5ac[0x126c - 0x5ac]; +class e_yd_class { +public: + /* 0x0 */ fopEn_enemy_c actor; + /* 0x5AC */ request_of_phase_process_class field_0x5ac; + /* 0x5B4 */ u8 field_0x5b4; + /* 0x5B5 */ u8 field_0x5b5; + /* 0x5B6 */ u8 field_0x5b6; + /* 0x5B7 */ u8 field_0x5b7; + /* 0x5B8 */ mDoExt_McaMorfSO* mpMorf; + /* 0x5BC */ Z2CreatureEnemy mCreatureSound; + /* 0x660 */ mDoExt_brkAnm* mBrkAnm; + /* 0x664 */ s32 field_0x664; + /* 0x668 */ u32 mShadowKey; + /* 0x66C */ s16 field_0x66c; + /* 0x66E */ s16 field_0x66e; + /* 0x670 */ s16 field_0x670; + /* 0x674 */ f32 field_0x674; + /* 0x678 */ cXyz field_0x678; + /* 0x684 */ s16 field_0x684; + /* 0x686 */ u8 field_0x686[0x688 - 0x686]; + /* 0x688 */ s16 mAngleToPlayer; + /* 0x68C */ f32 mHomeDistFromPlayer; + /* 0x690 */ s16 field_0x690; + /* 0x694 */ f32 field_0x694; + /* 0x698 */ f32 field_0x698; + /* 0x69C */ s16 field_0x69c[4]; + /* 0x6A4 */ cXyz mJointPositions[12]; + /* 0x734 */ csXyz mJointRotations[12]; + /* 0x77C */ J3DModel* field_0x77c[11]; + /* 0x7A8 */ u8 field_0x7a8[0x7dc - 0x7a8]; + /* 0x7DC */ f32 field_0x7dc[11]; + /* 0x802 */ u8 field_0x808[0x80c - 0x808]; + /* 0x80C */ mDoExt_3DlineMat1_c mLineMat; + /* 0x848 */ f32 field_0x848; + /* 0x84C */ f32 field_0x84c; + /* 0x850 */ f32 field_0x850; + /* 0x854 */ u8 field_0x854[0x855 - 0x854]; + /* 0x855 */ s8 mLeafRoomNo; + /* 0x856 */ s8 field_0x856; + /* 0x858 */ f32 field_0x858; + /* 0x85C */ u8 field_0x85c[0x864 - 0x85C]; + /* 0x864 */ dCcD_Stts mStts; + /* 0x8A0 */ dCcD_Sph field_0x8a0; + /* 0x9D8 */ dCcD_Sph field_0x9d8; + /* 0xB10 */ s8 field_0xb10; + /* 0xB11 */ s8 field_0xb11; + /* 0xB14 */ dCcD_Sph field_0xb14[4]; + /* 0xFF4 */ dCcU_AtInfo field_0xff4; + /* 0x1018 */ dBgS_AcchCir field_0x1018; + /* 0x1058 */ dBgS_ObjAcch field_0x1058; + /* 0x1230 */ fpc_ProcID mLeafId; + /* 0x1234 */ s8 field_0x1234; + /* 0x1235 */ s8 field_0x1235; + /* 0x1238 */ u32 field_0x1238[3]; + /* 0x1244 */ s32 field_0x1244; + /* 0x1248 */ s32 field_0x1248; + /* 0x124C */ s32 field_0x124c; + /* 0x1250 */ f32 field_0x1250; + /* 0x1254 */ u8 field_0x1254[0x1268 - 0x1254]; + /* 0x1268 */ u8 field_0x1268; }; STATIC_ASSERT(sizeof(e_yd_class) == 0x126c); class daE_YD_HIO_c { - /* 807F2C2C */ daE_YD_HIO_c(); - /* 807F74CC */ ~daE_YD_HIO_c(); +public: + daE_YD_HIO_c(); + virtual ~daE_YD_HIO_c() {} + + /* 0x4 */ s8 field_0x4; + /* 0x8 */ f32 field_0x8; + /* 0xC */ f32 field_0xc; + /* 0x10 */ f32 field_0x10; + /* 0x14 */ s16 field_0x14; + /* 0x16 */ s16 field_0x16; + /* 0x18 */ u8 field_0x18; }; +STATIC_ASSERT(sizeof(daE_YD_HIO_c) == 0x1c); + #endif /* D_A_E_YD_H */ diff --git a/include/d/actor/d_a_player.h b/include/d/actor/d_a_player.h index bfe343f1c62..42105788e41 100644 --- a/include/d/actor/d_a_player.h +++ b/include/d/actor/d_a_player.h @@ -330,7 +330,7 @@ public: FLG0_UNK_100000 = 0x100000, FLG0_UNK_80000 = 0x80000, FLG0_UNK_40000 = 0x40000, - FLG0_UNK_20000 = 0x20000, + FLG0_DK_CAUGHT = 0x20000, FLG0_UNK_10000 = 0x10000, FLG0_UNK_8000 = 0x8000, FLG0_UNK_4000 = 0x4000, @@ -347,13 +347,14 @@ public: FLG0_MIDNA_RIDE = 4, FLG0_UNK_2 = 2, - FLG0_HVY_STATE = FLG0_UNK_40000000 | FLG0_EQUIP_HVY_BOOTS | FLG0_UNK_20000, + FLG0_HVY_STATE = FLG0_UNK_40000000 | FLG0_EQUIP_HVY_BOOTS | FLG0_DK_CAUGHT, FLG0_UNK_14000 = 0x14000, FLG0_UNK_10400 = 0x10400, FLG0_UNK_18 = FLG0_UNK_10 | FLG0_UNK_8, }; enum daPy_FLG1 { + FLG1_UNK_80000000 = 0x80000000, FLG1_ICE_FREEZE = 0x40000000, FLG1_UNK_20000000 = 0x20000000, FLG1_UNK_10000000 = 0x10000000, @@ -382,7 +383,7 @@ public: FLG1_UNK_8 = 8, FLG1_UNK_4 = 4, FLG1_UNK_2 = 2, - FLG1_UNK_1 = 1, + FLG1_DK_CAUGHT = 1, FLG1_UNK_1800 = 0x1800, FLG1_UNK_10100000 = FLG1_UNK_10000000 | FLG1_UNK_100000, @@ -703,6 +704,8 @@ public: cXyz getRightHandPos() const { return mRightHandPos; } const cXyz getLeftHandPos() const { return mLeftHandPos; } const cXyz getItemPos() const { return mItemPos; } + bool getDkCaught() const { return checkNoResetFlg1(FLG1_DK_CAUGHT); } + bool getStCaught() const { return checkNoResetFlg1(FLG1_UNK_80000000); } virtual cXyz* getMidnaAtnPos() const { return NULL; } virtual void setMidnaMsgNum(fopAc_ac_c*, u16) {} @@ -1047,7 +1050,8 @@ public: void offPressedDamage() { offNoResetFlg2(FLG2_PRESSED_DAMAGE); } void onForceSubjectCancel() { onEndResetFlg0(ERFLG0_FORCE_SUBJECT_CANCEL); } void onEnemyDead() { onEndResetFlg0(ERFLG0_ENEMY_DEAD); } - void offDkCaught2() { offNoResetFlg0(FLG0_UNK_20000); } + void offDkCaught() { offNoResetFlg1(FLG1_DK_CAUGHT); } + void offDkCaught2() { offNoResetFlg0(FLG0_DK_CAUGHT); } void onWaterFallFrontHit() { onEndResetFlg1(ERFLG1_UNK_800); } void onCanoeItemCancel() { onEndResetFlg1(ERFLG1_UNK_20000000); } diff --git a/src/d/actor/d_a_alink.cpp b/src/d/actor/d_a_alink.cpp index 81b95da8fed..f985187a8ec 100644 --- a/src/d/actor/d_a_alink.cpp +++ b/src/d/actor/d_a_alink.cpp @@ -7060,7 +7060,7 @@ int daAlink_c::setUpperAnime(u16 i_anmResID, daAlink_c::daAlink_UPPER param_1, f } if (checkDkCaught2Anime()) { - offNoResetFlg0(FLG0_UNK_20000); + offNoResetFlg0(FLG0_DK_CAUGHT); } J3DAnmTransform* var_r30 = getAnimeResource(&mUpperAnmHeap[param_1], i_anmResID, 0x2C00); @@ -7131,7 +7131,7 @@ int daAlink_c::resetUpperAnime(daAlink_c::daAlink_UPPER param_0, f32 param_1) { } if (checkDkCaught2Anime()) { - offNoResetFlg0(FLG0_UNK_20000); + offNoResetFlg0(FLG0_DK_CAUGHT); } else if (checkWolfEnemyThrowAnime()) { resetWolfEnemyBiteAll(); } @@ -11097,7 +11097,7 @@ BOOL daAlink_c::checkUpperItemAction() { field_0x30f6 -= daAlinkHIO_damCaught_c0::m.field_0x16; } - if (field_0x30f6 < 0 || !checkNoResetFlg0(FLG0_UNK_20000)) { + if (field_0x30f6 < 0 || !checkNoResetFlg0(FLG0_DK_CAUGHT)) { voiceStart(Z2SE_AL_V_ZENTEN_FAIL_2); if (mLinkAcch.ChkGroundHit()) { diff --git a/src/d/actor/d_a_alink_damage.inc b/src/d/actor/d_a_alink_damage.inc index ed03eaad287..d3bcb51ee2c 100644 --- a/src/d/actor/d_a_alink_damage.inc +++ b/src/d/actor/d_a_alink_damage.inc @@ -31,8 +31,8 @@ bool daAlink_c::checkMiddleBossGoronRoom() { /* 800D6DF0-800D6E24 0D1730 0034+00 1/0 0/0 0/0 .text setDkCaught__9daAlink_cFP10fopAc_ac_c */ void daAlink_c::setDkCaught(fopAc_ac_c* param_0) { - if (!checkNoResetFlg1(FLG1_UNK_1)) { - onNoResetFlg1(FLG1_UNK_1); + if (!checkNoResetFlg1(FLG1_DK_CAUGHT)) { + onNoResetFlg1(FLG1_DK_CAUGHT); field_0x28f8 = fopAcM_GetID(param_0); } } @@ -363,12 +363,12 @@ void daAlink_c::damageTimerCount() { } mDamageTimer--; - if (mProcID != PROC_DK_CAUGHT && checkNoResetFlg1(FLG1_UNK_1)) { - offNoResetFlg1(FLG1_UNK_1); + if (mProcID != PROC_DK_CAUGHT && checkNoResetFlg1(FLG1_DK_CAUGHT)) { + offNoResetFlg1(FLG1_DK_CAUGHT); } - if (!checkDkCaught2Anime() && checkNoResetFlg0(FLG0_UNK_20000)) { - offNoResetFlg0(FLG0_UNK_20000); + if (!checkDkCaught2Anime() && checkNoResetFlg0(FLG0_DK_CAUGHT)) { + offNoResetFlg0(FLG0_DK_CAUGHT); } } else if (mDamageColorTime != 0) { mDamageColorTime--; @@ -431,22 +431,22 @@ BOOL daAlink_c::checkDamageAction() { } if (checkEventRun()) { - offNoResetFlg1(FLG1_UNK_1); - offNoResetFlg0(FLG0_UNK_20000); + offNoResetFlg1(FLG1_DK_CAUGHT); + offNoResetFlg0(FLG0_DK_CAUGHT); return 0; } - if (checkNoResetFlg1(FLG1_UNK_1)) { + if (checkNoResetFlg1(FLG1_DK_CAUGHT)) { if (!checkModeFlg(0x70C52) && !checkWolf() && procDkCaughtInit(field_0x28f8)) { return 1; } if (mProcID != PROC_DK_CAUGHT) { - offNoResetFlg1(FLG1_UNK_1); + offNoResetFlg1(FLG1_DK_CAUGHT); } } - if (checkNoResetFlg0(FLG0_UNK_20000)) { + if (checkNoResetFlg0(FLG0_DK_CAUGHT)) { if ((!checkModeFlg(0x70C52)) && (!checkWolf()) && (!checkDkCaught2Anime())) { setUpperAnimeBase(getMainBckData(ANM_HORSE_WAIT_D_B)->m_underID); setFacePriAnime(ANM_HORSE_WAIT_D_B); @@ -458,7 +458,7 @@ BOOL daAlink_c::checkDamageAction() { } if (!checkDkCaught2Anime()) { - offNoResetFlg0(FLG0_UNK_20000); + offNoResetFlg0(FLG0_DK_CAUGHT); } } @@ -1805,7 +1805,7 @@ int daAlink_c::procDkCaughtInit(fpc_ProcID param_0) { } setSingleAnimeBase(ANM_WAIT_D_B); - onNoResetFlg1(FLG1_UNK_1); + onNoResetFlg1(FLG1_DK_CAUGHT); field_0x28f8 = param_0; mNormalSpeed = 0.0f; @@ -1823,7 +1823,7 @@ int daAlink_c::procDkCaughtInit(fpc_ProcID param_0) { /* 800DB860-800DBC98 0D61A0 0438+00 1/0 0/0 0/0 .text procDkCaught__9daAlink_cFv */ int daAlink_c::procDkCaught() { fopAc_ac_c* temp_r3 = fopAcM_SearchByID(field_0x28f8); - if (temp_r3 == NULL || !checkNoResetFlg1(FLG1_UNK_1)) { + if (temp_r3 == NULL || !checkNoResetFlg1(FLG1_DK_CAUGHT)) { voiceStart(Z2SE_AL_V_ZENTEN_FAIL_2); return procFrontRollSuccessInit(); } diff --git a/src/d/actor/d_a_e_rb.cpp b/src/d/actor/d_a_e_rb.cpp index e2a67c3677a..cb1f6d3cb66 100644 --- a/src/d/actor/d_a_e_rb.cpp +++ b/src/d/actor/d_a_e_rb.cpp @@ -829,7 +829,7 @@ static int daE_RB_Create(fopAc_ac_c* i_this) { if (!l_HIOInit) { a_this->HIOInit = TRUE; l_HIOInit = TRUE; - l_HIO.id = mDoHIO_CREATE_CHILD("リーバ", &l_HIO); + //l_HIO.id = mDoHIO_CREATE_CHILD("リーバ", &l_HIO); } i_this->attention_info.flags = 4; diff --git a/src/d/actor/d_a_e_yd.cpp b/src/d/actor/d_a_e_yd.cpp index fec432bd51a..f11b86694ca 100644 --- a/src/d/actor/d_a_e_yd.cpp +++ b/src/d/actor/d_a_e_yd.cpp @@ -4,1108 +4,1520 @@ */ #include "d/actor/d_a_e_yd.h" +#include "d/actor/d_a_e_yd_leaf.h" +#include "d/d_bg_w.h" #include "d/d_cc_d.h" -#include "dol2asm.h" +#include "d/d_cc_uty.h" UNK_REL_DATA; #include "f_op/f_op_actor_enemy.h" - -// -// Forward References: -// - -extern "C" void __ct__12daE_YD_HIO_cFv(); -extern "C" static void yd_disappear__FP10e_yd_class(); -extern "C" static void anm_init__FP10e_yd_classifUcf(); -extern "C" static void leaf_anm_init__FP10e_yd_classifUcf(); -extern "C" static void daE_YD_Draw__FP10e_yd_class(); -extern "C" static void pl_check__FP10e_yd_classf(); -extern "C" static void damage_check__FP10e_yd_class(); -extern "C" static void e_yd_stay__FP10e_yd_class(); -extern "C" static void e_yd_appear__FP10e_yd_class(); -extern "C" static void e_yd_appear_v__FP10e_yd_class(); -extern "C" static void e_yd_wait__FP10e_yd_class(); -extern "C" static void e_yd_attack__FP10e_yd_class(); -extern "C" static void e_yd_chance__FP10e_yd_class(); -extern "C" static void e_yd_s_damage__FP10e_yd_class(); -extern "C" static void e_yd_damage__FP10e_yd_class(); -extern "C" static void kuki_control1__FP10e_yd_class(); -extern "C" static void kuki_control2__FP10e_yd_class(); -extern "C" static void kuki_control3__FP10e_yd_class(); -extern "C" static void kuki_ha_set__FP10e_yd_class(); -extern "C" static void action__FP10e_yd_class(); -extern "C" static void eff_set__FP10e_yd_class(); -extern "C" static void anm_se_set__FP10e_yd_class(); -extern "C" static void daE_YD_Execute__FP10e_yd_class(); -extern "C" static bool daE_YD_IsDelete__FP10e_yd_class(); -extern "C" static void daE_YD_Delete__FP10e_yd_class(); -extern "C" static void useHeapInit__FP10fopAc_ac_c(); -extern "C" void __dt__12J3DFrameCtrlFv(); -extern "C" static void daE_YD_Create__FP10fopAc_ac_c(); -extern "C" void __dt__12dBgS_ObjAcchFv(); -extern "C" void __dt__12dBgS_AcchCirFv(); -extern "C" void __ct__8dCcD_SphFv(); -extern "C" void __dt__8dCcD_SphFv(); -extern "C" void __dt__8cM3dGSphFv(); -extern "C" void __dt__8cM3dGAabFv(); -extern "C" void __dt__10dCcD_GSttsFv(); -extern "C" void __ct__5csXyzFv(); -extern "C" void __ct__4cXyzFv(); -extern "C" void __dt__10cCcD_GSttsFv(); -extern "C" void __dt__12daE_YD_HIO_cFv(); -extern "C" void __sinit_d_a_e_yd_cpp(); -extern "C" static void func_807F7550(); -extern "C" static void func_807F7558(); -extern "C" void __dt__5csXyzFv(); -extern "C" void __dt__4cXyzFv(); -extern "C" extern char const* const d_a_e_yd__stringBase0; - -// -// External References: -// - -extern "C" void mDoMtx_XrotM__FPA4_fs(); -extern "C" void mDoMtx_YrotS__FPA4_fs(); -extern "C" void mDoMtx_YrotM__FPA4_fs(); -extern "C" void mDoMtx_ZrotM__FPA4_fs(); -extern "C" void scaleM__14mDoMtx_stack_cFfff(); -extern "C" void play__14mDoExt_baseAnmFv(); -extern "C" void init__13mDoExt_brkAnmFP16J3DMaterialTableP15J3DAnmTevRegKeyiifss(); -extern "C" void entry__13mDoExt_brkAnmFP16J3DMaterialTablef(); -extern "C" void mDoExt_modelUpdateDL__FP8J3DModel(); -extern "C" void setAnm__14mDoExt_McaMorfFP15J3DAnmTransformiffffPv(); -extern "C" void play__14mDoExt_McaMorfFP3VecUlSc(); -extern "C" void -__ct__16mDoExt_McaMorfSOFP12J3DModelDataP25mDoExt_McaMorfCallBack1_cP25mDoExt_McaMorfCallBack2_cP15J3DAnmTransformifiiP10Z2CreatureUlUl(); -extern "C" void setAnm__16mDoExt_McaMorfSOFP15J3DAnmTransformiffff(); -extern "C" void play__16mDoExt_McaMorfSOFUlSc(); -extern "C" void entryDL__16mDoExt_McaMorfSOFv(); -extern "C" void modelCalc__16mDoExt_McaMorfSOFv(); -extern "C" void stopZelAnime__16mDoExt_McaMorfSOFv(); -extern "C" void init__19mDoExt_3DlineMat1_cFUsUsP7ResTIMGi(); -extern "C" void update__19mDoExt_3DlineMat1_cFiR8_GXColorP12dKy_tevstr_c(); -extern "C" void setMat__26mDoExt_3DlineMatSortPacketFP18mDoExt_3DlineMat_c(); -extern "C" void mDoExt_J3DModel__create__FP12J3DModelDataUlUl(); -extern "C" void __ct__10fopAc_ac_cFv(); -extern "C" void fopAcIt_Judge__FPFPvPv_PvPv(); -extern "C" void fopAcM_delete__FP10fopAc_ac_c(); -extern "C" void fopAcM_createChild__FsUiUlPC4cXyziPC5csXyzPC4cXyzScPFPv_i(); -extern "C" void fopAcM_entrySolidHeap__FP10fopAc_ac_cPFP10fopAc_ac_c_iUl(); -extern "C" void fopAcM_SetMin__FP10fopAc_ac_cfff(); -extern "C" void fopAcM_SetMax__FP10fopAc_ac_cfff(); -extern "C" void fopAcM_searchActorAngleY__FPC10fopAc_ac_cPC10fopAc_ac_c(); -extern "C" void fopAcM_createItemFromEnemyID__FUcPC4cXyziiPC5csXyzPC4cXyzPfPf(); -extern "C" void fopAcM_otherBgCheck__FPC10fopAc_ac_cPC10fopAc_ac_c(); -extern "C" void gndCheck__11fopAcM_gc_cFPC4cXyz(); -extern "C" void fpcSch_JudgeByID__FPvPv(); -extern "C" void dComIfG_resLoad__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfG_resDelete__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfGp_getReverb__Fi(); -extern "C" void -dComIfGd_setShadow__FUlScP8J3DModelP4cXyzffffR13cBgS_PolyInfoP12dKy_tevstr_csfP9_GXTexObj(); -extern "C" void getRes__14dRes_control_cFPCclP11dRes_info_ci(); -extern "C" void forceOnEventMove__Q213dPa_control_c7level_cFUl(); -extern "C" void getEmitter__Q213dPa_control_c7level_cFUl(); -extern "C" void -set__13dPa_control_cFUcUsPC4cXyzPC12dKy_tevstr_cPC5csXyzPC4cXyzUcP18dPa_levelEcallBackScPC8_GXColorPC8_GXColorPC4cXyzf(); -extern "C" void -set__13dPa_control_cFUlUcUsPC4cXyzPC12dKy_tevstr_cPC5csXyzPC4cXyzUcP18dPa_levelEcallBackScPC8_GXColorPC8_GXColorPC4cXyzf(); -extern "C" void StartShock__12dVibration_cFii4cXyz(); -extern "C" void __ct__12dBgS_AcchCirFv(); -extern "C" void SetWall__12dBgS_AcchCirFff(); -extern "C" void __dt__9dBgS_AcchFv(); -extern "C" void __ct__9dBgS_AcchFv(); -extern "C" void Set__9dBgS_AcchFP4cXyzP4cXyzP10fopAc_ac_ciP12dBgS_AcchCirP4cXyzP5csXyzP5csXyz(); -extern "C" void CrrPos__9dBgS_AcchFR4dBgS(); -extern "C" void SetObj__16dBgS_PolyPassChkFv(); -extern "C" void __ct__10dCcD_GSttsFv(); -extern "C" void Move__10dCcD_GSttsFv(); -extern "C" void Init__9dCcD_SttsFiiP10fopAc_ac_c(); -extern "C" void __ct__12dCcD_GObjInfFv(); -extern "C" void __dt__12dCcD_GObjInfFv(); -extern "C" void ChkAtHit__12dCcD_GObjInfFv(); -extern "C" void ChkTgHit__12dCcD_GObjInfFv(); -extern "C" void GetTgHitObj__12dCcD_GObjInfFv(); -extern "C" void Set__8dCcD_SphFRC11dCcD_SrcSph(); -extern "C" void StartCAt__8dCcD_SphFR4cXyz(); -extern "C" void MoveCAt__8dCcD_SphFR4cXyz(); -extern "C" void def_se_set__FP10Z2CreatureP8cCcD_ObjUlP10fopAc_ac_c(); -extern "C" void at_power_check__FP11dCcU_AtInfo(); -extern "C" void settingTevStruct__18dScnKy_env_light_cFiP4cXyzP12dKy_tevstr_c(); -extern "C" void setLightTevColorType_MAJI__18dScnKy_env_light_cFP12J3DModelDataP12dKy_tevstr_c(); -extern "C" void dKy_darkworld_check__Fv(); -extern "C" void GetAc__8cCcD_ObjFv(); -extern "C" void Set__4cCcSFP8cCcD_Obj(); -extern "C" void __pl__4cXyzCFRC3Vec(); -extern "C" void __mi__4cXyzCFRC3Vec(); -extern "C" void __ml__4cXyzCFf(); -extern "C" void cM_atan2s__Fff(); -extern "C" void cM_rndF__Ff(); -extern "C" void cM_rndFX__Ff(); -extern "C" void __dt__13cBgS_PolyInfoFv(); -extern "C" void __dt__8cM3dGCirFv(); -extern "C" void SetC__8cM3dGSphFRC4cXyz(); -extern "C" void SetR__8cM3dGSphFf(); -extern "C" void cLib_addCalc2__FPffff(); -extern "C" void cLib_addCalc0__FPfff(); -extern "C" void cLib_addCalcAngleS2__FPssss(); -extern "C" void MtxScale__FfffUc(); -extern "C" void MtxPosition__FP4cXyzP4cXyz(); -extern "C" void deleteAllParticle__14JPABaseEmitterFv(); -extern "C" void func_802807E0(); -extern "C" void func_80280808(); -extern "C" void seStart__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc(); -extern "C" void __ct__15Z2CreatureEnemyFv(); -extern "C" void init__15Z2CreatureEnemyFP3VecP3VecUcUc(); -extern "C" void setLinkSearch__15Z2CreatureEnemyFb(); -extern "C" void setEnemyName__15Z2CreatureEnemyFPCc(); -extern "C" void* __nw__FUl(); -extern "C" void __dl__FPv(); -extern "C" void init__12J3DFrameCtrlFs(); -extern "C" void checkPass__12J3DFrameCtrlFf(); -extern "C" void __construct_array(); -extern "C" void _savegpr_19(); -extern "C" void _savegpr_23(); -extern "C" void _savegpr_24(); -extern "C" void _savegpr_25(); -extern "C" void _savegpr_26(); -extern "C" void _savegpr_27(); -extern "C" void _savegpr_28(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_19(); -extern "C" void _restgpr_23(); -extern "C" void _restgpr_24(); -extern "C" void _restgpr_25(); -extern "C" void _restgpr_26(); -extern "C" void _restgpr_27(); -extern "C" void _restgpr_28(); -extern "C" void _restgpr_29(); -extern "C" extern void* __vt__19mDoExt_3DlineMat1_c[5]; -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" u8 mGndCheck__11fopAcM_gc_c[84]; -extern "C" u8 mSimpleTexObj__21dDlst_shadowControl_c[32]; -extern "C" u8 sincosTable___5JMath[65536]; -extern "C" f32 mGroundY__11fopAcM_gc_c; -extern "C" u8 m_midnaActor__9daPy_py_c[4]; -extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */]; -extern "C" void __register_global_object(); - -// -// Declarations: -// - -/* ############################################################################################## */ -/* 807F7A2C-807F7A30 00002C 0004+00 1/4 0/0 0/0 .rodata @3809 */ -SECTION_RODATA static f32 const lit_3809 = 0.5f; -COMPILER_STRIP_GATE(0x807F7A2C, &lit_3809); - -/* 807F7B70-807F7B74 000038 0004+00 1/1 0/0 0/0 .data l_color$3890 */ -SECTION_DATA static u8 l_color[4] = { - 0x14, - 0x0F, - 0x00, - 0xFF, -}; - -/* 807F7B74-807F7B8C 00003C 0016+02 1/1 0/0 0/0 .data pow_xa$4634 */ -SECTION_DATA static u8 pow_xa[22 + 2 /* padding */] = { - 0x00, - 0x00, - 0x00, - 0x00, - 0x10, - 0x00, - 0x20, - 0x00, - 0x30, - 0x00, - 0x40, - 0x00, - 0x30, - 0x00, - 0x20, - 0x00, - 0x10, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - /* padding */ - 0x00, - 0x00, -}; - -/* 807F7B8C-807F7BB0 -00001 0024+00 1/1 0/0 0/0 .data @5007 */ -SECTION_DATA static void* lit_5007[9] = { - (void*)(((char*)action__FP10e_yd_class) + 0x1CC), - (void*)(((char*)action__FP10e_yd_class) + 0x1E0), - (void*)(((char*)action__FP10e_yd_class) + 0x200), - (void*)(((char*)action__FP10e_yd_class) + 0x220), - (void*)(((char*)action__FP10e_yd_class) + 0x240), - (void*)(((char*)action__FP10e_yd_class) + 0x2AC), - (void*)(((char*)action__FP10e_yd_class) + 0x260), - (void*)(((char*)action__FP10e_yd_class) + 0x280), - (void*)(((char*)action__FP10e_yd_class) + 0x2A0), -}; - -/* 807F7BB0-807F7BB8 000078 0006+02 1/1 0/0 0/0 .data p_name$5015 */ -SECTION_DATA static u8 p_name[6 + 2 /* padding */] = { - 0x88, - 0x11, - 0x88, - 0x12, - 0x88, - 0x13, - /* padding */ - 0x00, - 0x00, -}; - -/* 807F7BB8-807F7BC4 000080 000C+00 1/1 0/0 0/0 .data p_idx$5016 */ -SECTION_DATA static u8 p_idx[12] = { - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, -}; - -/* 807F7BC4-807F7C04 00008C 0040+00 0/1 0/0 0/0 .data cc_sph_src$5344 */ -#pragma push -#pragma force_active on -static dCcD_SrcSph cc_sph_src = { - { - {0x0, {{0x0, 0x0, 0xd}, {0xd8fbfdff, 0x3}, 0x25}}, // mObj - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt - {dCcD_SE_STONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg - {0x0}, // mGObjCo - }, // mObjInf - { - {{0.0f, 0.0f, 0.0f}, 40.0f} // mSph - } // mSphAttr -}; -#pragma pop - -/* 807F7C04-807F7C44 0000CC 0040+00 0/1 0/0 0/0 .data at_sph_src$5345 */ -#pragma push -#pragma force_active on -static dCcD_SrcSph at_sph_src = { - { - {0x0, {{AT_TYPE_CSTATUE_SWING, 0x1, 0xd}, {0x0, 0x0}, 0x0}}, // 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}, 35.0f} // mSph - } // mSphAttr -}; -#pragma pop - -/* 807F7C44-807F7C84 00010C 0040+00 0/1 0/0 0/0 .data kuki_sph_src$5346 */ -#pragma push -#pragma force_active on -static dCcD_SrcSph kuki_sph_src = { - { - {0x0, {{0x0, 0x0, 0xd}, {0xd8fbfdff, 0x3}, 0x0}}, // mObj - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg - {0x0}, // mGObjCo - }, // mObjInf - { - {{0.0f, 0.0f, 0.0f}, 20.0f} // mSph - } // mSphAttr -}; -#pragma pop - -/* 807F7C84-807F7CA4 -00001 0020+00 1/0 0/0 0/0 .data l_daE_YD_Method */ -static actor_method_class l_daE_YD_Method = { - (process_method_func)daE_YD_Create__FP10fopAc_ac_c, - (process_method_func)daE_YD_Delete__FP10e_yd_class, - (process_method_func)daE_YD_Execute__FP10e_yd_class, - (process_method_func)daE_YD_IsDelete__FP10e_yd_class, - (process_method_func)daE_YD_Draw__FP10e_yd_class, -}; - -/* 807F7CA4-807F7CD4 -00001 0030+00 0/0 0/0 1/0 .data g_profile_E_YD */ -extern actor_process_profile_definition g_profile_E_YD = { - fpcLy_CURRENT_e, // mLayerID - 7, // mListID - fpcPi_CURRENT_e, // mListPrio - PROC_E_YD, // mProcName - &g_fpcLf_Method.base, // sub_method - sizeof(e_yd_class), // mSize - 0, // mSizeOther - 0, // mParameters - &g_fopAc_Method.base, // sub_method - 143, // mPriority - &l_daE_YD_Method, // sub_method - 0x10050100, // mStatus - fopAc_ENEMY_e, // mActorType - fopAc_CULLBOX_CUSTOM_e, // cullType -}; - -/* 807F7CD4-807F7CE0 00019C 000C+00 2/2 0/0 0/0 .data __vt__10cCcD_GStts */ -SECTION_DATA extern void* __vt__10cCcD_GStts[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__10cCcD_GSttsFv, -}; - -/* 807F7CE0-807F7CEC 0001A8 000C+00 1/1 0/0 0/0 .data __vt__10dCcD_GStts */ -SECTION_DATA extern void* __vt__10dCcD_GStts[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__10dCcD_GSttsFv, -}; - -/* 807F7CEC-807F7CF8 0001B4 000C+00 1/1 0/0 0/0 .data __vt__12dBgS_AcchCir */ -SECTION_DATA extern void* __vt__12dBgS_AcchCir[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12dBgS_AcchCirFv, -}; - -/* 807F7CF8-807F7D1C 0001C0 0024+00 2/2 0/0 0/0 .data __vt__12dBgS_ObjAcch */ -SECTION_DATA extern void* __vt__12dBgS_ObjAcch[9] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12dBgS_ObjAcchFv, - (void*)NULL, - (void*)NULL, - (void*)func_807F7558, - (void*)NULL, - (void*)NULL, - (void*)func_807F7550, -}; - -/* 807F7D1C-807F7D28 0001E4 000C+00 4/4 0/0 0/0 .data __vt__8cM3dGSph */ -SECTION_DATA extern void* __vt__8cM3dGSph[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__8cM3dGSphFv, -}; - -/* 807F7D28-807F7D34 0001F0 000C+00 4/4 0/0 0/0 .data __vt__8cM3dGAab */ -SECTION_DATA extern void* __vt__8cM3dGAab[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__8cM3dGAabFv, -}; - -/* 807F7D34-807F7D48 0001FC 0014+00 1/1 0/0 0/0 .data __vt__18mDoExt_3DlineMat_c */ -SECTION_DATA extern void* __vt__18mDoExt_3DlineMat_c[5] = { - (void*)NULL /* RTTI */, (void*)NULL, (void*)NULL, (void*)NULL, (void*)NULL, -}; - -/* 807F7D48-807F7D54 000210 000C+00 2/2 0/0 0/0 .data __vt__12J3DFrameCtrl */ -SECTION_DATA extern void* __vt__12J3DFrameCtrl[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12J3DFrameCtrlFv, -}; - -/* 807F7D54-807F7D60 00021C 000C+00 2/2 0/0 0/0 .data __vt__12daE_YD_HIO_c */ -SECTION_DATA extern void* __vt__12daE_YD_HIO_c[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12daE_YD_HIO_cFv, -}; - -/* 807F2C2C-807F2C78 0000EC 004C+00 1/1 0/0 0/0 .text __ct__12daE_YD_HIO_cFv */ +/* 807F2C2C-807F2C78 0000EC 004C+00 1/1 0/0 0/0 .text __ct__12daE_YD_HIO_cFv */ daE_YD_HIO_c::daE_YD_HIO_c() { - // NONMATCHING + field_0x4 = -1; + field_0x8 = 1.0f; + field_0xc = 0.5f; + field_0x10 = 1.0f; + field_0x14 = 0x46; + field_0x16 = 0x1e; + field_0x18 = 1; } -/* ############################################################################################## */ -/* 807F7A30-807F7A34 000030 0004+00 0/1 0/0 0/0 .rodata @3870 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3870 = 1.5f; -COMPILER_STRIP_GATE(0x807F7A30, &lit_3870); -#pragma pop - -/* 807F7A34-807F7A38 000034 0004+00 2/4 0/0 0/0 .rodata @3871 */ -SECTION_RODATA static f32 const lit_3871 = -1.0f; -COMPILER_STRIP_GATE(0x807F7A34, &lit_3871); - /* 807F2C78-807F2E20 000138 01A8+00 1/1 0/0 0/0 .text yd_disappear__FP10e_yd_class */ -static void yd_disappear(e_yd_class* param_0) { - // NONMATCHING +static void yd_disappear(e_yd_class* i_this) { + cXyz particleScale(1.5f, 1.5f, 1.5f); + dComIfGp_particle_set(0x826c, &i_this->actor.current.pos, NULL, &particleScale); + dComIfGp_particle_set(0x826d, &i_this->actor.current.pos, NULL, &particleScale); + fopAcM_seStart(&i_this->actor, Z2SE_DARK_VANISH, 0); + fopAcM_createItemFromEnemyID(0x2b, &i_this->actor.current.pos, -1, -1, NULL, NULL, NULL, NULL); + fopAcM_delete(&i_this->actor); + i_this->actor.field_0x567 = 1; + + for (s32 i = 0; i <= 2; i++) { + JPABaseEmitter* emitter = dComIfGp_particle_getEmitter(i_this->field_0x1238[i]); + if (emitter != NULL) { + emitter->deleteAllParticle(); + dComIfGp_particle_levelEmitterOnEventMove(i_this->field_0x1238[i]); + } + } } -/* ############################################################################################## */ -/* 807F7B30-807F7B30 000130 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_807F7B30 = "E_yd"; -#pragma pop - /* 807F2E20-807F2ECC 0002E0 00AC+00 8/8 0/0 0/0 .text anm_init__FP10e_yd_classifUcf */ -static void anm_init(e_yd_class* param_0, int param_1, f32 param_2, u8 param_3, f32 param_4) { - // NONMATCHING +static void anm_init(e_yd_class* i_this, int param_1, f32 param_2, u8 param_3, f32 param_4) { + J3DAnmTransform* anmTransform = (J3DAnmTransform*)dComIfG_getObjectRes("E_yd", param_1); + i_this->mpMorf->setAnm(anmTransform, param_3, param_2, param_4, 0.0f, -1.0f); + i_this->field_0x664 = param_1; } /* 807F2ECC-807F2FA4 00038C 00D8+00 8/8 0/0 0/0 .text leaf_anm_init__FP10e_yd_classifUcf */ -static void leaf_anm_init(e_yd_class* param_0, int param_1, f32 param_2, u8 param_3, - f32 param_4) { - // NONMATCHING +static s32 leaf_anm_init(e_yd_class* i_this, int param_1, f32 param_2, u8 param_3, f32 param_4) { + e_yd_leaf_class* leaf = (e_yd_leaf_class*)fopAcM_SearchByID(i_this->mLeafId); + if (leaf != NULL) { + J3DAnmTransform* anmTransform = (J3DAnmTransform*)dComIfG_getObjectRes("E_yd", param_1); + leaf->mpMorf->setAnm(anmTransform, param_3, param_2, param_4, 0.0f, -1.0f, NULL); + return true; + } + + return false; } -/* ############################################################################################## */ -/* 807F7A38-807F7A3C 000038 0004+00 0/6 0/0 0/0 .rodata @3949 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3949 = 50.0f; -COMPILER_STRIP_GATE(0x807F7A38, &lit_3949); -#pragma pop - -/* 807F7A3C-807F7A40 00003C 0004+00 0/1 0/0 0/0 .rodata @3950 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3950 = 600.0f; -COMPILER_STRIP_GATE(0x807F7A3C, &lit_3950); -#pragma pop - /* 807F2FA4-807F3168 000464 01C4+00 1/0 0/0 0/0 .text daE_YD_Draw__FP10e_yd_class */ -static void daE_YD_Draw(e_yd_class* param_0) { - // NONMATCHING +static s32 daE_YD_Draw(e_yd_class* i_this) { + static GXColor l_color = { 0x14, 0x0F, 0x00, 0xFF }; + + fopAc_ac_c* actor = (fopAc_ac_c*)i_this; + + g_env_light.settingTevStruct(2, &i_this->actor.current.pos, &i_this->actor.tevStr); + dComIfGd_setListDark(); + J3DModel* model = i_this->mpMorf->getModel(); + g_env_light.setLightTevColorType_MAJI(model, &i_this->actor.tevStr); + i_this->mBrkAnm->entry(model->getModelData()); + i_this->mpMorf->entryDL(); + i_this->mLineMat.update(12, l_color, &i_this->actor.tevStr); + dComIfGd_set3DlineMat(&i_this->mLineMat); + for (s32 i = 1; i < 11; i++) { + if (i_this->field_0x77c[i] != 0) { + g_env_light.setLightTevColorType_MAJI(i_this->field_0x77c[i], &i_this->actor.tevStr); + mDoExt_modelUpdateDL(i_this->field_0x77c[i]); + } + } + + dComIfGd_setList(); + + cXyz unkXyz1(actor->current.pos.x, actor->current.pos.y + 50.0f + BREG_F(18), + actor->current.pos.z); + i_this->mShadowKey = dComIfGd_setShadow(i_this->mShadowKey, 1, model, &unkXyz1, + 600.0f + MREG_F(19), 0.0f, i_this->actor.current.pos.y, fopAcM_gc_c::getGroundY(), + *fopAcM_gc_c::getGroundCheck(), &i_this->actor.tevStr, 0, 1.0f, + dDlst_shadowControl_c::getSimpleTex()); + + return 1; } /* 807F3168-807F31C0 000628 0058+00 2/2 0/0 0/0 .text pl_check__FP10e_yd_classf */ -static void pl_check(e_yd_class* param_0, f32 param_1) { - // NONMATCHING +static s32 pl_check(e_yd_class* i_this, f32 param_2) { + daPy_py_c* player = daPy_getPlayerActorClass(); + if (i_this->mHomeDistFromPlayer < param_2 && + (i_this->mLeafRoomNo != 0 || + fopAcM_otherBgCheck(&i_this->actor, player) == 0)) { + return true; + } + return false; } /* 807F31C0-807F342C 000680 026C+00 1/1 0/0 0/0 .text damage_check__FP10e_yd_class */ -static void damage_check(e_yd_class* param_0) { - // NONMATCHING +static void damage_check(e_yd_class* i_this) { + fopAc_ac_c* pfVar1 = dComIfGp_getPlayer(0); + if (i_this->field_0x69c[3] == 0) { + i_this->mStts.Move(); + if (i_this->field_0x9d8.ChkAtShieldHit()) { + i_this->field_0x69c[3] = 6; + i_this->field_0x66e = 7; + i_this->field_0x670 = 0; + i_this->field_0x69c[0] = 10; + i_this->field_0x69c[1] = 100; + i_this->field_0x684 = pfVar1->shape_angle.y; + i_this->field_0x1234 = 10; + dComIfGp_getVibration().StartShock(4, 0x1f, cXyz(0.0f, 1.0f, 0.0f)); + } else { + cCcD_Obj* uVar4; + s8 cVar6 = 0; + for (s32 i = 0; i < 4; i++) { + if (i_this->field_0xb14[i].ChkTgHit() != 0) { + i_this->field_0x69c[3] = 10; + uVar4 = i_this->field_0xb14[i].GetTgHitObj(); + i_this->field_0xff4.mpCollider = uVar4; + s32 j = i_this->field_0xff4.mpCollider->ChkAtType(AT_TYPE_BOOMERANG); + if (j != 0) { + cVar6 = 1; + } else { + j = i_this->field_0xff4.mpCollider->ChkAtType(AT_TYPE_BOMB | AT_TYPE_40); + if (j != 0 || i_this->field_0x66e == 6) { + at_power_check(&i_this->field_0xff4); + if (daPy_getPlayerActorClass()->getCutType() != 0) { + cVar6 = 1; + } else { + cVar6 = 2; + } + } else { + i_this->field_0x66e = 7; + i_this->field_0x670 = 0; + i_this->field_0x69c[0] = 10; + i_this->field_0x69c[1] = 100; + i_this->field_0x684 = pfVar1->shape_angle.y; + def_se_set(&i_this->mCreatureSound, i_this->field_0xff4.mpCollider, 0x2d, 0); + i_this->field_0x1234 = 10; + } + } + break; + } + } + if (cVar6 == 0 && i_this->field_0x8a0.ChkTgHit() != 0) { + uVar4 = i_this->field_0x8a0.GetTgHitObj(); + i_this->field_0xff4.mpCollider = uVar4; + dCc_GetAc(i_this->field_0xff4.mpCollider->GetAc()); + if (i_this->field_0xff4.mpCollider->ChkAtType( + AT_TYPE_BOMB | AT_TYPE_40 | AT_TYPE_BOOMERANG | AT_TYPE_MIDNA_LOCK) != 0) { + cVar6 = 2; + } else { + i_this->field_0x69c[3] = 6; + i_this->field_0x66e = 7; + i_this->field_0x670 = 0; + i_this->field_0x69c[0] = 10; + i_this->field_0x69c[1] = 100; + i_this->field_0x684 = pfVar1->shape_angle.y; + i_this->field_0x1234 = 10; + def_se_set(&i_this->mCreatureSound, i_this->field_0xff4.mpCollider, 0x2d, 0); + } + } + if (cVar6 != 0) { + yd_disappear(i_this); + if (cVar6 == 1) { + dScnPly_c::setPauseTimer(4); + } + } + } + } } -/* ############################################################################################## */ -/* 807F7A40-807F7A44 000040 0004+00 0/4 0/0 0/0 .rodata @4075 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4075 = 10.0f; -COMPILER_STRIP_GATE(0x807F7A40, &lit_4075); -#pragma pop - -/* 807F7A44-807F7A48 000044 0004+00 0/2 0/0 0/0 .rodata @4076 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4076 = -170.0f; -COMPILER_STRIP_GATE(0x807F7A44, &lit_4076); -#pragma pop - -/* 807F7A48-807F7A4C 000048 0004+00 0/4 0/0 0/0 .rodata @4077 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4077 = 170.0f; -COMPILER_STRIP_GATE(0x807F7A48, &lit_4077); -#pragma pop - -/* 807F7A4C-807F7A50 00004C 0004+00 0/4 0/0 0/0 .rodata @4078 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4078 = 1.0f / 5.0f; -COMPILER_STRIP_GATE(0x807F7A4C, &lit_4078); -#pragma pop - -/* 807F7A50-807F7A54 000050 0004+00 0/6 0/0 0/0 .rodata @4079 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4079 = 1.0f / 10.0f; -COMPILER_STRIP_GATE(0x807F7A50, &lit_4079); -#pragma pop - -/* 807F7A54-807F7A58 000054 0004+00 0/5 0/0 0/0 .rodata @4080 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4080 = 20.0f; -COMPILER_STRIP_GATE(0x807F7A54, &lit_4080); -#pragma pop - -/* 807F7A58-807F7A5C 000058 0004+00 0/1 0/0 0/0 .rodata @4081 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4081 = 4.0f; -COMPILER_STRIP_GATE(0x807F7A58, &lit_4081); -#pragma pop - -/* 807F7A5C-807F7A60 00005C 0004+00 0/1 0/0 0/0 .rodata @4082 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4082 = 2.0f / 5.0f; -COMPILER_STRIP_GATE(0x807F7A5C, &lit_4082); -#pragma pop - -/* 807F7A60-807F7A64 000060 0004+00 0/1 0/0 0/0 .rodata @4083 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4083 = 1.0f / 50.0f; -COMPILER_STRIP_GATE(0x807F7A60, &lit_4083); -#pragma pop - -/* 807F7A64-807F7A68 000064 0004+00 0/7 0/0 0/0 .rodata @4084 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4084 = 1.0f / 20.0f; -COMPILER_STRIP_GATE(0x807F7A64, &lit_4084); -#pragma pop - /* 807F7D68-807F7D6C 000008 0004+00 2/2 0/0 0/0 .bss None */ -static u8 data_807F7D68[4]; - -/* 807F7D6C-807F7D78 00000C 000C+00 1/1 0/0 0/0 .bss @3804 */ -static u8 lit_3804[12]; +static u8 data_807F7D68; /* 807F7D78-807F7D94 000018 001C+00 9/9 0/0 0/0 .bss l_HIO */ -static u8 l_HIO[28]; +static daE_YD_HIO_c l_HIO; /* 807F342C-807F3784 0008EC 0358+00 1/1 0/0 0/0 .text e_yd_stay__FP10e_yd_class */ -static void e_yd_stay(e_yd_class* param_0) { - // NONMATCHING -} +static void e_yd_stay(e_yd_class* i_this) { + i_this->field_0x69c[3] = 0xf; -/* ############################################################################################## */ -/* 807F7A68-807F7A6C 000068 0004+00 0/5 0/0 0/0 .rodata @4118 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4118 = 30.0f; -COMPILER_STRIP_GATE(0x807F7A68, &lit_4118); -#pragma pop + switch (i_this->field_0x670) { + case 0: + i_this->field_0x678.y = 0.0f; + case 1: + anm_init(i_this, 14, 10.0f, 0, 1.0f); + if (leaf_anm_init(i_this, 21, 10.0f, 2, 0.0f) != 0) { + i_this->field_0x670 = 5; + i_this->field_0x694 = 0; + i_this->field_0x69c[0] = 0x32; + } + break; + case 2: + if (i_this->mLeafRoomNo != 0) { + i_this->field_0x678.y = -170.0f; + } else { + i_this->field_0x678.y = 170.0f; + } + i_this->field_0x670 = 1; + break; + case 5: + cLib_addCalc2(&i_this->actor.current.pos.x, i_this->actor.home.pos.x, 0.2f, + i_this->field_0x694 * 10.0f); + cLib_addCalc2(&i_this->actor.current.pos.y, + i_this->actor.home.pos.y + i_this->field_0x678.y, 0.2f, + i_this->field_0x694 * 10.0f); + cLib_addCalc2(&i_this->actor.current.pos.z, i_this->actor.home.pos.z, 0.2f, + i_this->field_0x694 * 10.0f); + cLib_addCalc2(&i_this->field_0x694, 1.0f, 1.0f, 0.1f); + cXyz cStack_28 = i_this->actor.current.pos - i_this->actor.home.pos; + cStack_28.y = 0.0f; + if (cStack_28.abs() < 20.0f) { + cLib_addCalc0(&i_this->field_0x678.y, 1.0f, 4.0f); + if (i_this->mLeafRoomNo != 0) { + cLib_addCalcAngleS2(&i_this->actor.shape_angle.x, 0x4000, 4, 0x200); + } else { + cLib_addCalcAngleS2(&i_this->actor.shape_angle.x, -0x4000, 4, 0x200); + } + cLib_addCalc2(&i_this->field_0x84c, 0.4f, 1.0f, 0.02f); + cLib_addCalc2(&i_this->field_0x698, l_HIO.field_0xc, 1.0f, 0.05f); + } + if (i_this->field_0x69c[0] == 0 && + (i_this->field_0x5b7 == 1 || + pl_check(i_this, i_this->field_0x674) != 0)) { + if (i_this->mLeafRoomNo != 0) { + i_this->field_0x66e = 2; + } else { + i_this->field_0x66e = 1; + } + i_this->field_0x670 = 0; + } + break; + } +} /* 807F3784-807F3A44 000C44 02C0+00 1/1 0/0 0/0 .text e_yd_appear__FP10e_yd_class */ -static void e_yd_appear(e_yd_class* param_0) { - // NONMATCHING +static void e_yd_appear(e_yd_class* i_this) { + s32 frame = i_this->mpMorf->getFrame(); + switch (i_this->field_0x670) { + case 0: + anm_init(i_this, 6, 10.0f, 0, 1.0f); + leaf_anm_init(i_this, 20, 10.0f, 2, 1.0f); + i_this->field_0x670 = 1; + i_this->field_0x678.x = i_this->actor.home.pos.x + cM_rndFX(100.0f); + i_this->field_0x678.z = i_this->actor.home.pos.z + cM_rndFX(100.0f); + if (i_this->mLeafRoomNo != 0) { + i_this->field_0x678.y = i_this->actor.home.pos.y - (170.0f + cM_rndFX(50.0f)); + } else { + i_this->field_0x678.y = i_this->actor.home.pos.y + 170.0f + cM_rndFX(50.0f); + } + i_this->field_0x694 = 0.2f; + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_DB_GRASS, 0, -1); + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_DB_APPEAR, 0, -1); + break; + case 1: + if (frame >= 15 && frame <= 35) { + i_this->field_0x1235 = 2; + } + i_this->field_0xb10 = 1; + cLib_addCalc2(&i_this->actor.current.pos.x, i_this->field_0x678.x, 0.1f, i_this->field_0x694 * 30.0f); + cLib_addCalc2(&i_this->actor.current.pos.z, i_this->field_0x678.z, 0.1f, i_this->field_0x694 * 30.0f); + cLib_addCalc2(&i_this->actor.current.pos.y, i_this->field_0x678.y, 0.1f, i_this->field_0x694 * 30.0f); + cLib_addCalc2(&i_this->field_0x694, 1.0f, 1.0f, 0.05f); + if (i_this->mpMorf->isStop()) { + i_this->field_0x66e = 3; + i_this->field_0x670 = 0; + } + break; + } + + if (i_this->mLeafRoomNo != 0) { + cLib_addCalcAngleS2(&i_this->actor.shape_angle.y, i_this->mAngleToPlayer + 0x8000, 8, 0x800); + cLib_addCalcAngleS2(&i_this->actor.shape_angle.x, 0x8000, 8, 0x400); + } else { + cLib_addCalcAngleS2(&i_this->actor.shape_angle.y, i_this->mAngleToPlayer, 8, 0x800); + cLib_addCalcAngleS2(&i_this->actor.shape_angle.x, 0, 8, 0x400); + } + cLib_addCalc2(&i_this->field_0x698, l_HIO.field_0x10, 1.0f, 0.1f); } -/* ############################################################################################## */ -/* 807F7A6C-807F7A70 00006C 0004+00 1/5 0/0 0/0 .rodata @4148 */ -SECTION_RODATA static f32 const lit_4148 = 5.0f; -COMPILER_STRIP_GATE(0x807F7A6C, &lit_4148); - -/* 807F7A70-807F7A74 000070 0004+00 0/3 0/0 0/0 .rodata @4149 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4149 = 15.0f; -COMPILER_STRIP_GATE(0x807F7A70, &lit_4149); -#pragma pop - -/* 807F7A74-807F7A78 000074 0004+00 0/3 0/0 0/0 .rodata @4150 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4150 = 60.0f; -COMPILER_STRIP_GATE(0x807F7A74, &lit_4150); -#pragma pop - -/* 807F7A78-807F7A7C 000078 0004+00 0/3 0/0 0/0 .rodata @4151 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4151 = 40.0f; -COMPILER_STRIP_GATE(0x807F7A78, &lit_4151); -#pragma pop - -/* 807F7A7C-807F7A80 00007C 0004+00 0/2 0/0 0/0 .rodata @4152 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4152 = 400.0f; -COMPILER_STRIP_GATE(0x807F7A7C, &lit_4152); -#pragma pop - -/* 807F7A80-807F7A84 000080 0004+00 0/1 0/0 0/0 .rodata @4153 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4153 = 3.0f / 20.0f; -COMPILER_STRIP_GATE(0x807F7A80, &lit_4153); -#pragma pop - /* 807F3A44-807F3C10 000F04 01CC+00 1/1 0/0 0/0 .text e_yd_appear_v__FP10e_yd_class */ -static void e_yd_appear_v(e_yd_class* param_0) { - // NONMATCHING +static void e_yd_appear_v(e_yd_class* i_this) { + cXyz local_34; + + dComIfGp_getPlayer(0); + f32 fVar2 = TREG_F(17) + 60.0f; + s16 sVar1 = i_this->field_0x670; + switch (sVar1) { + case 0: + anm_init(i_this, 6, 5.0f, 0, 1.0f); + leaf_anm_init(i_this, 20, 5.0f, 2, 1.0f); + i_this->field_0x670 = 1; + i_this->field_0x69c[0] = JREG_S(6) + 30; + i_this->field_0x694 = 0; + i_this->mpMorf->setFrame(15.0f); + case 1: + local_34.x = fVar2 * cM_ssin(i_this->field_0x66c * (TREG_S(0) + 1200)); + local_34.z = fVar2 * cM_scos(i_this->field_0x66c * (TREG_S(2) + 1500)); + cLib_addCalc2(&i_this->actor.current.pos.x, i_this->actor.home.pos.x + local_34.x, + 0.1f, i_this->field_0x694 * 40.0f); + cLib_addCalc2(&i_this->actor.current.pos.z, i_this->actor.home.pos.z + local_34.z, + 0.1f, i_this->field_0x694 * 40.0f); + cLib_addCalc2(&i_this->actor.current.pos.y, i_this->actor.home.pos.y - (JREG_F(18) + 400.0f), + 0.5f, i_this->field_0x694 * 40.0f); + cLib_addCalc2(&i_this->field_0x694, 1.0f, 1.0f, JREG_F(5) + 0.2f); + if (i_this->field_0x69c[0] == 0) { + i_this->field_0x66e = 3; + i_this->field_0x670 = 0; + i_this->field_0x850 = 0.0f; + } + default: + cLib_addCalcAngleS2(&i_this->actor.shape_angle.x, 0x4000, 4, 0x400); + cLib_addCalc2(&i_this->field_0x84c, + JREG_F(4) + 0.5f, 1.0f, 0.05f); + cLib_addCalc2(&i_this->field_0x698, l_HIO.field_0x10, 1.0f, 0.15f); + i_this->field_0xb10 = 1; + break; + } } -/* ############################################################################################## */ -/* 807F7A84-807F7A88 000084 0004+00 0/1 0/0 0/0 .rodata @4246 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4246 = 0.75f; -COMPILER_STRIP_GATE(0x807F7A84, &lit_4246); -#pragma pop - -/* 807F7A88-807F7A8C 000088 0004+00 0/1 0/0 0/0 .rodata @4247 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4247 = 90.0f; -COMPILER_STRIP_GATE(0x807F7A88, &lit_4247); -#pragma pop - -/* 807F7A8C-807F7A90 00008C 0004+00 0/2 0/0 0/0 .rodata @4248 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4248 = -100.0f; -COMPILER_STRIP_GATE(0x807F7A8C, &lit_4248); -#pragma pop - -/* 807F7A90-807F7A94 000090 0004+00 0/1 0/0 0/0 .rodata @4249 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4249 = 3.0f / 10.0f; -COMPILER_STRIP_GATE(0x807F7A90, &lit_4249); -#pragma pop - -/* 807F7A94-807F7A98 000094 0004+00 0/1 0/0 0/0 .rodata @4250 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4250 = 700.0f; -COMPILER_STRIP_GATE(0x807F7A94, &lit_4250); -#pragma pop - -/* 807F7A98-807F7AA0 000098 0008+00 1/3 0/0 0/0 .rodata @4252 */ -SECTION_RODATA static u8 const lit_4252[8] = { - 0x43, 0x30, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x807F7A98, &lit_4252); - /* 807F3C10-807F4158 0010D0 0548+00 1/1 0/0 0/0 .text e_yd_wait__FP10e_yd_class */ -static void e_yd_wait(e_yd_class* param_0) { - // NONMATCHING +static void e_yd_wait(e_yd_class* i_this) { + f32 fVar6 = TREG_F(12) + 30.0f; + if ((i_this->field_0x66c & 0xf) == 0 && cM_rndF(1.0f) < 0.75f) { + i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_DB_V_WAIT, -1); + } + cXyz commonXyz; + switch (i_this->field_0x670) { + case -1: + if (i_this->mpMorf->isStop() != 0) { + i_this->field_0x670 = 0; + } else { + cXyz cStack_54(0.0f, 90.0f, -100.0f); + cMtx_YrotS(*calc_mtx, i_this->actor.shape_angle.y); + cXyz homeOffset; + MtxPosition(&cStack_54, &homeOffset); + i_this->field_0x678 = i_this->actor.home.pos + homeOffset; + cLib_addCalc2(&i_this->actor.current.pos.x, i_this->field_0x678.x, 0.3f, 30.0f); + cLib_addCalc2(&i_this->actor.current.pos.y, i_this->field_0x678.y, 0.3f, 30.0f); + cLib_addCalc2(&i_this->actor.current.pos.z, i_this->field_0x678.z, 0.3f, 30.0f); + break; + } + case 0: + anm_init(i_this, 19, 10.0f, 2, 1.0f); + leaf_anm_init(i_this, 21, 10.0f, 2, 1.0f); + i_this->field_0x670 = 1; + if (i_this->field_0x5b6 == 1) { + i_this->field_0x69c[1] = cM_rndF(20.0f) + 30.0f; + } else { + i_this->field_0x69c[1] = cM_rndF(l_HIO.field_0x16) + l_HIO.field_0x16; + } + i_this->field_0x69c[0] = 0; + break; + case 1: + if (i_this->field_0x69c[0] == 0) { + i_this->field_0x69c[0] = cM_rndF(30.0f) + 10.0f; + i_this->field_0x678.x = i_this->actor.home.pos.x + cM_rndFX(100.0f); + i_this->field_0x678.z = i_this->actor.home.pos.z + cM_rndFX(100.0f); + if (i_this->mLeafRoomNo != 0) { + i_this->field_0x678.y = i_this->actor.home.pos.y - (cM_rndFX(50.0f) + 170.0f); + } else { + i_this->field_0x678.y = i_this->actor.home.pos.y + 170.0f + cM_rndFX(50.0f); + } + i_this->field_0x694 = 0; + } + commonXyz.x = cM_ssin(i_this->field_0x66c * (TREG_S(0) + 1900)) * fVar6; + commonXyz.y = cM_ssin(i_this->field_0x66c * (TREG_S(1) + 2200)) * fVar6; + commonXyz.z = cM_scos(i_this->field_0x66c * (TREG_S(2) + 2000)) * fVar6; + cLib_addCalc2(&i_this->actor.current.pos.x, i_this->field_0x678.x + commonXyz.x, + 0.1f, i_this->field_0x694 * 20.0f); + cLib_addCalc2(&i_this->actor.current.pos.z, i_this->field_0x678.z + commonXyz.z, + 0.1f, i_this->field_0x694 * 20.0f); + cLib_addCalc2(&i_this->actor.current.pos.y, i_this->field_0x678.y + commonXyz.y, + 0.1f, i_this->field_0x694 * 20.0f); + cLib_addCalc2(&i_this->field_0x694, 1.0f, 1.0f, 0.05f); + if (i_this->field_0x69c[2] == 0) { + if (i_this->field_0x5b7 != 1 && pl_check(i_this, i_this->field_0x674 + 100.0f) == 0) + { + i_this->field_0x66e = 0; + i_this->field_0x670 = 2; + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_DB_HIKKOMU, 0, -1); + } else { + if (i_this->field_0x69c[1] == 0 && pl_check(i_this, 700.0f) != 0) + { + i_this->field_0x66e = 4; + i_this->field_0x670 = 0; + } + } + } + default: + break; + } + + if (i_this->mLeafRoomNo != 0) { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + cLib_addCalcAngleS2(&i_this->actor.shape_angle.y, i_this->mAngleToPlayer + 0x8000, 8, 0x800); + cXyz playerOffset = player->eyePos - i_this->actor.current.pos; + fVar6 = JMAFastSqrt(playerOffset.x * playerOffset.x + playerOffset.z * playerOffset.z); + s32 sVar4 = cM_atan2s(playerOffset.y, fVar6); + cLib_addCalcAngleS2(&i_this->actor.shape_angle.x, sVar4 + 0x8000, 8, 0x400); + i_this->field_0xb10 = 1; + } else { + cLib_addCalcAngleS2(&i_this->actor.shape_angle.y, i_this->mAngleToPlayer, 8, 0x800); + cLib_addCalcAngleS2(&i_this->actor.shape_angle.x, 0, 8, 0x400); + } } -/* ############################################################################################## */ -/* 807F7AA0-807F7AA4 0000A0 0004+00 0/1 0/0 0/0 .rodata @4445 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4445 = 350.0f; -COMPILER_STRIP_GATE(0x807F7AA0, &lit_4445); -#pragma pop - -/* 807F7AA4-807F7AA8 0000A4 0004+00 0/1 0/0 0/0 .rodata @4446 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4446 = 4.0f / 5.0f; -COMPILER_STRIP_GATE(0x807F7AA4, &lit_4446); -#pragma pop - -/* 807F7AA8-807F7AAC 0000A8 0004+00 0/1 0/0 0/0 .rodata @4447 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4447 = 2.0f; -COMPILER_STRIP_GATE(0x807F7AA8, &lit_4447); -#pragma pop - -/* 807F7AAC-807F7AB0 0000AC 0004+00 0/1 0/0 0/0 .rodata @4448 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4448 = 2000.0f; -COMPILER_STRIP_GATE(0x807F7AAC, &lit_4448); -#pragma pop - -/* 807F7AB0-807F7AB4 0000B0 0004+00 0/2 0/0 0/0 .rodata @4449 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4449 = 70.0f; -COMPILER_STRIP_GATE(0x807F7AB0, &lit_4449); -#pragma pop - -/* 807F7AB4-807F7AB8 0000B4 0004+00 0/3 0/0 0/0 .rodata @4450 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4450 = -50.0f; -COMPILER_STRIP_GATE(0x807F7AB4, &lit_4450); -#pragma pop - -/* 807F7AB8-807F7ABC 0000B8 0004+00 0/1 0/0 0/0 .rodata @4451 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4451 = 200.0f; -COMPILER_STRIP_GATE(0x807F7AB8, &lit_4451); -#pragma pop - /* 807F4158-807F4BB8 001618 0A60+00 1/1 0/0 0/0 .text e_yd_attack__FP10e_yd_class */ -static void e_yd_attack(e_yd_class* param_0) { - // NONMATCHING +static void e_yd_attack(e_yd_class* i_this) { + fopEn_enemy_c* enemy = (fopEn_enemy_c*)&i_this->actor; + + fopAc_ac_c* player = (fopAc_ac_c*)dComIfGp_getPlayer(0); + + cXyz commonXyz1; + cXyz commonXyz2; + + s16 pitch = 0; + + commonXyz1 = player->eyePos - enemy->current.pos; + + pitch = (s16)cM_atan2s(commonXyz1.y, + JMAFastSqrt(commonXyz1.x * commonXyz1.x + commonXyz1.z * commonXyz1.z)); + + switch (i_this->field_0x670) { + case 0: { + i_this->field_0x670 = 1; + i_this->field_0x69c[0] = 17; + i_this->field_0x694 = 0; + i_this->field_0xb11 = 0; + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_DB_GRASS, 0, -1); + i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_DB_V_ATTACK, -1); + leaf_anm_init(i_this, 20, 5.0f, 2, 1.0f); + anm_init(i_this, 7, 5.0f, 0, 1.0f); + } + case 1: { + if (i_this->mLeafRoomNo != 0) { + cLib_addCalcAngleS2(&enemy->shape_angle.y, i_this->mAngleToPlayer + 0x8000, 8, 0x800); + commonXyz1.x = 0.0f; + commonXyz1.y = TREG_F(3) + -170.0f; + commonXyz1.z = TREG_F(4) + 100.0f; + } else { + cLib_addCalcAngleS2(&enemy->shape_angle.y, i_this->mAngleToPlayer, 8, 0x800); + commonXyz1.x = 0.0f; + commonXyz1.y = TREG_F(3) + 170.0f; + commonXyz1.z = TREG_F(4) + -100.0f; + } + cMtx_YrotS(*calc_mtx, enemy->shape_angle.y); + MtxPosition(&commonXyz1, &commonXyz2); + i_this->field_0x678 = enemy->home.pos + commonXyz2; + cLib_addCalc2(&enemy->current.pos.x, i_this->field_0x678.x, 0.1f, + i_this->field_0x694 * 20.0f); + cLib_addCalc2(&enemy->current.pos.z, i_this->field_0x678.z, 0.1f, + i_this->field_0x694 * 20.0f); + cLib_addCalc2(&enemy->current.pos.y, i_this->field_0x678.y, 0.1f, + i_this->field_0x694 * 20.0f); + cLib_addCalc2(&i_this->field_0x694, 1.0f, 1.0f, 0.1f); + if (i_this->field_0x69c[0] == 0) { + i_this->field_0x670 = 2; + i_this->field_0x69c[1] = 10; + if (i_this->mLeafRoomNo != 0) { + cMtx_YrotS(*calc_mtx, enemy->shape_angle.y + 0x8000); + cMtx_XrotM(*calc_mtx, -pitch); + commonXyz1.x = 0.0f; + commonXyz1.y = TREG_F(5); + commonXyz1.z = TREG_F(6) + 350.0f; + MtxPosition(&commonXyz1, &commonXyz2); + i_this->field_0x678 = enemy->current.pos + commonXyz2; + } else { + cMtx_YrotS(*calc_mtx, enemy->shape_angle.y); + cMtx_XrotM(*calc_mtx, (s16)(-pitch + 0x800)); + commonXyz1.x = 0.0f; + commonXyz1.y = 0.0f; + commonXyz1.z = TREG_F(6) + 350.0f; + MtxPosition(&commonXyz1, &commonXyz2); + i_this->field_0x678 = enemy->current.pos + commonXyz2; + } + enemy->speed.x = fabsf(i_this->field_0x678.x - enemy->current.pos.x); + enemy->speed.y = fabsf(i_this->field_0x678.y - enemy->current.pos.y); + enemy->speed.z = fabsf(i_this->field_0x678.z - enemy->current.pos.z); + i_this->field_0x694 = 0; + i_this->field_0x9d8.StartCAt(enemy->current.pos); + if (cM_rndF(1.0f) < 0.5f) { + i_this->field_0x690 = 0x4000; + } else { + i_this->field_0x690 = -0x4000; + } + i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_DB_V_BITE, -1); + } + break; + } + case 2: { + if (i_this->field_0x69c[1] != 0) { + i_this->field_0xb10 = 1; + } + cLib_addCalc2(&enemy->current.pos.x, i_this->field_0x678.x, 0.8f, + enemy->speed.x * i_this->field_0x694); + cLib_addCalc2(&enemy->current.pos.z, i_this->field_0x678.z, 0.8f, + enemy->speed.z * i_this->field_0x694); + if (l_HIO.field_0x18 == 1) { + cLib_addCalcAngleS2(&enemy->shape_angle.z, i_this->field_0x690, 2, 0x2000); + cLib_addCalc2(&enemy->current.pos.y, i_this->field_0x678.y - 30.0f, 0.8f, + enemy->speed.y * i_this->field_0x694); + } else { + cLib_addCalc2(&enemy->current.pos.y, i_this->field_0x678.y, 0.8f, + enemy->speed.y * i_this->field_0x694); + } + cLib_addCalc2(&i_this->field_0x694, 0.2f, 1.0f, 0.05f); + if (!daPy_getPlayerActorClass()->getDkCaught()) { + if (!daPy_getPlayerActorClass()->getStCaught() && i_this->field_0x9d8.ChkAtHit()) { + OS_REPORT("E_YD//////////////AT SET 1 !!\n"); + + i_this->field_0x670 = 5; + i_this->field_0x694 = 20.0f; + anm_init(i_this, 8, 2.0f, 2, 1.0f); + i_this->field_0x69c[0] = 0x78; + daPy_getPlayerActorClass()->setDkCaught(enemy); + dComIfGp_getVibration().StartShock(6, 0x1f, cXyz(0.0f, 1.0f, 0.0f)); + break; + } + } + if (i_this->mpMorf->isStop()) { + i_this->field_0x670 = 3; + i_this->field_0x69c[0] = 0; + } + break; + } + case 3: { + if (i_this->field_0x69c[0] == 0) { + i_this->field_0x66e = 3; + i_this->field_0x670 = 0; + } + break; + } + case 5: { + i_this->field_0x856 = 1; + i_this->mCreatureSound.startCreatureVoiceLevel(Z2SE_EN_DB_V_BITING, -1); + i_this->field_0x8a0.OffCoSetBit(); + pitch = 0; + if (daPy_getPlayerActorClass()->getDkCaught()) { + if (i_this->field_0x69c[0] == 30) { + dComIfGp_setItemLifeCount(-1.0f, 0); + } + commonXyz1 = player->current.pos - enemy->home.pos; + s16 yaw = cM_atan2s(commonXyz1.x, commonXyz1.z); + commonXyz1.y = 0.0f; + f32 fVar8 = commonXyz1.abs(); + if (fVar8 > 100.0f + YREG_F(2)) { + f32 fVar7 = (0.1f + YREG_F(0)) * (fVar8 - (100.0f + YREG_F(2))); + if (fVar7 > 100.0f + YREG_F(1)) { + fVar7 = 100.0f + YREG_F(1); + } + daPy_getPlayerActorClass()->setOutPower(fVar7, yaw + 0x8000, 0); + } + if (i_this->mLeafRoomNo == 0) { + cMtx_YrotS(*calc_mtx, yaw); + cLib_addCalcAngleS2(&enemy->shape_angle.z, + (i_this->field_0x690 + (2000.0f + KREG_F(17)) * + cM_ssin(i_this->field_0x66c * (12000 + KREG_S(0)))), + 2, 0x2000); + commonXyz1.x = 0.0f; + commonXyz1.y = (100.0f + XREG_F(2)) - 30.0f; + commonXyz1.z = XREG_F(3) - 50.0f; + MtxPosition(&commonXyz1, &i_this->field_0x678); + i_this->field_0x678 += player->current.pos; + cLib_addCalcAngleS2(&enemy->shape_angle.y, yaw, 2, 0x1000); + } else { + pitch = -0x4000; + i_this->field_0x678 = player->eyePos; + i_this->field_0x678.y += 70.0f + JREG_F(8); + } + cLib_addCalc2(&enemy->current.pos.x, i_this->field_0x678.x, 1.0f, + i_this->field_0x694); + cLib_addCalc2(&enemy->current.pos.z, i_this->field_0x678.z, 1.0f, + i_this->field_0x694); + cLib_addCalc2(&enemy->current.pos.y, i_this->field_0x678.y, 1.0f, + i_this->field_0x694); + cLib_addCalc2(&i_this->field_0x694, 200.0f, 1.0f, 10.0f); + } else { + i_this->field_0x66e = 3; + i_this->field_0x670 = -1; + anm_init(i_this, 0x11, 2.0f, 0, 1.0f); + i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_DB_V_RELEASE, -1); + } + break; + } + } + + if (i_this->field_0xb10 != 0) { + f32 fVar8 = 50.0f + JREG_F(11); + enemy->current.pos.y -= fVar8; + enemy->old.pos.y -= fVar8; + i_this->field_0x1058.CrrPos(dComIfG_Bgsp()); + enemy->current.pos.y += fVar8; + enemy->old.pos.y += fVar8; + } + if (i_this->mLeafRoomNo != 0) { + cLib_addCalcAngleS2(&enemy->shape_angle.x, pitch + 0x8000, 8, 0x400); + i_this->field_0xb10 = 1; + } else { + cLib_addCalcAngleS2(&enemy->shape_angle.x, -pitch, 8, 0x400); + } } -/* ############################################################################################## */ -/* 807F7ABC-807F7AC0 0000BC 0004+00 0/1 0/0 0/0 .rodata @4504 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4504 = 230.0f; -COMPILER_STRIP_GATE(0x807F7ABC, &lit_4504); -#pragma pop - -/* 807F7AC0-807F7AC4 0000C0 0004+00 0/4 0/0 0/0 .rodata @4505 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4505 = 3.0f; -COMPILER_STRIP_GATE(0x807F7AC0, &lit_4505); -#pragma pop - /* 807F4BB8-807F4EB8 002078 0300+00 1/1 0/0 0/0 .text e_yd_chance__FP10e_yd_class */ -static void e_yd_chance(e_yd_class* param_0) { - // NONMATCHING +static void e_yd_chance(e_yd_class* i_this) { + switch (i_this->field_0x670) { + case 0: + if (i_this->mLeafRoomNo != 0) { + anm_init(i_this, 11, 5.0f, 2, 1.0f); + } else { + anm_init(i_this, 10, 5.0f, 2, 1.0f); + } + leaf_anm_init(i_this, 21, 5.0f, 2, 1.0f); + i_this->field_0x670 = 1; + i_this->field_0x69c[0] = 0x3c; + i_this->field_0x694 = 0; + case 1: { + cXyz unkXyz1; + unkXyz1.x = cM_ssin(i_this->field_0x66c * (900 + TREG_S(0))) * (60.0f + TREG_F(17)); + unkXyz1.z = cM_scos(i_this->field_0x66c * (1000 + TREG_S(2))) * (60.0f + TREG_F(17)); + cLib_addCalc2(&i_this->actor.current.pos.x, + i_this->actor.home.pos.x + unkXyz1.x, + 0.1f, i_this->field_0x694 * 20.0f); + cLib_addCalc2(&i_this->actor.current.pos.z, + i_this->actor.home.pos.z + unkXyz1.z, + 0.1f, i_this->field_0x694 * 20.0f); + if (i_this->mLeafRoomNo != 0) { + cLib_addCalc2(&i_this->actor.current.pos.y, + i_this->actor.home.pos.y - (230.0f + TREG_F(18)), + 0.1f, i_this->field_0x694 * 20.0f); + } else { + cLib_addCalc2(&i_this->actor.current.pos.y, + i_this->actor.home.pos.y + 230.0f + TREG_F(18), + 0.1f, i_this->field_0x694 * 20.0f); + } + cLib_addCalc2(&i_this->field_0x694, 1.0f, 1.0f, 0.1f); + if (i_this->field_0x69c[0] <= 50 && i_this->field_0x69c[0] >= 10) { + i_this->mCreatureSound.startCreatureSoundLevel(Z2SE_EN_DB_V_FAINT, 0, -1); + } + if (i_this->field_0x69c[0] == 0) { + i_this->field_0x670++; + anm_init(i_this, 18, 3.0f, 0, 1.0f); + leaf_anm_init(i_this, 20, 3.0f, 2, 1.0f); + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_DB_GRASS, 0, -1); + } + break; + } + case 2: + if (i_this->mpMorf->isStop()) { + i_this->field_0x66e = 3; + i_this->field_0x670 = 0; + i_this->field_0x850 = 0; + } + } + + if (i_this->mLeafRoomNo != 0) { + cLib_addCalcAngleS2(&i_this->actor.shape_angle.x, 0x4000, 4, 0x400); + } else { + cLib_addCalcAngleS2(&i_this->actor.shape_angle.x, -0x4000, 4, 0x400); + } + cLib_addCalc2(&i_this->field_0x84c, 0.5f + JREG_F(4), 1.0f, 0.05f); } -/* ############################################################################################## */ -/* 807F7AC4-807F7AC8 0000C4 0004+00 0/1 0/0 0/0 .rodata @4550 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4550 = 250.0f; -COMPILER_STRIP_GATE(0x807F7AC4, &lit_4550); -#pragma pop - -/* 807F7AC8-807F7ACC 0000C8 0004+00 0/1 0/0 0/0 .rodata @4551 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4551 = 23.0f / 25.0f; -COMPILER_STRIP_GATE(0x807F7AC8, &lit_4551); -#pragma pop - /* 807F4EB8-807F5110 002378 0258+00 1/1 0/0 0/0 .text e_yd_s_damage__FP10e_yd_class */ -static void e_yd_s_damage(e_yd_class* param_0) { - // NONMATCHING +static void e_yd_s_damage(e_yd_class* i_this) { + cXyz unkXyz1; + switch (i_this->field_0x670) { + case 0: + anm_init(i_this, 12, 3.0f, 0, 1.0f); + leaf_anm_init(i_this, 20, 3.0f, 2, 0.0f); + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_DB_GRASS, 0, -1); + if (i_this->mLeafRoomNo != 0) { + cMtx_YrotS(*calc_mtx, i_this->actor.shape_angle.y + 0x8000); + } else { + cMtx_YrotS(*calc_mtx, i_this->actor.shape_angle.y); + } + unkXyz1.x = 0.0f; + unkXyz1.y = 15.0f; + unkXyz1.z = -50.0f + TREG_F(16); + MtxPosition(&unkXyz1, &i_this->actor.speed); + i_this->field_0x670 = 1; + i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_DB_V_DAMAGE_S, -1); + break; + case 1: + i_this->actor.current.pos += i_this->actor.speed; + unkXyz1.x = i_this->actor.current.pos.x - i_this->actor.home.pos.x; + unkXyz1.z = i_this->actor.current.pos.z - i_this->actor.home.pos.z; + if (JMAFastSqrt(unkXyz1.x * unkXyz1.x + unkXyz1.z * unkXyz1.z) > 250.0f + nREG_F(8)) { + i_this->actor.speed.zero(); + } else { + f32 mult = 0.92f; + i_this->actor.speed.x = i_this->actor.speed.x * mult; + i_this->actor.speed.y = i_this->actor.speed.y * mult; + i_this->actor.speed.z = i_this->actor.speed.z * mult; + } + if (i_this->field_0x69c[0] == 0) { + i_this->field_0x66e = 6; + i_this->field_0x670 = 0; + } + if (i_this->field_0x69c[1] == 0) { + i_this->field_0x66e = 3; + i_this->field_0x670 = 0; + i_this->field_0x850 = 0; + } + break; + } + if (i_this->mLeafRoomNo != 0) { + cLib_addCalcAngleS2(&i_this->actor.shape_angle.x, 0x4000, 4, 0x400); + } else { + cLib_addCalcAngleS2(&i_this->actor.shape_angle.x, -0x4000, 4, 0x400); + } } -/* ############################################################################################## */ -/* 807F7ACC-807F7AD0 0000CC 0004+00 0/1 0/0 0/0 .rodata @4628 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4628 = -20.0f; -COMPILER_STRIP_GATE(0x807F7ACC, &lit_4628); -#pragma pop - -/* 807F7AD0-807F7AD4 0000D0 0004+00 0/1 0/0 0/0 .rodata @4629 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4629 = 450.0f; -COMPILER_STRIP_GATE(0x807F7AD0, &lit_4629); -#pragma pop - -/* 807F7AD4-807F7AD8 0000D4 0004+00 0/1 0/0 0/0 .rodata @4630 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4630 = -1.0f / 10.0f; -COMPILER_STRIP_GATE(0x807F7AD4, &lit_4630); -#pragma pop - /* 807F5110-807F54F0 0025D0 03E0+00 1/1 0/0 0/0 .text e_yd_damage__FP10e_yd_class */ -static void e_yd_damage(e_yd_class* param_0) { - // NONMATCHING +static void e_yd_damage(e_yd_class* i_this) { + cXyz unkXyz1; + switch (i_this->field_0x670) { + case 0: + anm_init(i_this, 12, 3.0f, 0, 1.0f); + leaf_anm_init(i_this, 20, 3.0f, 2, 0.0f); + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_DB_GRASS, 0, -1); + cMtx_YrotS(*calc_mtx, i_this->field_0x684); + unkXyz1.x = 0.0f; + if (i_this->field_0x5b4 != 1) { + if (i_this->field_0x5b4 == 2) { + unkXyz1.y = 20.0f + AREG_F(1); + } else { + unkXyz1.y = 30.0f; + } + unkXyz1.z = -50.0f; + } else { + unkXyz1.y = 0.0f; + unkXyz1.z = -20.0f; + } + MtxPosition(&unkXyz1, &i_this->actor.speed); + i_this->field_0x670 = 1; + i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_DB_V_DAMAGE, -1); + break; + case 1: + unkXyz1 = i_this->actor.current.pos - i_this->actor.home.pos; + if (unkXyz1.abs() > 450.0f + TREG_F(15)) { + i_this->actor.current.pos = i_this->actor.old.pos; + i_this->actor.speed.x *= -0.1f; + i_this->actor.speed.z *= -0.1f; + i_this->field_0x670++; + } + case 2: + s16 sVar4; + if (i_this->field_0x5b4 == 2) { + sVar4 = 0; + } else { + sVar4 = -0x8000; + } + cLib_addCalcAngleS2(&i_this->actor.shape_angle.y, (i_this->field_0x684 + sVar4), 2, 0x2000); + i_this->actor.current.pos += i_this->actor.speed; + if (i_this->field_0x5b4 != 1) { + if (i_this->field_0x5b4 == 2) { + i_this->actor.speed.y -= (1.0f + AREG_F(0)); + } else { + i_this->actor.speed.y -= 5.0f; + } + } + f32 fVar6 = i_this->field_0x698 * (40.0f + TREG_F(15)) * l_HIO.field_0x8; + i_this->actor.current.pos.y -= fVar6; + i_this->actor.old.pos.y -= fVar6; + i_this->field_0x1058.CrrPos(dComIfG_Bgsp()); + i_this->actor.current.pos.y += fVar6; + i_this->actor.old.pos.y += fVar6; + if (i_this->mpMorf->isStop()) { + i_this->field_0x66e = 3; + i_this->field_0x670 = 0; + } + break; + } } -/* ############################################################################################## */ -/* 807F7AD8-807F7ADC 0000D8 0004+00 0/1 0/0 0/0 .rodata @4709 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4709 = -30.0f; -COMPILER_STRIP_GATE(0x807F7AD8, &lit_4709); -#pragma pop - -/* 807F7ADC-807F7AE0 0000DC 0004+00 0/1 0/0 0/0 .rodata @4710 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4710 = -200.0f; -COMPILER_STRIP_GATE(0x807F7ADC, &lit_4710); -#pragma pop - /* 807F54F0-807F5820 0029B0 0330+00 1/1 0/0 0/0 .text kuki_control1__FP10e_yd_class */ -static void kuki_control1(e_yd_class* param_0) { - // NONMATCHING +static void kuki_control1(e_yd_class* i_this) { + fopEn_enemy_c* enemy = &i_this->actor; + cXyz stack_38; + cXyz stack_2c; + cXyz stack_20; + f32 x, y, z; + f32 fVar9; + f32 fVar11; + f32 fVar1; + f32 fVar2; + s32 i; + s16 yaw; + s16 pitch; + + static s16 pow_xa[11] = { + 0x0000, 0x0000, 0x1000, 0x2000, + 0x3000, 0x4000, 0x3000, 0x2000, + 0x1000, 0x0000, 0x0000 + }; + + cXyz* curXyz = &i_this->mJointPositions[0]; + curXyz[0] = enemy->home.pos; + + cXyz stack_14; + stack_38.x = 0.0f; + stack_38.y = 0.0f; + stack_38.z = i_this->field_0x848; + + curXyz++; + + fVar1 = 50.0f + TREG_F(2); + + stack_20.x = 0.0f; + stack_20.z = 0.0f; + + if (i_this->field_0x66e == 6) { + stack_20.y = 0.0f; + + fVar1 = 70.0f + JREG_F(1); + + stack_14.set(0.0f, -30.0f + JREG_F(3), 0.0f); + } else { + stack_20.y = -(200.0f + TREG_F(0)); + } + + fVar2 = i_this->field_0x850; + + for (i = 1; i < 12; i++, curXyz++) { + if (i_this->field_0x66e == 6) { + fVar9 = fVar1 * cM_ssin(i_this->field_0x66c * (1000 + TREG_S(0)) + + i * (12000 + TREG_S(1))); + fVar11 = fVar1 * cM_scos(i_this->field_0x66c * (1300 + TREG_S(2)) + + i * (10000 + TREG_S(3))); + } else { + fVar9 = fVar1 * cM_ssin(i_this->field_0x66c * (2000 + TREG_S(0)) + + i * (12000 + TREG_S(1))); + fVar11 = fVar1 * cM_scos(i_this->field_0x66c * (2300 + TREG_S(2)) + + i * (10000 + TREG_S(3))); + if (i_this->mLeafRoomNo != 0) { + cMtx_YrotS(*calc_mtx, (s16)enemy->shape_angle.y); + cMtx_XrotM(*calc_mtx, pow_xa[i - 1] + 0x8000); + } else { + cMtx_YrotS(*calc_mtx, (s16)enemy->shape_angle.y); + cMtx_XrotM(*calc_mtx, (s16)pow_xa[i - 1]); + } + MtxScale(fVar2, fVar2, fVar2, 1); + MtxPosition(&stack_20, &stack_14); + } + + x = curXyz[0].x - curXyz[-1].x + stack_14.x + fVar9; + y = curXyz[0].y - curXyz[-1].y - stack_14.y; + z = curXyz[0].z - curXyz[-1].z + stack_14.z + fVar11; + + pitch = (s16)cM_atan2s(x, z); + yaw = -cM_atan2s(y, JMAFastSqrt(x * x + z * z)); + cMtx_YrotS(*calc_mtx, pitch); + cMtx_XrotM(*calc_mtx, yaw); + + MtxPosition(&stack_38, &stack_2c); + + curXyz[0] = curXyz[-1] + stack_2c; + } } /* 807F5820-807F5994 002CE0 0174+00 1/1 0/0 0/0 .text kuki_control2__FP10e_yd_class */ -static void kuki_control2(e_yd_class* param_0) { - // NONMATCHING +static void kuki_control2(e_yd_class* i_this) { + i_this->mJointPositions[11] = i_this->actor.current.pos; + + cXyz posMult; + posMult.x = 0.0f; + posMult.y = 0.0f; + posMult.z = i_this->field_0x848; + + s32 i = 10; + s16 pitch; + s32 yaw; + cXyz* xyzArr = &i_this->mJointPositions[10]; + csXyz* sxyzArr = &i_this->mJointRotations[10]; + while (i >= 0) { + f32 xDiff = xyzArr[0].x - xyzArr[1].x; + f32 yDiff = xyzArr[0].y - xyzArr[1].y; + f32 zDiff = xyzArr[0].z - xyzArr[1].z; + yaw = cM_atan2s(xDiff, zDiff); + pitch = -cM_atan2s(yDiff, JMAFastSqrt(xDiff * xDiff + zDiff * zDiff)); + cMtx_YrotS(*calc_mtx, yaw); + cMtx_XrotM(*calc_mtx, pitch); + cXyz pos; + MtxPosition(&posMult, &pos); + xyzArr[0] = xyzArr[1] + pos; + sxyzArr->x = pitch; + sxyzArr->y = yaw; + xyzArr -= 1; + sxyzArr -= 1; + i--; + } } -/* ############################################################################################## */ -/* 807F7AE0-807F7AE4 0000E0 0004+00 1/1 0/0 0/0 .rodata @4765 */ -SECTION_RODATA static f32 const lit_4765 = 11.0f; -COMPILER_STRIP_GATE(0x807F7AE0, &lit_4765); +static f32 dummy_4709() { + return -30.0f; +} + +static f32 dummy_4710() { + return -200.0f; +} /* 807F5994-807F5A70 002E54 00DC+00 1/1 0/0 0/0 .text kuki_control3__FP10e_yd_class */ -static void kuki_control3(e_yd_class* param_0) { - // NONMATCHING +static void kuki_control3(e_yd_class* i_this) { + cXyz base = i_this->mJointPositions[0] - i_this->actor.home.pos; + cXyz* vec = &i_this->mJointPositions[0]; + for (s32 i = 0; i < 12; i++) { + *vec -= base * ((f32)(12 - i) / 11.0f); + vec++; + } +} + +static f32 dummy_4861() { + return -10.0f; +} + +static f32 dummy_4862() { + return 10000.0f; +} + +static f32 dummy_4863() { + return 65536.0f; +} + +static f32 dummy_4864() { + return -5.0f; } /* 807F5A70-807F5B5C 002F30 00EC+00 1/1 0/0 0/0 .text kuki_ha_set__FP10e_yd_class */ -static void kuki_ha_set(e_yd_class* param_0) { - // NONMATCHING +static void kuki_ha_set(e_yd_class* i_this) { + cXyz* pos = &i_this->mJointPositions[0]; + csXyz* rot = &i_this->mJointRotations[0]; + for (s32 i = 0; i < 12; i++, pos++, rot++) { + if (i > 0 && i < 11 && i_this->field_0x77c[i] != NULL) { + mDoMtx_stack_c::transS(pos->x, pos->y, pos->z); + mDoMtx_stack_c::YrotM(rot->y); + mDoMtx_stack_c::XrotM(rot->x); + mDoMtx_stack_c::ZrotM(i << 13); +#ifdef DEBUG + if (i_this->actor.current.pos.x == 1.0f && + i_this->actor.current.pos.y == 1.0f && + i_this->actor.current.pos.z == 1.0f) { + mDoMtx_stack_c::scaleM(i_this->field_0x7dc[i], i_this->field_0x7dc[i], + i_this->field_0x7dc[i]); + } else { + mDoMtx_stack_c::scaleM(i_this->actor.current.pos.x, i_this->actor.current.pos.y, + i_this->actor.current.pos.z); + } +#else + mDoMtx_stack_c::scaleM(i_this->field_0x7dc[i], i_this->field_0x7dc[i], + i_this->field_0x7dc[i]); +#endif + i_this->field_0x77c[i]->setBaseTRMtx(mDoMtx_stack_c::get()); + } + } } /* 807F5B5C-807F613C 00301C 05E0+00 2/1 0/0 0/0 .text action__FP10e_yd_class */ -static void action(e_yd_class* param_0) { - // NONMATCHING +static void action(e_yd_class* i_this) { + fopEn_enemy_c* enemy = (fopEn_enemy_c*)&i_this->actor; + + fopAc_ac_c* player = (fopAc_ac_c*)dComIfGp_getPlayer(0); + + cXyz offsetFromHome; + cXyz unkXyz1; + + i_this->mAngleToPlayer = fopAcM_searchPlayerAngleY(enemy); + + i_this->mHomeDistFromPlayer = (enemy->home.pos - player->current.pos).abs(); + + enemy->field_0x566 = 0; + + i_this->field_0x1235 = 1; + + damage_check(i_this); + + if (i_this->field_0x69c[3] != 0 && i_this->field_0x856 != 0) { + daPy_getPlayerActorClass()->offDkCaught(); + daPy_getPlayerActorClass()->offDkCaught2(); + } + + s8 unkFlag1 = false; + s8 unusedFlag = false; + s8 unkFlag2 = false; + s8 unkFlag3 = false; + + i_this->field_0x8a0.OnCoSetBit(); + + i_this->field_0x856 = 0; + + switch (i_this->field_0x66e) { + case 0: + e_yd_stay(i_this); + i_this->field_0x1235 = 0; + break; + case 1: + e_yd_appear(i_this); + unkFlag1 = true; + unkFlag2 = true; + enemy->field_0x566 = 1; + unkFlag3 = true; + break; + case 2: + e_yd_appear_v(i_this); + unkFlag1 = true; + unkFlag2 = true; + enemy->field_0x566 = 1; + unkFlag3 = true; + break; + case 3: + e_yd_wait(i_this); + unkFlag1 = true; + unkFlag2 = true; + enemy->field_0x566 = 1; + unkFlag3 = true; + break; + case 4: + e_yd_attack(i_this); + unkFlag1 = true; + unkFlag2 = true; + enemy->field_0x566 = 1; + unkFlag3 = true; + break; + case 6: + e_yd_chance(i_this); + unkFlag1 = true; + unkFlag2 = true; + enemy->field_0x566 = 1; + unkFlag3 = true; + break; + case 7: + e_yd_s_damage(i_this); + unkFlag1 = true; + unkFlag2 = true; + enemy->field_0x566 = 1; + unkFlag3 = true; + break; + case 8: + e_yd_damage(i_this); + unkFlag1 = true; + } + + if (unkFlag3) { + i_this->mCreatureSound.setLinkSearch(true); + } else { + i_this->mCreatureSound.setLinkSearch(false); + } + + if (unkFlag1) { + fopAcM_OnStatus(enemy, 0); + enemy->attention_info.flags = 0x4; + } else { + fopAcM_OffStatus(enemy, 0); + enemy->attention_info.flags = 0x0; + } + + if (!unusedFlag) { + offsetFromHome = enemy->current.pos - enemy->home.pos; + + i_this->field_0x848 = offsetFromHome.abs() * (0.2f + TREG_F(1)) * i_this->field_0x84c; + if (i_this->field_0x848 > 25.0f + TREG_F(7)) { + i_this->field_0x848 = 25.0f + TREG_F(7); + } + + cLib_addCalc2(&i_this->field_0x84c, 1.0f, 1.0f, 0.01f); + + kuki_control1(i_this); + kuki_control2(i_this); + kuki_control3(i_this); + kuki_ha_set(i_this); + + player = fopAcM_SearchByID(i_this->mLeafId); + if (player != NULL) { + ((e_yd_leaf_class*)player)->mpMorf->play(NULL, 0, 0); + } + + cLib_addCalc2(&i_this->field_0x850, 1.0f, 1.0f, 0.05f); + } else { + //kuki_control1_e(i_this); // method is stripped in release build + kuki_ha_set(i_this); + } + + cXyz* jointPos = &i_this->mJointPositions[0]; + cXyz* lineMatPos = i_this->mLineMat.getPos(0); + cXyz unkXyz2(-30000.0f, 300000.0f, 30000.0f); + s32 sphIdx = 0; + for (s32 i = 0; i < 12;) { + *lineMatPos = *jointPos; + if (i == 3 || i == 5 || i == 7 || i == 9) { + if (unkFlag2) { + i_this->field_0xb14[sphIdx].SetC(*jointPos); + i_this->field_0xb14[sphIdx].SetR(30.0f); + } else { + i_this->field_0xb14[sphIdx].SetC(*jointPos + unkXyz2); + } + dComIfG_Ccsp()->Set(&i_this->field_0xb14[sphIdx]); + sphIdx++; + } + i++; + lineMatPos++; + cXyz* _ = jointPos++; // debug match + } + cLib_addCalc0(&i_this->field_0x858, 1.0f, 5.0f + TREG_F(12)); + cXyz xyz(1.0f, 1.0f, 1.0f); + setMidnaBindEffect(enemy, &i_this->mCreatureSound, &enemy->eyePos, &xyz); } /* 807F613C-807F64E0 0035FC 03A4+00 1/1 0/0 0/0 .text eff_set__FP10e_yd_class */ -static void eff_set(e_yd_class* param_0) { - // NONMATCHING +static void eff_set(e_yd_class* i_this) { + static u16 p_name[3] = { + 0x8811, + 0x8812, + 0x8813, + }; + static s32 p_idx[3] = { 2, 2, 6 }; + + f32 fVar1; + J3DModel* model; + bool bVar5; + u32 uVar2; + JPABaseEmitter* pJVar3; + Mtx* pMVar4; + s32 iVar6; + cXyz acStack_48; + + if (i_this->actor.field_0x567 == 0) { + model = i_this->mpMorf->getModel(); + if (i_this->field_0x1234 != 0) { + i_this->field_0x1234 -= 1; + i_this->field_0x1235 = 3; + } + if (i_this->field_0x1235 != 1) { + fVar1 = 0.0f; + } else { + fVar1 = 1.0f; + } + cLib_addCalc2(&i_this->field_0x1250, fVar1, 1.0f, 0.05f); + for (iVar6 = 0; iVar6 <= 2; iVar6++) { + uVar2 = dComIfGp_particle_set(i_this->field_0x1238[iVar6], + p_name[iVar6], &i_this->actor.current.pos, 0, 0); + i_this->field_0x1238[iVar6] = uVar2; + pJVar3 = dComIfGp_particle_getEmitter(i_this->field_0x1238[iVar6]); + if (pJVar3 != NULL) { + pMVar4 = (Mtx*)model->getAnmMtx(p_idx[iVar6]); + MTXCopy(*pMVar4, *calc_mtx); + MtxScale(i_this->field_0x1250, i_this->field_0x1250, i_this->field_0x1250, 1); + pJVar3->setGlobalSRTMatrix(*calc_mtx); + } + } + if (i_this->field_0x1235 != 0) { + if (i_this->field_0x1235 == 1) { + acStack_48 = i_this->actor.current.pos; + acStack_48.y += 100.0f; + bVar5 = fopAcM_gc_c::gndCheck(&acStack_48); + if (bVar5) { + acStack_48.y = fopAcM_gc_c::getGroundY(); + } + uVar2 = dComIfGp_particle_set(i_this->field_0x1248, 0x8810, &acStack_48, 0, 0); + i_this->field_0x1248 = uVar2; + } else if (i_this->field_0x1235 == 2) { + uVar2 = dComIfGp_particle_set(i_this->field_0x1244, + 0x880e, &i_this->actor.current.pos, 0, 0); + i_this->field_0x1244 = uVar2; + pJVar3 = dComIfGp_particle_getEmitter(i_this->field_0x1244); + if (pJVar3 != NULL) { + pMVar4 = (Mtx*)model->getAnmMtx(1); + MTXCopy(*pMVar4, *calc_mtx); + pJVar3->setGlobalRTMatrix(*calc_mtx); + } + } else if (i_this->field_0x1235 == 3) { + uVar2 = dComIfGp_particle_set(i_this->field_0x124c, + 0x880f, &i_this->actor.current.pos, 0, 0); + i_this->field_0x124c = uVar2; + pJVar3 = dComIfGp_particle_getEmitter(i_this->field_0x124c); + if (pJVar3 != NULL) { + pMVar4 = (Mtx*)model->getAnmMtx(1); + MTXCopy(*pMVar4, *calc_mtx); + pJVar3->setGlobalRTMatrix(*calc_mtx); + } + } + i_this->field_0x1235 = 0; + } + } } -/* ############################################################################################## */ -/* 807F7AE4-807F7AE8 0000E4 0004+00 0/0 0/0 0/0 .rodata @4861 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4861 = -10.0f; -COMPILER_STRIP_GATE(0x807F7AE4, &lit_4861); -#pragma pop - -/* 807F7AE8-807F7AEC 0000E8 0004+00 0/1 0/0 0/0 .rodata @4862 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4862 = 10000.0f; -COMPILER_STRIP_GATE(0x807F7AE8, &lit_4862); -#pragma pop - -/* 807F7AEC-807F7AF0 0000EC 0004+00 0/0 0/0 0/0 .rodata @4863 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4863 = 65536.0f; -COMPILER_STRIP_GATE(0x807F7AEC, &lit_4863); -#pragma pop - -/* 807F7AF0-807F7AF4 0000F0 0004+00 0/0 0/0 0/0 .rodata @4864 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4864 = -5.0f; -COMPILER_STRIP_GATE(0x807F7AF0, &lit_4864); -#pragma pop - -/* 807F7AF4-807F7AF8 0000F4 0004+00 0/0 0/0 0/0 .rodata @5003 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5003 = 25.0f; -COMPILER_STRIP_GATE(0x807F7AF4, &lit_5003); -#pragma pop - -/* 807F7AF8-807F7AFC 0000F8 0004+00 0/1 0/0 0/0 .rodata @5004 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5004 = -30000.0f; -COMPILER_STRIP_GATE(0x807F7AF8, &lit_5004); -#pragma pop - -/* 807F7AFC-807F7B00 0000FC 0004+00 0/0 0/0 0/0 .rodata @5005 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5005 = 300000.0f; -COMPILER_STRIP_GATE(0x807F7AFC, &lit_5005); -#pragma pop - -/* 807F7B00-807F7B04 000100 0004+00 0/0 0/0 0/0 .rodata @5006 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5006 = 30000.0f; -COMPILER_STRIP_GATE(0x807F7B00, &lit_5006); -#pragma pop - -/* 807F7B04-807F7B08 000104 0004+00 0/1 0/0 0/0 .rodata @5167 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5167 = 22.0f; -COMPILER_STRIP_GATE(0x807F7B04, &lit_5167); -#pragma pop - -/* 807F7B08-807F7B0C 000108 0004+00 0/1 0/0 0/0 .rodata @5168 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5168 = 21.0f; -COMPILER_STRIP_GATE(0x807F7B08, &lit_5168); -#pragma pop - /* 807F64E0-807F6648 0039A0 0168+00 1/1 0/0 0/0 .text anm_se_set__FP10e_yd_class */ -static void anm_se_set(e_yd_class* param_0) { - // NONMATCHING +static void anm_se_set(e_yd_class* i_this) { + if (i_this->field_0x664 == 6) { + if (i_this->mpMorf->checkFrame(22.0f) != 0) { + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_DB_BERON, 0, -1); + } + } else if (i_this->field_0x664 == 7) { + if (i_this->mpMorf->checkFrame(21.0f) != 0) { + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_DB_ATTACK, 0, -1); + } + } else if (i_this->field_0x664 == 18) { + if (i_this->mpMorf->checkFrame(15.0f) != 0) { + i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_DB_V_AWAKE, -1); + } + } else if (i_this->field_0x664 == 16) { + if (i_this->mpMorf->checkFrame(3.0f) != 0) { + i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_DB_V_CREEP, -1); + } + } } -/* ############################################################################################## */ -/* 807F7B0C-807F7B10 00010C 0004+00 0/1 0/0 0/0 .rodata @5238 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5238 = -20000.0f; -COMPILER_STRIP_GATE(0x807F7B0C, &lit_5238); -#pragma pop - /* 807F6648-807F694C 003B08 0304+00 2/1 0/0 0/0 .text daE_YD_Execute__FP10e_yd_class */ -static void daE_YD_Execute(e_yd_class* param_0) { - // NONMATCHING +static int daE_YD_Execute(e_yd_class* i_this) { + i_this->field_0x66c++; + + for (s32 i = 0; i < 3; i++) { + if (i_this->field_0x69c[i] != 0) { + i_this->field_0x69c[i]--; + } + } + + if (i_this->field_0x69c[3] != 0) { + i_this->field_0x69c[3]--; + } + + action(i_this); + + anm_se_set(i_this); + + mDoMtx_stack_c::transS(i_this->actor.current.pos.x, i_this->actor.current.pos.y, + i_this->actor.current.pos.z); + mDoMtx_stack_c::YrotM(i_this->actor.shape_angle.y); + mDoMtx_stack_c::XrotM(i_this->actor.shape_angle.x); + mDoMtx_stack_c::ZrotM(i_this->actor.shape_angle.z); + cLib_addCalcAngleS2(&i_this->actor.shape_angle.z, 0, 8, 0x400); + + f32 scale = l_HIO.field_0x8 * i_this->field_0x698; + mDoMtx_stack_c::scaleM(scale, scale, scale); + + J3DModel* model = i_this->mpMorf->getModel(); + model->setBaseTRMtx(mDoMtx_stack_c::get()); + + i_this->mpMorf->play(0, dComIfGp_getReverb(fopAcM_GetRoomNo(&i_this->actor))); + i_this->mBrkAnm->play(); + + i_this->mpMorf->modelCalc(); + + cXyz cStack_2c; + cXyz cStack_20; + cXyz cStack_14(-30000.0f, 10000.0f, -20000.0f); + + MTXCopy(model->getAnmMtx(1), *calc_mtx); + + cStack_2c.set(JREG_F(0) + 30.0f, KREG_F(1), KREG_F(2)); + + if (i_this->mLeafRoomNo != 0) { + i_this->actor.eyePos = i_this->mJointPositions[6 + YREG_S(3)]; + + i_this->actor.attention_info.position = i_this->actor.eyePos; + + i_this->field_0x8a0.SetTgType(0xd8fbfdbf); + } else { + MtxPosition(&cStack_2c, &i_this->actor.eyePos); + + i_this->actor.attention_info.position = i_this->actor.eyePos; + i_this->actor.attention_info.position.y += 60.0f; + + i_this->field_0x8a0.SetTgType(0xd8fbfdff); + } + + MtxPosition(&cStack_2c, &cStack_20); + + if (i_this->field_0x69c[3] != 0) { + cStack_20 += cStack_14; + } + + i_this->field_0x8a0.SetC(cStack_20); + i_this->field_0x8a0.SetR(l_HIO.field_0x8 * (JREG_F(2) + 40.0f) * i_this->field_0x698); + + dComIfG_Ccsp()->Set(&i_this->field_0x8a0); + + if (i_this->field_0xb10 != 0) { + i_this->field_0x9d8.MoveCAt(cStack_20); + + i_this->field_0xb10 = 0; + } else { + i_this->field_0x9d8.SetC(cStack_20 + cStack_14); + } + + i_this->field_0x9d8.SetR(l_HIO.field_0x8 * (JREG_F(3) + 30.0f) * i_this->field_0x698); + + dComIfG_Ccsp()->Set(&i_this->field_0x9d8); + + eff_set(i_this); + + return 1; } /* 807F694C-807F6954 003E0C 0008+00 1/0 0/0 0/0 .text daE_YD_IsDelete__FP10e_yd_class */ -static bool daE_YD_IsDelete(e_yd_class* param_0) { - return true; +static int daE_YD_IsDelete(e_yd_class* i_this) { + return 1; } /* 807F6954-807F69BC 003E14 0068+00 1/0 0/0 0/0 .text daE_YD_Delete__FP10e_yd_class */ -static void daE_YD_Delete(e_yd_class* param_0) { - // NONMATCHING +static int daE_YD_Delete(e_yd_class* i_this) { + dComIfG_resDelete(&i_this->field_0x5ac, "E_yd"); + if (i_this->field_0x1268 != 0) { + data_807F7D68 = 0; + } + if (i_this->actor.heap != NULL) { + i_this->mpMorf->stopZelAnime(); + } + return 1; } /* 807F69BC-807F6C48 003E7C 028C+00 1/1 0/0 0/0 .text useHeapInit__FP10fopAc_ac_c */ -static void useHeapInit(fopAc_ac_c* param_0) { - // NONMATCHING +static int useHeapInit(fopAc_ac_c* i_this) { + f32 fVar10; + + e_yd_class* a_this = (e_yd_class*)i_this; + + a_this->mpMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_yd", 24), + NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_yd", 19), 2, 1.0f, 0, -1, + &a_this->mCreatureSound, 0x80000, 0x11000084); + if (a_this->mpMorf == NULL || a_this->mpMorf->getModel() == NULL) { + return 0; + } + + J3DModel* model = a_this->mpMorf->getModel(); + + a_this->mBrkAnm = new mDoExt_brkAnm(); + if (a_this->mBrkAnm == NULL) { + return 0; + } + + s32 brkAnmRes = a_this->mBrkAnm->init(model->getModelData(), + (J3DAnmTevRegKey*)dComIfG_getObjectRes("E_yd", 29), 1, 2, 1.0f, 0, -1); + if (brkAnmRes == 0) { + return 0; + } + + if (!a_this->mLineMat.init(1, 12, (ResTIMG*)dComIfG_getObjectRes("E_yd", 32), 1)) { + return 0; + } + + f32* lineMatSize = a_this->mLineMat.getSize(0); + for (s32 i = 0; i < 0xc; i++, lineMatSize++) { + *lineMatSize = (f32)XREG_F(0) * 0.1f + 5.0f; + } + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_yd", 26); + JUT_ASSERT(2943, modelData != NULL); + + for (s32 uVar9 = 1; uVar9 < 11; uVar9++) { + if ((uVar9 & 1) != 0) { + model = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); + a_this->field_0x77c[uVar9] = model; + if (a_this->field_0x77c[uVar9] == 0) { + return 0; + } + fVar10 = cM_rndF(1.0f); + a_this->field_0x7dc[uVar9] = fVar10 + 1.0f; + } + } + return 1; } -/* 807F6C48-807F6C90 004108 0048+00 1/0 0/0 0/0 .text __dt__12J3DFrameCtrlFv */ -// J3DFrameCtrl::~J3DFrameCtrl() { -extern "C" void __dt__12J3DFrameCtrlFv() { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 807F7B10-807F7B14 000110 0004+00 0/1 0/0 0/0 .rodata @5468 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5468 = 500.0f; -COMPILER_STRIP_GATE(0x807F7B10, &lit_5468); -#pragma pop - -/* 807F7B14-807F7B18 000114 0004+00 0/1 0/0 0/0 .rodata @5469 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5469 = -300.0f; -COMPILER_STRIP_GATE(0x807F7B14, &lit_5469); -#pragma pop - -/* 807F7B18-807F7B1C 000118 0004+00 0/1 0/0 0/0 .rodata @5470 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5470 = -400.0f; -COMPILER_STRIP_GATE(0x807F7B18, &lit_5470); -#pragma pop - -/* 807F7B1C-807F7B20 00011C 0004+00 0/1 0/0 0/0 .rodata @5471 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5471 = 300.0f; -COMPILER_STRIP_GATE(0x807F7B1C, &lit_5471); -#pragma pop - -/* 807F7B20-807F7B28 000120 0004+04 0/1 0/0 0/0 .rodata @5472 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5472[1 + 1 /* padding */] = { - 65535.0f, - /* padding */ - 0.0f, -}; -COMPILER_STRIP_GATE(0x807F7B20, &lit_5472); -#pragma pop - -/* 807F7B28-807F7B30 000128 0008+00 0/1 0/0 0/0 .rodata @5474 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_5474[8] = { - 0x43, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x807F7B28, &lit_5474); -#pragma pop - /* 807F6C90-807F7160 004150 04D0+00 1/0 0/0 0/0 .text daE_YD_Create__FP10fopAc_ac_c */ -static void daE_YD_Create(fopAc_ac_c* param_0) { - // NONMATCHING +static int daE_YD_Create(fopAc_ac_c* i_this) { + static dCcD_SrcSph cc_sph_src = { + { + {0x0, {{0x0, 0x0, 0xd}, {(s32)0xd8fbfdff, 0x3}, 0x25}}, // mObj + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt + {dCcD_SE_STONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg + {0x0}, // mGObjCo + }, // mObjInf + { + {{0.0f, 0.0f, 0.0f}, 40.0f} // mSph + } // mSphAttr + }; + static dCcD_SrcSph at_sph_src = { + { + {0x0, {{AT_TYPE_CSTATUE_SWING, 0x1, 0xd}, {0x0, 0x0}, 0x0}}, // 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}, 35.0f} // mSph + } // mSphAttr + }; + static dCcD_SrcSph kuki_sph_src = { + { + {0x0, {{0x0, 0x0, 0xd}, {(s32)0xd8fbfdff, 0x3}, 0x0}}, // mObj + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg + {0x0}, // mGObjCo + }, // mObjInf + { + {{0.0f, 0.0f, 0.0f}, 20.0f} // mSph + } // mSphAttr + }; + + fopAcM_SetupActor(i_this, e_yd_class); + e_yd_class* a_this = (e_yd_class*)i_this; + + s32 loadRv = dComIfG_resLoad(&a_this->field_0x5ac, "E_yd"); + if (loadRv == 4) { + OS_REPORT("E_YD PARAM %x\n", fopAcM_GetParam(i_this)); + + a_this->field_0x5b4 = fopAcM_GetParam(i_this) & 0xf; + a_this->field_0x5b6 = fopAcM_GetParam(i_this) >> 4 & 0x3; + a_this->field_0x5b7 = fopAcM_GetParam(i_this) >> 6 & 0x3; + a_this->field_0x5b5 = fopAcM_GetParam(i_this) >> 8; + if (a_this->field_0x5b4 == 0xf) { + a_this->field_0x5b4 = 0; + } + if (((e_yd_class*)i_this)->field_0x5b5 == 0xff || ((e_yd_class*)i_this)->field_0x5b5 == 0) { + ((e_yd_class*)i_this)->field_0x674 = 500.0f; + } else { + ((e_yd_class*)i_this)->field_0x674 = ((e_yd_class*)i_this)->field_0x5b5 * 100.0f; + } + + OS_REPORT("E_YD//////////////E_YD SET 1 !!\n"); + + if (!fopAcM_entrySolidHeap(i_this, useHeapInit, 0x4700)) { + OS_REPORT("//////////////E_YD SET NON !!\n"); + + return 5; + } + + OS_REPORT("//////////////E_YD SET 2 !!\n"); + + if (data_807F7D68 == 0) { + ((e_yd_class*)i_this)->field_0x1268 = 1; + data_807F7D68 = 1; + l_HIO.field_0x4 = -1; + } + + i_this->attention_info.flags = 0x4; + fopAcM_SetMtx(i_this, ((e_yd_class*)i_this)->mpMorf->getModel()->getBaseTRMtx()); + + fopAcM_SetMin(i_this, -300.0f, -400.0f, -300.0f); + fopAcM_SetMax(i_this, 300.0f, 400.0f, 300.0f); + + i_this->health = 30; + i_this->field_0x560 = 30; + + a_this->mStts.Init(100, 0, i_this); + + a_this->field_0x8a0.Set(cc_sph_src); + a_this->field_0x8a0.SetStts(&a_this->mStts); + + a_this->field_0x9d8.Set(at_sph_src); + a_this->field_0x9d8.SetStts(&a_this->mStts); + + for (s32 i = 0; i < 4; i++) { + a_this->field_0xb14[i].Set(kuki_sph_src); + a_this->field_0xb14[i].SetStts(&a_this->mStts); + } + + a_this->field_0x1058.Set(fopAcM_GetPosition_p(i_this), fopAcM_GetOldPosition_p(i_this), i_this, 1, + &a_this->field_0x1018, fopAcM_GetSpeed_p(i_this), NULL, NULL); + a_this->field_0x1018.SetWall(50.0f, 50.0f); + + a_this->mCreatureSound.init(&i_this->current.pos, &i_this->eyePos, 3, 1); + a_this->mCreatureSound.setEnemyName("E_yd"); + a_this->field_0xff4.mpSound = &a_this->mCreatureSound; + a_this->field_0xff4.mPowerType = 1; + a_this->field_0xff4.field_0x18 = 45; + + s8 leafRoomNo = 1; + a_this->field_0x66c = cM_rndF(65535.0f); + a_this->field_0x698 = l_HIO.field_0xc; + if (a_this->field_0x5b4 == 2) { + i_this->current.angle.x = -0x8000; + i_this->shape_angle.x = -0x8000; + a_this->mLeafRoomNo = leafRoomNo; + } + + leafRoomNo = fopAcM_GetRoomNo(i_this); + + a_this->mLeafId = fopAcM_createChild(PROC_E_YD_LEAF, fopAcM_GetID(i_this), 0, + &i_this->current.pos, leafRoomNo, &i_this->shape_angle, NULL, -1, NULL); + + i_this->field_0x565 = fopAcM_GetParam(i_this) >> 16; + i_this->field_0x564 = fopAcM_GetParam(i_this) >> 24; + + daE_YD_Execute((e_yd_class*)i_this); + } + + return loadRv; } -/* 807F7160-807F71D0 004620 0070+00 3/2 0/0 0/0 .text __dt__12dBgS_ObjAcchFv */ -// dBgS_ObjAcch::~dBgS_ObjAcch() { -extern "C" void __dt__12dBgS_ObjAcchFv() { - // NONMATCHING -} +static actor_method_class l_daE_YD_Method = { + (process_method_func)daE_YD_Create, + (process_method_func)daE_YD_Delete, + (process_method_func)daE_YD_Execute, + (process_method_func)daE_YD_IsDelete, + (process_method_func)daE_YD_Draw, +}; -/* 807F71D0-807F7240 004690 0070+00 1/0 0/0 0/0 .text __dt__12dBgS_AcchCirFv */ -// dBgS_AcchCir::~dBgS_AcchCir() { -extern "C" void __dt__12dBgS_AcchCirFv() { - // NONMATCHING -} - -/* 807F7240-807F72C4 004700 0084+00 1/1 0/0 0/0 .text __ct__8dCcD_SphFv */ -// dCcD_Sph::dCcD_Sph() { -extern "C" void __ct__8dCcD_SphFv() { - // NONMATCHING -} - -/* 807F72C4-807F7390 004784 00CC+00 1/1 0/0 0/0 .text __dt__8dCcD_SphFv */ -// dCcD_Sph::~dCcD_Sph() { -extern "C" void __dt__8dCcD_SphFv() { - // NONMATCHING -} - -/* 807F7390-807F73D8 004850 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGSphFv */ -// cM3dGSph::~cM3dGSph() { -extern "C" void __dt__8cM3dGSphFv() { - // NONMATCHING -} - -/* 807F73D8-807F7420 004898 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGAabFv */ -// cM3dGAab::~cM3dGAab() { -extern "C" void __dt__8cM3dGAabFv() { - // NONMATCHING -} - -/* 807F7420-807F747C 0048E0 005C+00 1/0 0/0 0/0 .text __dt__10dCcD_GSttsFv */ -// dCcD_GStts::~dCcD_GStts() { -extern "C" void __dt__10dCcD_GSttsFv() { - // NONMATCHING -} - -/* 807F747C-807F7480 00493C 0004+00 1/1 0/0 0/0 .text __ct__5csXyzFv */ -// csXyz::csXyz() { -extern "C" void __ct__5csXyzFv() { - /* empty function */ -} - -/* 807F7480-807F7484 004940 0004+00 1/1 0/0 0/0 .text __ct__4cXyzFv */ -// cXyz::cXyz() { -extern "C" void __ct__4cXyzFv() { - /* empty function */ -} - -/* 807F7484-807F74CC 004944 0048+00 1/0 0/0 0/0 .text __dt__10cCcD_GSttsFv */ -// cCcD_GStts::~cCcD_GStts() { -extern "C" void __dt__10cCcD_GSttsFv() { - // NONMATCHING -} - -/* 807F74CC-807F7514 00498C 0048+00 2/1 0/0 0/0 .text __dt__12daE_YD_HIO_cFv */ -daE_YD_HIO_c::~daE_YD_HIO_c() { - // NONMATCHING -} - -/* 807F7514-807F7550 0049D4 003C+00 0/0 1/0 0/0 .text __sinit_d_a_e_yd_cpp */ -void __sinit_d_a_e_yd_cpp() { - // NONMATCHING -} - -#pragma push -#pragma force_active on -REGISTER_CTORS(0x807F7514, __sinit_d_a_e_yd_cpp); -#pragma pop - -/* 807F7550-807F7558 004A10 0008+00 1/0 0/0 0/0 .text @36@__dt__12dBgS_ObjAcchFv */ -static void func_807F7550() { - // NONMATCHING -} - -/* 807F7558-807F7560 004A18 0008+00 1/0 0/0 0/0 .text @20@__dt__12dBgS_ObjAcchFv */ -static void func_807F7558() { - // NONMATCHING -} - -/* 807F7974-807F79B0 004E34 003C+00 1/1 0/0 0/0 .text __dt__5csXyzFv */ -// csXyz::~csXyz() { -extern "C" void __dt__5csXyzFv() { - // NONMATCHING -} - -/* 807F79B0-807F79EC 004E70 003C+00 1/1 0/0 0/0 .text __dt__4cXyzFv */ -// cXyz::~cXyz() { -extern "C" void __dt__4cXyzFv() { - // NONMATCHING -} - -/* 807F7B30-807F7B30 000130 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ +extern actor_process_profile_definition g_profile_E_YD = { + fpcLy_CURRENT_e, // mLayerID + 7, // mListID + fpcPi_CURRENT_e, // mListPrio + PROC_E_YD, // mProcName + &g_fpcLf_Method.base, // sub_method + sizeof(e_yd_class), // mSize + 0, // mSizeOther + 0, // mParameters + &g_fopAc_Method.base, // sub_method + 143, // mPriority + &l_daE_YD_Method, // sub_method + 0x10050100, // mStatus + fopAc_ENEMY_e, // mActorType + fopAc_CULLBOX_CUSTOM_e, // cullType +};