diff --git a/configure.py b/configure.py index 2c86a21c0c2..dc866d1dc51 100755 --- a/configure.py +++ b/configure.py @@ -1675,7 +1675,7 @@ config.libs = [ ActorRel(Equivalent, "d_a_e_th"), # weak func order ActorRel(MatchingFor("GZ2E01"), "d_a_e_th_ball"), ActorRel(MatchingFor("GZ2E01"), "d_a_e_tk"), - ActorRel(NonMatching, "d_a_e_tk2"), + ActorRel(MatchingFor("GZ2E01"), "d_a_e_tk2"), ActorRel(NonMatching, "d_a_e_tk_ball"), ActorRel(NonMatching, "d_a_e_tt"), ActorRel(NonMatching, "d_a_e_vt"), diff --git a/include/d/actor/d_a_e_tk.h b/include/d/actor/d_a_e_tk.h index 11611ad84e4..e07508c7df3 100644 --- a/include/d/actor/d_a_e_tk.h +++ b/include/d/actor/d_a_e_tk.h @@ -49,7 +49,7 @@ public: /* 0x6A1 */ s8 mTKBallSpawned; /* 0x6A4 */ u32 mHamonSet; /* 0x6A8 */ u8 field_0x6a8[4]; - /* 0x6AC */ fpc_ProcID mpBallID; + /* 0x6AC */ fpc_ProcID mBallID; /* 0x6B0 */ dBgS_AcchCir mAcchCir; /* 0x6F0 */ dBgS_ObjAcch mAcch; /* 0x8C8 */ dCcD_Stts mStts; diff --git a/include/d/actor/d_a_e_tk2.h b/include/d/actor/d_a_e_tk2.h index 2e3d445a536..c9dfa63d908 100644 --- a/include/d/actor/d_a_e_tk2.h +++ b/include/d/actor/d_a_e_tk2.h @@ -1,26 +1,72 @@ #ifndef D_A_E_TK2_H #define D_A_E_TK2_H -#include "f_op/f_op_actor_mng.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.h" /** * @ingroup actors-enemies * @class e_tk2_class * @brief Fire Toadpoli - * - * @details - * + * + * @details Fire Toadpoli in the Goron Mines Entrance. + * Armored, two-legged frogs that spit Fireballs at Link. + * They cannot swim, but will dive under the lava if Link + * gets too close. They share most of the code with the + * Water Toadpoli e_tk. */ + class e_tk2_class : public fopEn_enemy_c { -private: - /* 0x5ac */ u8 field_0x5ac[0xa50 - 0x5ac]; +public: + /* 0x5AC */ request_of_phase_process_class mPhaseReq; + /* 0x5B4 */ u8 mArg0; + /* 0x5B5 */ u8 mArg1; + /* 0x5B6 */ u8 mArg2; + /* 0x5B7 */ u8 mArg3; /* Unused */ + /* 0x5B8 */ mDoExt_McaMorfSO* mpMorf; + /* 0x5BC */ int mAnim; + /* 0x5C0 */ Z2CreatureEnemy mSound; + /* 0x664 */ f32 mAnimSpeed; + /* 0x668 */ s16 mLifetime; + /* 0x66A */ s16 mAction; + /* 0x66C */ s16 mMode; + /* 0x670 */ cXyz mPos; + /* 0x67C */ s16 mSomeAngle; + /* 0x67E */ u8 field18_0x67e[2]; + /* 0x680 */ s16 mPlayerAngleY; + /* 0x684 */ f32 mPlayerDistanceLimit; + /* 0x688 */ u8 field24_0x688[2]; + /* 0x68A */ s16 mActionTimer[3]; + /* 0x690 */ s16 mExecuteState; + /* 0x692 */ s16 mInvincibilityTimer; + /* 0x694 */ s8 mAttentionOFF; + /* 0x695 */ s8 mTKBallSpawned; + /* 0x698 */ fpc_ProcID mBallID; + /* 0x69C */ dBgS_AcchCir mAcchCir; + /* 0x6DC */ dBgS_ObjAcch mAcch; + /* 0x8B4 */ dCcD_Stts mStts; + /* 0x8F0 */ dCcD_Sph mSph; + /* 0xA28 */ dCcU_AtInfo mAtInfo; + /* 0xA4C */ bool mInitHIO; }; -STATIC_ASSERT(sizeof(e_tk2_class) == 0xa50); +STATIC_ASSERT(sizeof(e_tk2_class) == 0xA50); class daE_TK2_HIO_c { +public: /* 807BA56C */ daE_TK2_HIO_c(); - /* 807BBD00 */ ~daE_TK2_HIO_c(); + /* 807BBD00 */ virtual ~daE_TK2_HIO_c() {}; + + /* 0x04 */ s8 field_0x04; + /* 0x08 */ f32 mRadiusScale; + /* 0x0C */ f32 mPlayerRange1; + /* 0x10 */ f32 mPlayerRange2; + /* 0x14 */ f32 mSpeedModifier1; /* Unused */ + /* 0x18 */ f32 mSpeedModifier2; /* Unused */ }; +STATIC_ASSERT(sizeof(daE_TK2_HIO_c) == 0x1C); #endif /* D_A_E_TK2_H */ diff --git a/src/d/actor/d_a_e_tk.cpp b/src/d/actor/d_a_e_tk.cpp index b947fc64ed6..2ea2209d7ee 100644 --- a/src/d/actor/d_a_e_tk.cpp +++ b/src/d/actor/d_a_e_tk.cpp @@ -347,7 +347,7 @@ static void e_tk_attack(e_tk_class* i_this) { case MODE_TK_APPEAR: if (pl_y_check(i_this)) { if ((int)i_this->mpMorf->getFrame() == 24) { - i_this->mpBallID = + i_this->mBallID = fopAcM_createChild(PROC_E_TK_BALL, fopAcM_GetID(i_this), 0, &i_this->eyePos, fopAcM_GetRoomNo(i_this), &i_this->shape_angle, 0, -1, 0); } @@ -627,7 +627,7 @@ static int daE_TK_Execute(e_tk_class* i_this) { if (i_this->mTKBallSpawned) { e_tk_ball_class* ball_actor = - static_cast(fopAcM_SearchByID(i_this->mpBallID)); + static_cast(fopAcM_SearchByID(i_this->mBallID)); if (ball_actor != NULL) { ball_actor->current.pos = i_this->eyePos; ball_actor->field_0x5ac[0x31C] = 0x0; @@ -667,7 +667,6 @@ static int daE_TK_IsDelete(e_tk_class* i_this) { /* 807B9C58-807B9CC0 001B58 0068+00 1/0 0/0 0/0 .text daE_TK_Delete__FP10e_tk_class */ static int daE_TK_Delete(e_tk_class* i_this) { - // fopAcM_GetID(i_this); dComIfG_resDelete(&i_this->mPhaseReq, "E_tk"); if (i_this->mInitHIO) { hioInit = false; diff --git a/src/d/actor/d_a_e_tk2.cpp b/src/d/actor/d_a_e_tk2.cpp index 119fbbea307..024928f67ab 100644 --- a/src/d/actor/d_a_e_tk2.cpp +++ b/src/d/actor/d_a_e_tk2.cpp @@ -1,577 +1,591 @@ /** * @file d_a_e_tk2.cpp - * -*/ + * + */ #include "d/actor/d_a_e_tk2.h" -#include "d/d_cc_d.h" -#include "dol2asm.h" +#include "d/actor/d_a_e_tk_ball.h" +#include "d/d_com_inf_game.h" - - -// -// Forward References: -// - -extern "C" void __ct__13daE_TK2_HIO_cFv(); -extern "C" static void anm_init__FP11e_tk2_classifUcf(); -extern "C" static void daE_TK2_Draw__FP11e_tk2_class(); -extern "C" static void other_bg_check__FP11e_tk2_classP10fopAc_ac_c(); -extern "C" static void pl_check__FP11e_tk2_classfs(); -extern "C" static void damage_check__FP11e_tk2_class(); -extern "C" static void e_tk2_wait_0__FP11e_tk2_class(); -extern "C" static void e_tk2_find__FP11e_tk2_class(); -extern "C" static void e_tk2_attack__FP11e_tk2_class(); -extern "C" static void e_tk2_s_damage__FP11e_tk2_class(); -extern "C" static void e_tk2_damage__FP11e_tk2_class(); -extern "C" static void action__FP11e_tk2_class(); -extern "C" static void daE_TK2_Execute__FP11e_tk2_class(); -extern "C" static bool daE_TK2_IsDelete__FP11e_tk2_class(); -extern "C" static void daE_TK2_Delete__FP11e_tk2_class(); -extern "C" static void useHeapInit__FP10fopAc_ac_c(); -extern "C" static void daE_TK2_Create__FP10fopAc_ac_c(); -extern "C" void __dt__8cM3dGSphFv(); -extern "C" void __dt__8cM3dGAabFv(); -extern "C" void __dt__12dBgS_ObjAcchFv(); -extern "C" void __dt__13daE_TK2_HIO_cFv(); -extern "C" void __sinit_d_a_e_tk2_cpp(); -extern "C" static void func_807BBD84(); -extern "C" static void func_807BBD8C(); -extern "C" extern char const* const d_a_e_tk2__stringBase0; - -// -// External References: -// - -extern "C" void mDoMtx_YrotM__FPA4_fs(); -extern "C" void scaleM__14mDoMtx_stack_cFfff(); -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 __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_searchActorDistance__FPC10fopAc_ac_cPC10fopAc_ac_c(); -extern "C" void fopAcM_createDisappear__FPC10fopAc_ac_cPC4cXyzUcUcUc(); -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 getRes__14dRes_control_cFPCclP11dRes_info_ci(); -extern "C" void -set__13dPa_control_cFUcUsPC4cXyzPC12dKy_tevstr_cPC5csXyzPC4cXyzUcP18dPa_levelEcallBackScPC8_GXColorPC8_GXColorPC4cXyzf(); -extern "C" void LineCross__4cBgSFP11cBgS_LinChk(); -extern "C" void GroundCross__4cBgSFP11cBgS_GndChk(); -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 __ct__18dBgS_ObjGndChk_SplFv(); -extern "C" void __dt__18dBgS_ObjGndChk_SplFv(); -extern "C" void __ct__11dBgS_LinChkFv(); -extern "C" void __dt__11dBgS_LinChkFv(); -extern "C" void Set__11dBgS_LinChkFPC4cXyzPC4cXyzPC10fopAc_ac_c(); -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 ChkTgHit__12dCcD_GObjInfFv(); -extern "C" void GetTgHitObj__12dCcD_GObjInfFv(); -extern "C" void Set__8dCcD_SphFRC11dCcD_SrcSph(); -extern "C" void at_power_check__FP11dCcU_AtInfo(); -extern "C" void cc_at_check__FP10fopAc_ac_cP11dCcU_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 Set__4cCcSFP8cCcD_Obj(); -extern "C" void cM_rndF__Ff(); -extern "C" void cM_rndFX__Ff(); -extern "C" void SetPos__11cBgS_GndChkFPC4cXyz(); -extern "C" void SetC__8cM3dGSphFRC4cXyz(); -extern "C" void SetR__8cM3dGSphFf(); -extern "C" void cLib_addCalc2__FPffff(); -extern "C" void cLib_addCalcAngleS2__FPssss(); -extern "C" void MtxPosition__FP4cXyzP4cXyz(); -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 checkPass__12J3DFrameCtrlFf(); -extern "C" void _savegpr_27(); -extern "C" void _savegpr_28(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_27(); -extern "C" void _restgpr_28(); -extern "C" void _restgpr_29(); -extern "C" extern void* __vt__8dCcD_Sph[36]; -extern "C" extern void* __vt__9dCcD_Stts[11]; -extern "C" extern void* __vt__12cCcD_SphAttr[25]; -extern "C" extern void* __vt__14cCcD_ShapeAttr[22]; -extern "C" extern void* __vt__9cCcD_Stts[8]; -extern "C" u8 now__14mDoMtx_stack_c[48]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; -extern "C" extern void* calc_mtx[1 + 1 /* padding */]; -extern "C" void __register_global_object(); - -// -// Declarations: -// - -/* ############################################################################################## */ -/* 807BBDA8-807BBDAC 000000 0004+00 7/7 0/0 0/0 .rodata @3762 */ -SECTION_RODATA static f32 const lit_3762 = 23.0f / 10.0f; -COMPILER_STRIP_GATE(0x807BBDA8, &lit_3762); - -/* 807BBDAC-807BBDB0 000004 0004+00 0/1 0/0 0/0 .rodata @3763 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3763 = 1400.0f; -COMPILER_STRIP_GATE(0x807BBDAC, &lit_3763); -#pragma pop - -/* 807BBDB0-807BBDB4 000008 0004+00 0/1 0/0 0/0 .rodata @3764 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3764 = 500.0f; -COMPILER_STRIP_GATE(0x807BBDB0, &lit_3764); -#pragma pop - -/* 807BBDB4-807BBDB8 00000C 0004+00 0/3 0/0 0/0 .rodata @3765 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3765 = 10.0f; -COMPILER_STRIP_GATE(0x807BBDB4, &lit_3765); -#pragma pop - -/* 807BBDB8-807BBDBC 000010 0004+00 0/1 0/0 0/0 .rodata @3766 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3766 = 25.0f; -COMPILER_STRIP_GATE(0x807BBDB8, &lit_3766); -#pragma pop - -/* 807BBE28-807BBE5C -00001 0034+00 1/1 0/0 0/0 .data @3947 */ -SECTION_DATA static void* lit_3947[13] = { - (void*)(((char*)e_tk2_find__FP11e_tk2_class) + 0x44), - (void*)(((char*)e_tk2_find__FP11e_tk2_class) + 0x64), - (void*)(((char*)e_tk2_find__FP11e_tk2_class) + 0xD8), - (void*)(((char*)e_tk2_find__FP11e_tk2_class) + 0xF8), - (void*)(((char*)e_tk2_find__FP11e_tk2_class) + 0x118), - (void*)(((char*)e_tk2_find__FP11e_tk2_class) + 0x2E4), - (void*)(((char*)e_tk2_find__FP11e_tk2_class) + 0x2E4), - (void*)(((char*)e_tk2_find__FP11e_tk2_class) + 0x2E4), - (void*)(((char*)e_tk2_find__FP11e_tk2_class) + 0x2E4), - (void*)(((char*)e_tk2_find__FP11e_tk2_class) + 0x2E4), - (void*)(((char*)e_tk2_find__FP11e_tk2_class) + 0x17C), - (void*)(((char*)e_tk2_find__FP11e_tk2_class) + 0x19C), - (void*)(((char*)e_tk2_find__FP11e_tk2_class) + 0x208), +enum Action { + /* 0x0 */ ACT_TK2_WAIT, + /* 0x1 */ ACT_TK2_FIND, + /* 0x2 */ ACT_TK2_ATTACK, + /* 0x9 */ ACT_TK2_S_DAMAGE = 0x9, + /* 0xA */ ACT_TK2_DAMAGE, }; -/* 807BBE5C-807BBE9C 000034 0040+00 1/1 0/0 0/0 .data cc_sph_src$4256 */ -static dCcD_SrcSph cc_sph_src = { - { - {0x0, {{0x0, 0x0, 0xd}, {0xd8fbfdff, 0x3}, 0x75}}, // 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}, 40.0f} // mSph - } // mSphAttr +enum Animation { + /* 0x4 */ ANM_TK2_APPEAR = 0x4, + /* 0x5 */ ANM_TK2_ATTACK, + /* 0x6 */ ANM_TK2_DAMAGE, + /* 0x7 */ ANM_TK2_HIDE, + /* 0x8 */ ANM_TK2_KYORO2, + /* 0x9 */ ANM_TK2_SWIM, + /* 0xA */ ANM_TK2_WAIT01, }; -/* 807BBE9C-807BBEBC -00001 0020+00 1/0 0/0 0/0 .data l_daE_TK2_Method */ -static actor_method_class l_daE_TK2_Method = { - (process_method_func)daE_TK2_Create__FP10fopAc_ac_c, - (process_method_func)daE_TK2_Delete__FP11e_tk2_class, - (process_method_func)daE_TK2_Execute__FP11e_tk2_class, - (process_method_func)daE_TK2_IsDelete__FP11e_tk2_class, - (process_method_func)daE_TK2_Draw__FP11e_tk2_class, +enum Mode { // Not sure if these are correct... + /* 0x0 */ MODE_TK2_NONE, + /* 0x1 */ MODE_TK2_APPEAR, + /* 0x2 */ MODE_TK2_ATTACK, + /* 0x3 */ MODE_TK2_DAMAGE, + /* 0x4 */ MODE_TK2_HIDE, + /* 0xA */ MODE_TK2_KYORO2 = 0xA, + /* 0xB */ MODE_TK2_SWIM, + /* 0xC */ MODE_TK2_WAIT01, }; -/* 807BBEBC-807BBEEC -00001 0030+00 0/0 0/0 1/0 .data g_profile_E_TK2 */ -extern actor_process_profile_definition g_profile_E_TK2 = { - fpcLy_CURRENT_e, // mLayerID - 7, // mListID - fpcPi_CURRENT_e, // mListPrio - PROC_E_TK2, // mProcName - &g_fpcLf_Method.base, // sub_method - sizeof(e_tk2_class), // mSize - 0, // mSizeOther - 0, // mParameters - &g_fopAc_Method.base, // sub_method - 150, // mPriority - &l_daE_TK2_Method, // sub_method - 0x00040100, // mStatus - fopAc_ENEMY_e, // mActorType - fopAc_CULLBOX_CUSTOM_e, // cullType -}; +/* 807BBF40-807BBF44 000008 0004+00 2/2 0/0 0/0 .bss None */ +static bool hioInit; -/* 807BBEEC-807BBEF8 0000C4 000C+00 2/2 0/0 0/0 .data __vt__8cM3dGSph */ -SECTION_DATA extern void* __vt__8cM3dGSph[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__8cM3dGSphFv, -}; - -/* 807BBEF8-807BBF04 0000D0 000C+00 2/2 0/0 0/0 .data __vt__8cM3dGAab */ -SECTION_DATA extern void* __vt__8cM3dGAab[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__8cM3dGAabFv, -}; - -/* 807BBF04-807BBF28 0000DC 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_807BBD8C, - (void*)NULL, - (void*)NULL, - (void*)func_807BBD84, -}; - -/* 807BBF28-807BBF34 000100 000C+00 2/2 0/0 0/0 .data __vt__13daE_TK2_HIO_c */ -SECTION_DATA extern void* __vt__13daE_TK2_HIO_c[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__13daE_TK2_HIO_cFv, -}; +/* 807BBF50-807BBF6C 000018 001C+00 6/6 0/0 0/0 .bss l_HIO */ +static daE_TK2_HIO_c l_HIO; /* 807BA56C-807BA5B4 0000EC 0048+00 1/1 0/0 0/0 .text __ct__13daE_TK2_HIO_cFv */ daE_TK2_HIO_c::daE_TK2_HIO_c() { - // NONMATCHING + field_0x04 = -1; + mRadiusScale = 2.3f; + mPlayerRange2 = 1400.0f; + mPlayerRange1 = 500.0f; + mSpeedModifier1 = 10.0f; + mSpeedModifier2 = 25.0f; } -/* ############################################################################################## */ -/* 807BBDBC-807BBDC0 000014 0004+00 1/4 0/0 0/0 .rodata @3780 */ -SECTION_RODATA static u8 const lit_3780[4] = { - 0x00, - 0x00, - 0x00, - 0x00, -}; -COMPILER_STRIP_GATE(0x807BBDBC, &lit_3780); - -/* 807BBDC0-807BBDC4 000018 0004+00 1/1 0/0 0/0 .rodata @3781 */ -SECTION_RODATA static f32 const lit_3781 = -1.0f; -COMPILER_STRIP_GATE(0x807BBDC0, &lit_3781); - -/* 807BBE20-807BBE20 000078 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_807BBE20 = "E_tk2"; -#pragma pop - /* 807BA5B4-807BA660 000134 00AC+00 4/4 0/0 0/0 .text anm_init__FP11e_tk2_classifUcf */ -static void anm_init(e_tk2_class* param_0, int param_1, f32 param_2, u8 param_3, f32 param_4) { - // NONMATCHING +static void anm_init(e_tk2_class* i_this, int i_index, f32 i_morf, u8 i_attr, f32 i_rate) { + J3DAnmTransform* anm = (J3DAnmTransform*)dComIfG_getObjectRes("E_tk2", i_index); + + i_this->mpMorf->setAnm(anm, i_attr, i_morf, i_rate, 0.0f, -1.0f); + i_this->mAnim = i_index; } /* 807BA660-807BA6D0 0001E0 0070+00 1/0 0/0 0/0 .text daE_TK2_Draw__FP11e_tk2_class */ -static void daE_TK2_Draw(e_tk2_class* param_0) { - // NONMATCHING -} +static int daE_TK2_Draw(e_tk2_class* i_this) { + J3DModel* model = i_this->mpMorf->getModel(); -/* ############################################################################################## */ -/* 807BBDC4-807BBDC8 00001C 0004+00 1/2 0/0 0/0 .rodata @3820 */ -SECTION_RODATA static f32 const lit_3820 = 100.0f; -COMPILER_STRIP_GATE(0x807BBDC4, &lit_3820); + g_env_light.settingTevStruct(0, &i_this->current.pos, &i_this->tevStr); + g_env_light.setLightTevColorType_MAJI(model, &i_this->tevStr); + i_this->mpMorf->entryDL(); + return 1; +} /* 807BA6D0-807BA7A8 000250 00D8+00 1/1 0/0 0/0 .text other_bg_check__FP11e_tk2_classP10fopAc_ac_c */ -static void other_bg_check(e_tk2_class* param_0, fopAc_ac_c* param_1) { - // NONMATCHING +static int other_bg_check(e_tk2_class* i_this, fopAc_ac_c* i_ac) { + fopAc_ac_c* actor = i_this; + dBgS_LinChk line_check; + cXyz start_pos; + cXyz end_pos; + + end_pos = i_ac->current.pos; + end_pos.y += 100.0f; + start_pos = actor->current.pos; + start_pos.y = actor->eyePos.y; + + line_check.Set(&start_pos, &end_pos, actor); + + if (dComIfG_Bgsp().LineCross(&line_check)) { + return true; + } else { + return false; + } } /* 807BA7A8-807BA824 000328 007C+00 2/2 0/0 0/0 .text pl_check__FP11e_tk2_classfs */ -static void pl_check(e_tk2_class* param_0, f32 param_1, s16 param_2) { - // NONMATCHING +static int pl_check(e_tk2_class* i_this, f32 i_limit, s16 i_max_diff) { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + + if (i_this->mPlayerDistanceLimit < i_limit) { + s16 diff = i_this->shape_angle.y - i_this->mPlayerAngleY; + if (diff < i_max_diff && diff > (s16)-i_max_diff && !other_bg_check(i_this, player)) { + return 1; + } + } + + return 0; } /* 807BA824-807BA940 0003A4 011C+00 1/1 0/0 0/0 .text damage_check__FP11e_tk2_class */ -static void damage_check(e_tk2_class* param_0) { - // NONMATCHING +static void damage_check(e_tk2_class* i_this) { + if (i_this->mInvincibilityTimer == 0) { + i_this->mStts.Move(); + + if (i_this->mSph.ChkTgHit()) { + i_this->mAtInfo.mpCollider = i_this->mSph.GetTgHitObj(); + at_power_check(&i_this->mAtInfo); + + if (i_this->mAtInfo.mpCollider->ChkAtType(AT_TYPE_UNK)) { + i_this->mInvincibilityTimer = 20; + } else { + i_this->mInvincibilityTimer = 10; + } + + if (i_this->mAtInfo.mpCollider->ChkAtType(AT_TYPE_HOOKSHOT)) { + i_this->mAction = ACT_TK2_FIND; + i_this->mMode = MODE_TK2_KYORO2; + i_this->mActionTimer[0] = 50; + } else { + cc_at_check(i_this, &i_this->mAtInfo); + if (i_this->mAtInfo.mHitType == HIT_TYPE_STUN) { + i_this->mAction = ACT_TK2_S_DAMAGE; + } else { + i_this->mAction = ACT_TK2_DAMAGE; + } + i_this->mMode = MODE_TK2_NONE; + } + } + + if (i_this->health <= 1) { + i_this->health = 0; + i_this->mSph.SetTgHitMark(CcG_Tg_UNK_MARK_3); + } + if (i_this->health <= 1) { // Yes, this is a duplicate (??) + i_this->health = 0; + i_this->mSph.SetTgHitMark(CcG_Tg_UNK_MARK_3); + } + } } -/* ############################################################################################## */ -/* 807BBF40-807BBF44 000008 0004+00 2/2 0/0 0/0 .bss None */ -static u8 data_807BBF40[4]; - -/* 807BBF44-807BBF50 00000C 000C+00 1/1 0/0 0/0 .bss @3757 */ -static u8 lit_3757[12]; - -/* 807BBF50-807BBF6C 000018 001C+00 6/6 0/0 0/0 .bss l_HIO */ -static u8 l_HIO[28]; - /* 807BA940-807BA9E8 0004C0 00A8+00 1/1 0/0 0/0 .text e_tk2_wait_0__FP11e_tk2_class */ -static void e_tk2_wait_0(e_tk2_class* param_0) { - // NONMATCHING +static void e_tk2_wait_0(e_tk2_class* i_this) { + i_this->mAttentionOFF = true; + + switch (i_this->mMode) { + case MODE_TK2_NONE: + i_this->mMode = MODE_TK2_APPEAR; + break; + + case MODE_TK2_APPEAR: + if (i_this->mActionTimer[1] == 0 && pl_check(i_this, l_HIO.mPlayerRange2, 0x4000)) { + i_this->mAction = ACT_TK2_FIND; + i_this->mMode = MODE_TK2_NONE; + } + break; + } + + i_this->mSomeAngle = i_this->mPlayerAngleY; + cLib_addCalcAngleS2(&i_this->shape_angle.y, i_this->mSomeAngle, 0x10, 0x400); } -/* ############################################################################################## */ -/* 807BBDC8-807BBDCC 000020 0004+00 0/2 0/0 0/0 .rodata @3938 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3938 = 3.0f; -COMPILER_STRIP_GATE(0x807BBDC8, &lit_3938); -#pragma pop - -/* 807BBDCC-807BBDD0 000024 0004+00 1/6 0/0 0/0 .rodata @3939 */ -SECTION_RODATA static f32 const lit_3939 = 1.0f; -COMPILER_STRIP_GATE(0x807BBDCC, &lit_3939); - /* 807BA9E8-807BACF8 000568 0310+00 2/1 0/0 0/0 .text e_tk2_find__FP11e_tk2_class */ -static void e_tk2_find(e_tk2_class* param_0) { - // NONMATCHING +static void e_tk2_find(e_tk2_class* i_this) { + switch (i_this->mMode) { + case MODE_TK2_NONE: + anm_init(i_this, ANM_TK2_APPEAR, 3.0f, 0x0, 1.0f); + i_this->mMode = MODE_TK2_APPEAR; + break; + + case MODE_TK2_APPEAR: + if (i_this->mpMorf->isStop()) { + anm_init(i_this, ANM_TK2_WAIT01, 3.0f, 0x2, 1.0f); + i_this->mMode = MODE_TK2_ATTACK; + i_this->mActionTimer[0] = cM_rndF(10.0f) + 10.0f; + } + break; + + case MODE_TK2_ATTACK: + if (i_this->mActionTimer[0] == 0) { + i_this->mAction = ACT_TK2_ATTACK; + i_this->mMode = MODE_TK2_NONE; + } + break; + + case MODE_TK2_DAMAGE: + anm_init(i_this, ANM_TK2_HIDE, 3.0f, 0x0, 1.0f); + i_this->mMode = MODE_TK2_HIDE; + break; + + case MODE_TK2_HIDE: + i_this->mAttentionOFF = true; + if (i_this->mpMorf->isStop()) { + i_this->mAction = ACT_TK2_WAIT; + i_this->mMode = MODE_TK2_NONE; + i_this->mActionTimer[1] = cM_rndF(30.0f) + 30.0f; + } + break; + + case MODE_TK2_KYORO2: + anm_init(i_this, ANM_TK2_HIDE, 3.0f, 0x0, 3.0f); + i_this->mMode = MODE_TK2_SWIM; + break; + + case MODE_TK2_SWIM: + i_this->mPlayerAngleY = i_this->mPlayerAngleY + -0x8000; + i_this->mAttentionOFF = true; + if (i_this->mpMorf->isStop()) { + i_this->mAnimSpeed = 4.0f; + anm_init(i_this, ANM_TK2_SWIM, 0.0f, 0x2, i_this->mAnimSpeed); + i_this->mMode = MODE_TK2_WAIT01; + } + break; + + case MODE_TK2_WAIT01: + i_this->mAttentionOFF = true; + cLib_addCalc2(&i_this->mAnimSpeed, 2.0f, 1.0f, 0.15f); + i_this->mpMorf->setPlaySpeed(i_this->mAnimSpeed); + if (i_this->mActionTimer[0] == 0 && + i_this->mPlayerDistanceLimit > l_HIO.mPlayerRange1 * 1.2f) + { + i_this->mMode = MODE_TK2_NONE; + } else { + if (i_this->mActionTimer[1] == 0 && i_this->mAcch.ChkWallHit()) { + i_this->mActionTimer[1] = cM_rndF(10.0f) + 20.0f; + i_this->mSomeAngle = i_this->mPlayerAngleY + (s16)cM_rndFX(8000.0f); + } + } + if (i_this->mActionTimer[1] == 0) { + i_this->mPlayerAngleY = i_this->mPlayerAngleY - 0x8000; + } else { + i_this->mPlayerAngleY = i_this->mSomeAngle; + } + } + + cLib_addCalcAngleS2(&(i_this)->shape_angle.y, i_this->mPlayerAngleY, 4, 0x800); } -/* ############################################################################################## */ -/* 807BBDD0-807BBDD4 000028 0004+00 0/2 0/0 0/0 .rodata @3940 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3940 = 30.0f; -COMPILER_STRIP_GATE(0x807BBDD0, &lit_3940); -#pragma pop - -/* 807BBDD4-807BBDD8 00002C 0004+00 0/0 0/0 0/0 .rodata @3941 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3941 = 4.0f; -COMPILER_STRIP_GATE(0x807BBDD4, &lit_3941); -#pragma pop - -/* 807BBDD8-807BBDDC 000030 0004+00 0/3 0/0 0/0 .rodata @3942 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3942 = 2.0f; -COMPILER_STRIP_GATE(0x807BBDD8, &lit_3942); -#pragma pop - -/* 807BBDDC-807BBDE0 000034 0004+00 0/0 0/0 0/0 .rodata @3943 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3943 = 3.0f / 20.0f; -COMPILER_STRIP_GATE(0x807BBDDC, &lit_3943); -#pragma pop - -/* 807BBDE0-807BBDE4 000038 0004+00 0/0 0/0 0/0 .rodata @3944 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3944 = 6.0f / 5.0f; -COMPILER_STRIP_GATE(0x807BBDE0, &lit_3944); -#pragma pop - -/* 807BBDE4-807BBDE8 00003C 0004+00 0/1 0/0 0/0 .rodata @3945 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3945 = 20.0f; -COMPILER_STRIP_GATE(0x807BBDE4, &lit_3945); -#pragma pop - -/* 807BBDE8-807BBDEC 000040 0004+00 0/0 0/0 0/0 .rodata @3946 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3946 = 8000.0f; -COMPILER_STRIP_GATE(0x807BBDE8, &lit_3946); -#pragma pop - -/* 807BBDEC-807BBDF0 000044 0004+00 0/1 0/0 0/0 .rodata @3988 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3988 = 70.0f; -COMPILER_STRIP_GATE(0x807BBDEC, &lit_3988); -#pragma pop - -/* 807BBDF0-807BBDF4 000048 0004+00 0/2 0/0 0/0 .rodata @3989 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3989 = 50.0f; -COMPILER_STRIP_GATE(0x807BBDF0, &lit_3989); -#pragma pop - /* 807BACF8-807BAED0 000878 01D8+00 1/1 0/0 0/0 .text e_tk2_attack__FP11e_tk2_class */ -static void e_tk2_attack(e_tk2_class* param_0) { - // NONMATCHING +static void e_tk2_attack(e_tk2_class* i_this) { + switch (i_this->mMode) { + case MODE_TK2_NONE: + i_this->mMode = MODE_TK2_APPEAR; + anm_init(i_this, ANM_TK2_ATTACK, 3.0f, 0x00, 1.0f); + break; + + case MODE_TK2_APPEAR: + if ((int)i_this->mpMorf->getFrame() == 0x18) { + i_this->mBallID = + fopAcM_createChild(PROC_E_TK_BALL, fopAcM_GetID(i_this), 1, &i_this->eyePos, + fopAcM_GetRoomNo(i_this), &i_this->shape_angle, 0, -1, 0); + } + if ((int)i_this->mpMorf->getFrame() == 0x1c) { + i_this->mTKBallSpawned = true; + } + if (i_this->mpMorf->isStop()) { + anm_init(i_this, ANM_TK2_WAIT01, 1.0f, 0x02, 1.0f); + i_this->mActionTimer[0] = (short)(int)(cM_rndF(30.0f) + 70.0f); + i_this->mMode = MODE_TK2_ATTACK; + } + break; + + case MODE_TK2_ATTACK: + if (i_this->mActionTimer[0] == 0) { + i_this->mMode = MODE_TK2_NONE; + } else if (!pl_check(i_this, l_HIO.mPlayerRange2 + 50.0f, 0x6000)) { + i_this->mAction = ACT_TK2_FIND; + i_this->mMode = MODE_TK2_DAMAGE; + } + break; + } + + cLib_addCalcAngleS2(&i_this->shape_angle.y, i_this->mPlayerAngleY, 4, 0x800); } /* 807BAED0-807BAF60 000A50 0090+00 1/1 0/0 0/0 .text e_tk2_s_damage__FP11e_tk2_class */ -static void e_tk2_s_damage(e_tk2_class* param_0) { - // NONMATCHING +static void e_tk2_s_damage(e_tk2_class* i_this) { + switch (i_this->mMode) { + case MODE_TK2_NONE: + anm_init(i_this, ANM_TK2_DAMAGE, 2.0f, 0x0, 1.0f); + i_this->mMode = MODE_TK2_APPEAR; + break; + + case MODE_TK2_APPEAR: + if (i_this->mpMorf->getFrame() > 10.0f) { + i_this->mAction = ACT_TK2_FIND; + i_this->mMode = MODE_TK2_DAMAGE; + } + break; + } } /* 807BAF60-807BB028 000AE0 00C8+00 1/1 0/0 0/0 .text e_tk2_damage__FP11e_tk2_class */ -static void e_tk2_damage(e_tk2_class* param_0) { - // NONMATCHING +static void e_tk2_damage(e_tk2_class* i_this) { + i_this->mInvincibilityTimer = 6; + i_this->mAttentionOFF = true; + + switch (i_this->mMode) { + case MODE_TK2_NONE: + anm_init(i_this, ANM_TK2_DAMAGE, 2.0f, 0x0, 1.0f); + i_this->mMode = MODE_TK2_APPEAR; + break; + + case MODE_TK2_APPEAR: + if (i_this->mpMorf->isStop()) { + fopAcM_createDisappear(i_this, &i_this->eyePos, 10, 0, 0x12); + fopAcM_delete(i_this); + } + break; + } } /* 807BB028-807BB128 000BA8 0100+00 1/1 0/0 0/0 .text action__FP11e_tk2_class */ -static void action(e_tk2_class* param_0) { - // NONMATCHING +static void action(e_tk2_class* i_this) { + fopAc_ac_c* actor = i_this; + i_this->mPlayerAngleY = fopAcM_searchPlayerAngleY(actor); + i_this->mPlayerDistanceLimit = fopAcM_searchPlayerDistance(actor); + damage_check(i_this); + + s8 link_search_flag = false; + switch (i_this->mAction) { + case ACT_TK2_WAIT: + e_tk2_wait_0(i_this); + break; + case ACT_TK2_FIND: + e_tk2_find(i_this); + link_search_flag = true; + break; + case ACT_TK2_ATTACK: + e_tk2_attack(i_this); + link_search_flag = true; + break; + case ACT_TK2_S_DAMAGE: + e_tk2_s_damage(i_this); + break; + case ACT_TK2_DAMAGE: + e_tk2_damage(i_this); + break; + } + + if (link_search_flag) { + i_this->mSound.setLinkSearch(true); + } else { + i_this->mSound.setLinkSearch(false); + } } -/* ############################################################################################## */ -/* 807BBDF4-807BBDF8 00004C 0004+00 0/1 0/0 0/0 .rodata @4204 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4204 = 200.0f; -COMPILER_STRIP_GATE(0x807BBDF4, &lit_4204); -#pragma pop - -/* 807BBDF8-807BBDFC 000050 0004+00 0/1 0/0 0/0 .rodata @4205 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4205 = 6.0f; -COMPILER_STRIP_GATE(0x807BBDF8, &lit_4205); -#pragma pop - -/* 807BBDFC-807BBE00 000054 0004+00 0/1 0/0 0/0 .rodata @4206 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4206 = 12.0f; -COMPILER_STRIP_GATE(0x807BBDFC, &lit_4206); -#pragma pop - -/* 807BBE00-807BBE04 000058 0004+00 0/1 0/0 0/0 .rodata @4207 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4207 = 18.0f; -COMPILER_STRIP_GATE(0x807BBE00, &lit_4207); -#pragma pop - -/* 807BBE04-807BBE08 00005C 0004+00 0/1 0/0 0/0 .rodata @4208 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4208 = 24.0f; -COMPILER_STRIP_GATE(0x807BBE04, &lit_4208); -#pragma pop - -/* 807BBE08-807BBE0C 000060 0004+00 0/1 0/0 0/0 .rodata @4209 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4209 = 5.0f; -COMPILER_STRIP_GATE(0x807BBE08, &lit_4209); -#pragma pop - -/* 807BBE0C-807BBE10 000064 0004+00 0/1 0/0 0/0 .rodata @4210 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4210 = 27.0f; -COMPILER_STRIP_GATE(0x807BBE0C, &lit_4210); -#pragma pop - -/* 807BBE10-807BBE14 000068 0004+00 0/1 0/0 0/0 .rodata @4211 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4211 = 35.0f; -COMPILER_STRIP_GATE(0x807BBE10, &lit_4211); -#pragma pop - /* 807BB128-807BB7E4 000CA8 06BC+00 2/1 0/0 0/0 .text daE_TK2_Execute__FP11e_tk2_class */ -static void daE_TK2_Execute(e_tk2_class* param_0) { - // NONMATCHING +static int daE_TK2_Execute(e_tk2_class* i_this) { + cXyz cStack_94; + cXyz cStack_a0; + + if (i_this->mExecuteState == 0x00) { + dBgS_ObjGndChk_Spl ground_check; + cStack_94 = i_this->current.pos; + cStack_94.y += 200.0f; + ground_check.SetPos(&cStack_94); + i_this->current.pos.y = dComIfG_Bgsp().GroundCross(&ground_check) - 10.0f; + } + i_this->mLifetime++; + i_this->mAttentionOFF = false; + + for (int i = 0; i <= 3; i++) { + if (i_this->mActionTimer[i] != 0) { + i_this->mActionTimer[i]--; + } + } + + if (i_this->mInvincibilityTimer != 0) { + i_this->mInvincibilityTimer--; + } + + action(i_this); + i_this->mAcch.CrrPos(dComIfG_Bgsp()); + mDoMtx_stack_c::transS(i_this->current.pos.x, i_this->current.pos.y, i_this->current.pos.z); + mDoMtx_stack_c::YrotM(i_this->shape_angle.y); + mDoMtx_stack_c::scaleM(l_HIO.mRadiusScale, l_HIO.mRadiusScale, l_HIO.mRadiusScale); + + J3DModel* model = i_this->mpMorf->getModel(); + model->setBaseTRMtx(mDoMtx_stack_c::get()); + + i_this->mpMorf->play(0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + + if (i_this->mAnim == ANM_TK2_SWIM) { + if (i_this->mpMorf->checkFrame(0.0f) || i_this->mpMorf->checkFrame(6.0f) || + i_this->mpMorf->checkFrame(12.0f) || i_this->mpMorf->checkFrame(18.0f) || + i_this->mpMorf->checkFrame(24.0f)) + { + i_this->mSound.startCreatureSound(Z2SE_EN_TK2_SWIM, 0, -1); + } + } else if (i_this->mAnim == ANM_TK2_APPEAR) { + if (i_this->mpMorf->checkFrame(5.0f)) { + i_this->mSound.startCreatureSound(Z2SE_EN_TK2_APPEAR, 0, -1); + } else if (i_this->mpMorf->checkFrame(20.0f)) { + i_this->mSound.startCreatureSound(Z2SE_EN_TK2_APPEAR2, 0, -1); + } + } else if (i_this->mAnim == ANM_TK2_HIDE) { + if (i_this->mpMorf->checkFrame(6.0f)) { + i_this->mSound.startCreatureSound(Z2SE_EN_TK2_HIDE, 0, -1); + } + } else if (i_this->mAnim == ANM_TK2_ATTACK) { + if (i_this->mpMorf->checkFrame(1.0f)) { + i_this->mSound.startCreatureSound(Z2SE_EN_TK2_V_ATTACK, 0, -1); + } else if (i_this->mpMorf->checkFrame(27.0f)) { + i_this->mSound.startCreatureSound(Z2SE_EN_TK2_ATTACK, 0, -1); + } + } else if (i_this->mAnim == ANM_TK2_DAMAGE) { + if (i_this->mpMorf->checkFrame(1.0f)) { + i_this->mSound.startCreatureVoice(Z2SE_EN_TK2_V_DAMAGE, -1); + } + } else if (i_this->mAnim == ANM_TK2_WAIT01) { + if (i_this->mpMorf->checkFrame(1.0f)) { + i_this->mSound.startCreatureVoice(Z2SE_EN_TK2_V_WAIT, -1); + } + } else if (i_this->mAnim == ANM_TK2_KYORO2 && + (i_this->mpMorf->checkFrame(1.0f) || i_this->mpMorf->checkFrame(30.0f))) + { + i_this->mSound.startCreatureVoice(Z2SE_EN_TK2_KYORO, -1); + } + i_this->mpMorf->modelCalc(); + + MTXCopy(model->getAnmMtx(3), *calc_mtx); + + cStack_94.set(0.0f, 0.0f, 0.0f); + MtxPosition(&cStack_94, &i_this->eyePos); + + i_this->attention_info.position = i_this->eyePos; + i_this->attention_info.position.y = + i_this->attention_info.position.y + l_HIO.mRadiusScale * 35.0f; + + if (i_this->mTKBallSpawned) { + e_tk_ball_class* ball_actor = + static_cast(fopAcM_SearchByID(i_this->mBallID)); + if (ball_actor != NULL) { + ball_actor->current.pos = i_this->eyePos; + ball_actor->field_0x5ac[0x31C] = 0x0; + } + cXyz scale; + scale.setall(2.0f); + dComIfGp_particle_set(0x8198, &i_this->eyePos, &i_this->shape_angle, &scale); + dComIfGp_particle_set(0x8199, &i_this->eyePos, &i_this->shape_angle, &scale); + i_this->mTKBallSpawned = false; + } + + if (i_this->mAttentionOFF) { + fopAcM_OffStatus(i_this, 0); + i_this->attention_info.flags = 0; + } else { + fopAcM_OnStatus(i_this, 0); + i_this->attention_info.flags = 4; + } + + MTXCopy(model->getAnmMtx(2), *calc_mtx); + cStack_94.set(0.0f, 0.0f, 0.0f); + + MtxPosition(&cStack_94, &cStack_a0); + i_this->mSph.SetC(cStack_a0); + i_this->mSph.SetR(50.0f * l_HIO.mRadiusScale); + + dComIfG_Ccsp()->Set(&i_this->mSph); + + return 1; } /* 807BB7E4-807BB7EC 001364 0008+00 1/0 0/0 0/0 .text daE_TK2_IsDelete__FP11e_tk2_class */ -static bool daE_TK2_IsDelete(e_tk2_class* param_0) { - return true; +static int daE_TK2_IsDelete(e_tk2_class* i_this) { + return 1; } /* 807BB7EC-807BB854 00136C 0068+00 1/0 0/0 0/0 .text daE_TK2_Delete__FP11e_tk2_class */ -static void daE_TK2_Delete(e_tk2_class* param_0) { - // NONMATCHING +static int daE_TK2_Delete(e_tk2_class* i_this) { + dComIfG_resDelete(&i_this->mPhaseReq, "E_tk2"); + if (i_this->mInitHIO) { + hioInit = false; + } + if (i_this->heap != NULL) { + i_this->mpMorf->stopZelAnime(); + } + return 1; } /* 807BB854-807BB94C 0013D4 00F8+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* a_this) { + e_tk2_class* i_this = static_cast(a_this); + + i_this->mpMorf = + new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_tk2", 0xE), NULL, NULL, + (J3DAnmTransform*)dComIfG_getObjectRes("E_tk2", 0x9), 2, 1.0f, 0, -1, + &i_this->mSound, 0x80000, 0x11000084); + + if (i_this->mpMorf == NULL || i_this->mpMorf->getModel() == NULL) { + return 0; + } + + return 1; } -/* ############################################################################################## */ -/* 807BBE14-807BBE18 00006C 0004+00 0/1 0/0 0/0 .rodata @4328 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4328 = -100.0f; -COMPILER_STRIP_GATE(0x807BBE14, &lit_4328); -#pragma pop - -/* 807BBE18-807BBE1C 000070 0004+00 0/1 0/0 0/0 .rodata @4329 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4329 = -50.0f; -COMPILER_STRIP_GATE(0x807BBE18, &lit_4329); -#pragma pop - -/* 807BBE1C-807BBE20 000074 0004+00 0/1 0/0 0/0 .rodata @4330 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4330 = 60.0f; -COMPILER_STRIP_GATE(0x807BBE1C, &lit_4330); -#pragma pop +/* 807BBE5C-807BBE9C 000034 0040+00 1/1 0/0 0/0 .data cc_sph_src$4256 */ +static dCcD_SrcSph cc_sph_src = { + { + {0x0, {{0x0, 0x0, 0xd}, {0xd8fbfdff, 0x3}, 0x75}}, // 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}, 40.0f} // mSph + } // mSphAttr +}; /* 807BB94C-807BBC00 0014CC 02B4+00 1/0 0/0 0/0 .text daE_TK2_Create__FP10fopAc_ac_c */ -static void daE_TK2_Create(fopAc_ac_c* param_0) { - // NONMATCHING +static int daE_TK2_Create(fopAc_ac_c* i_this) { + fopAcM_SetupActor(i_this, e_tk2_class); + e_tk2_class* a_this = static_cast(i_this); + + cPhs__Step phase = (cPhs__Step)dComIfG_resLoad(&a_this->mPhaseReq, "E_tk2"); + if (phase == cPhs_COMPLEATE_e) { + a_this->mArg0 = fopAcM_GetParamBit(a_this, 0, 8); + a_this->mArg1 = fopAcM_GetParamBit(a_this, 8, 4); + a_this->mArg2 = fopAcM_GetParamBit(a_this, 12, 4); + + if (!fopAcM_entrySolidHeap(a_this, useHeapInit, 0x23a0)) { + return cPhs_ERROR_e; + } + + if (hioInit == false) { + a_this->mInitHIO = true; + hioInit = true; + l_HIO.field_0x04 = -1; + } + + a_this->attention_info.flags = 4; + + fopAcM_SetMtx(a_this, a_this->mpMorf->getModel()->getBaseTRMtx()); + fopAcM_SetMin(a_this, -100.0f, -100.0f, -100.0f); + fopAcM_SetMax(a_this, 100.0f, 100.0f, 100.0f); + + a_this->attention_info.distances[2] = 0x04; + a_this->health = 0; + a_this->field_0x560 = 0; + + a_this->mStts.Init(100, 0, a_this); + a_this->mSph.Set(cc_sph_src); + a_this->mSph.SetStts(&a_this->mStts); + + a_this->mAcch.Set(&i_this->current.pos, &a_this->old.pos, a_this, 1, &a_this->mAcchCir, + fopAcM_GetSpeed_p(a_this), NULL, NULL); + + a_this->mAcchCir.SetWall(-50.0f, 60.0f); + a_this->mSound.init(&a_this->current.pos, &a_this->eyePos, 0x3, 0x1); + a_this->mSound.setEnemyName("E_tk2"); + a_this->mAtInfo.mpSound = &a_this->mSound; + a_this->mExecuteState = 0x14; + daE_TK2_Execute(a_this); + } + return phase; } -/* 807BBC00-807BBC48 001780 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGSphFv */ -// cM3dGSph::~cM3dGSph() { -extern "C" void __dt__8cM3dGSphFv() { - // NONMATCHING -} +/* 807BBE9C-807BBEBC -00001 0020+00 1/0 0/0 0/0 .data l_daE_TK2_Method */ +static actor_method_class l_daE_TK2_Method = { + (process_method_func)daE_TK2_Create, (process_method_func)daE_TK2_Delete, + (process_method_func)daE_TK2_Execute, (process_method_func)daE_TK2_IsDelete, + (process_method_func)daE_TK2_Draw, +}; -/* 807BBC48-807BBC90 0017C8 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGAabFv */ -// cM3dGAab::~cM3dGAab() { -extern "C" void __dt__8cM3dGAabFv() { - // NONMATCHING -} - -/* 807BBC90-807BBD00 001810 0070+00 3/2 0/0 0/0 .text __dt__12dBgS_ObjAcchFv */ -// dBgS_ObjAcch::~dBgS_ObjAcch() { -extern "C" void __dt__12dBgS_ObjAcchFv() { - // NONMATCHING -} - -/* 807BBD00-807BBD48 001880 0048+00 2/1 0/0 0/0 .text __dt__13daE_TK2_HIO_cFv */ -daE_TK2_HIO_c::~daE_TK2_HIO_c() { - // NONMATCHING -} - -/* 807BBD48-807BBD84 0018C8 003C+00 0/0 1/0 0/0 .text __sinit_d_a_e_tk2_cpp */ -void __sinit_d_a_e_tk2_cpp() { - // NONMATCHING -} - -#pragma push -#pragma force_active on -REGISTER_CTORS(0x807BBD48, __sinit_d_a_e_tk2_cpp); -#pragma pop - -/* 807BBD84-807BBD8C 001904 0008+00 1/0 0/0 0/0 .text @36@__dt__12dBgS_ObjAcchFv */ -static void func_807BBD84() { - // NONMATCHING -} - -/* 807BBD8C-807BBD94 00190C 0008+00 1/0 0/0 0/0 .text @20@__dt__12dBgS_ObjAcchFv */ -static void func_807BBD8C() { - // NONMATCHING -} - -/* 807BBE20-807BBE20 000078 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ +/* 807BBEBC-807BBEEC -00001 0030+00 0/0 0/0 1/0 .data g_profile_E_TK2 */ +extern actor_process_profile_definition g_profile_E_TK2 = { + fpcLy_CURRENT_e, // mLayerID + 7, // mListID + fpcPi_CURRENT_e, // mListPrio + PROC_E_TK2, // mProcName + &g_fpcLf_Method.base, // sub_method + sizeof(e_tk2_class), // mSize + 0, // mSizeOther + 0, // mParameters + &g_fopAc_Method.base, // sub_method + 150, // mPriority + &l_daE_TK2_Method, // sub_method + 0x00040100, // mStatus + fopAc_ENEMY_e, // mActorType + fopAc_CULLBOX_CUSTOM_e, // cullType +};