From 70f0ed7ef7b0226db13ea1b3735d15f0887bb48c Mon Sep 17 00:00:00 2001 From: TakaRikka <38417346+TakaRikka@users.noreply.github.com> Date: Tue, 15 Jul 2025 12:57:21 -0700 Subject: [PATCH] d_a_e_cr / d_a_e_cr_egg done (#2536) * d_a_e_cr_egg done * e_cr done --- configure.py | 4 +- include/d/actor/d_a_e_cr.h | 52 +- include/d/actor/d_a_e_cr_egg.h | 26 +- include/d/actor/d_a_e_ws.h | 2 +- src/d/actor/d_a_e_cr.cpp | 1010 ++++++++++++++++---------------- src/d/actor/d_a_e_cr_egg.cpp | 520 +++++++--------- src/d/actor/d_a_e_ws.cpp | 42 +- 7 files changed, 810 insertions(+), 846 deletions(-) diff --git a/configure.py b/configure.py index 63d7eff0e73..20ef6be770c 100755 --- a/configure.py +++ b/configure.py @@ -1657,8 +1657,8 @@ config.libs = [ ActorRel(NonMatching, "d_a_e_bs"), ActorRel(NonMatching, "d_a_e_bu"), ActorRel(NonMatching, "d_a_e_bug"), - ActorRel(NonMatching, "d_a_e_cr"), - ActorRel(NonMatching, "d_a_e_cr_egg"), + ActorRel(Equivalent, "d_a_e_cr"), # weak func order + ActorRel(MatchingFor("GZ2E01"), "d_a_e_cr_egg"), ActorRel(NonMatching, "d_a_e_db"), ActorRel(MatchingFor("GZ2E01"), "d_a_e_db_leaf"), ActorRel(NonMatching, "d_a_e_dd"), diff --git a/include/d/actor/d_a_e_cr.h b/include/d/actor/d_a_e_cr.h index 106648e1bf0..503e40c6330 100644 --- a/include/d/actor/d_a_e_cr.h +++ b/include/d/actor/d_a_e_cr.h @@ -1,6 +1,10 @@ #ifndef D_A_E_CR_H #define D_A_E_CR_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" /** * @ingroup actors-enemies @@ -10,16 +14,54 @@ * @details * */ -class e_cr_class : public fopEn_enemy_c { -private: - /* 0x5ac */ u8 field_0x5ac[0xa60 - 0x5ac]; +class e_cr_class { +public: + /* 0x000 */ fopEn_enemy_c enemy; + /* 0x5AC */ request_of_phase_process_class phase; + /* 0x5B4 */ u8 field_0x5b4; + /* 0x5B5 */ u8 field_0x5b5; + /* 0x5B8 */ mDoExt_McaMorfSO* modelMorf; + /* 0x5BC */ Z2CreatureEnemy sound; + /* 0x660 */ int anm; + /* 0x664 */ s16 lifetime; + /* 0x666 */ s16 action; + /* 0x668 */ s16 mode; + /* 0x66A */ u8 field_0x66A[0x678 - 0x66A]; + /* 0x678 */ s16 angle_target; + /* 0x67A */ u8 field_0x67A[0x67C - 0x67A]; + /* 0x67C */ s16 angle_to_pl; + /* 0x680 */ f32 dist_to_pl; + /* 0x684 */ s16 timers[4]; + /* 0x68C */ s16 invulnerabilityTimer; + /* 0x68E */ s16 field_0x68e; + /* 0x690 */ s8 field_0x690; + /* 0x692 */ s16 field_0x692; + /* 0x694 */ s16 head_rot; + /* 0x696 */ s16 head_rot_target; + /* 0x698 */ dBgS_AcchCir acchcir; + /* 0x6D8 */ dBgS_ObjAcch acch; + /* 0x8B0 */ dCcD_Stts ccStts; + /* 0x8EC */ dCcD_Sph ccSph; + /* 0xA24 */ dCcU_AtInfo atInfo; + /* 0xA48 */ u32 field_0xa48; + /* 0xA4C */ u32 field_0xa4c; + /* 0xA50 */ u8 field_0xA50[0xA5C - 0xA50]; + /* 0xA5C */ u8 HIOInit; }; STATIC_ASSERT(sizeof(e_cr_class) == 0xa60); -class daE_CR_HIO_c { +class daE_CR_HIO_c : public JORReflexible { +public: /* 8069800C */ daE_CR_HIO_c(); - /* 806997F4 */ ~daE_CR_HIO_c(); + /* 806997F4 */ virtual ~daE_CR_HIO_c() {} + + void genMessage(JORMContext*); + + /* 0x04 */ s8 id; + /* 0x08 */ f32 base_size; + /* 0x0C */ f32 move_speed; + /* 0x10 */ f32 pl_search_range; }; diff --git a/include/d/actor/d_a_e_cr_egg.h b/include/d/actor/d_a_e_cr_egg.h index 6bf9a5178b4..a4e50e16073 100644 --- a/include/d/actor/d_a_e_cr_egg.h +++ b/include/d/actor/d_a_e_cr_egg.h @@ -1,6 +1,10 @@ #ifndef D_A_E_CR_EGG_H #define D_A_E_CR_EGG_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" /** * @ingroup actors-enemies @@ -10,9 +14,25 @@ * @details * */ -class e_cr_egg_class : public fopEn_enemy_c { -private: - /* 0x5ac */ u8 field_0x5ac[0xa0c - 0x5ac]; +class e_cr_egg_class { +public: + /* 0x000 */ fopEn_enemy_c enemy; + /* 0x5AC */ request_of_phase_process_class phase; + /* 0x5B4 */ u8 field_0x5b4; + /* 0x5B5 */ u8 field_0x5b5; + /* 0x5B8 */ J3DModel* model; + /* 0x5BC */ Z2Creature sound; + /* 0x64C */ s16 lifetime; + /* 0x64E */ s16 action; + /* 0x650 */ s16 mode; + /* 0x652 */ s16 timers[2]; + /* 0x656 */ s16 field_0x656; + /* 0x658 */ u8 field_0x658[0x65C - 0x658]; + /* 0x65C */ dBgS_AcchCir acchcir; + /* 0x69C */ dBgS_ObjAcch acch; + /* 0x874 */ dCcD_Stts ccStts; + /* 0x8B0 */ dCcD_Sph ccSph; + /* 0x9E8 */ dCcU_AtInfo atInfo; }; STATIC_ASSERT(sizeof(e_cr_egg_class) == 0xa0c); diff --git a/include/d/actor/d_a_e_ws.h b/include/d/actor/d_a_e_ws.h index 1fc5dd814ba..f3440c2b5e3 100644 --- a/include/d/actor/d_a_e_ws.h +++ b/include/d/actor/d_a_e_ws.h @@ -61,7 +61,7 @@ public: /* 0x684 */ u32 mShadowId; /* 0x688 */ s16 mTargetAngle; /* 0x68A */ s16 mTargetStep; - /* 0x68C */ u8 field_0x68c; + /* 0x68C */ u8 mMoveWaitTimer; /* 0x68E */ s16 mInvulnerabilityTimer; /* 0x690 */ u8 field_0x690; /* 0x691 */ u8 field_0x691; diff --git a/src/d/actor/d_a_e_cr.cpp b/src/d/actor/d_a_e_cr.cpp index 5b32e42241e..71c960027df 100644 --- a/src/d/actor/d_a_e_cr.cpp +++ b/src/d/actor/d_a_e_cr.cpp @@ -5,574 +5,568 @@ #include "d/actor/d_a_e_cr.h" #include "d/d_cc_d.h" -#include "dol2asm.h" + UNK_REL_DATA; #include "f_op/f_op_actor_enemy.h" - -// -// Forward References: -// - -extern "C" void __ct__12daE_CR_HIO_cFv(); -extern "C" static void anm_init__FP10e_cr_classifUcf(); -extern "C" static void nodeCallBack__FP8J3DJointi(); -extern "C" static void daE_CR_Draw__FP10e_cr_class(); -extern "C" static void other_bg_check__FP10e_cr_classP10fopAc_ac_c(); -extern "C" static void pl_check__FP10e_cr_classfs(); -extern "C" static void damage_check__FP10e_cr_class(); -extern "C" static void way_bg_check__FP10e_cr_classf(); -extern "C" static void e_cr_move__FP10e_cr_class(); -extern "C" static void e_cr_s_damage__FP10e_cr_class(); -extern "C" static void e_cr_damage__FP10e_cr_class(); -extern "C" static void action__FP10e_cr_class(); -extern "C" static void daE_CR_Execute__FP10e_cr_class(); -extern "C" static bool daE_CR_IsDelete__FP10e_cr_class(); -extern "C" static void daE_CR_Delete__FP10e_cr_class(); -extern "C" static void useHeapInit__FP10fopAc_ac_c(); -extern "C" static void daE_CR_Create__FP10fopAc_ac_c(); -extern "C" void __dt__8cM3dGSphFv(); -extern "C" void __dt__8cM3dGAabFv(); -extern "C" void __dt__10dCcD_GSttsFv(); -extern "C" void __dt__12dBgS_ObjAcchFv(); -extern "C" void __dt__12dBgS_AcchCirFv(); -extern "C" void __dt__10cCcD_GSttsFv(); -extern "C" void __dt__12daE_CR_HIO_cFv(); -extern "C" void __sinit_d_a_e_cr_cpp(); -extern "C" static void func_80699878(); -extern "C" static void func_80699880(); -extern "C" extern char const* const d_a_e_cr__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 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 fopAcM_delete__FP10fopAc_ac_c(); -extern "C" void fopAcM_create__FsUlPC4cXyziPC5csXyzPC4cXyzSc(); -extern "C" void fopAcM_createChild__FsUiUlPC4cXyziPC5csXyzPC4cXyzScPFPv_i(); -extern "C" void fopAcM_entrySolidHeap__FP10fopAc_ac_cPFP10fopAc_ac_c_iUl(); -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 fopAcM_effSmokeSet1__FPUlPUlPC4cXyzPC5csXyzfPC12dKy_tevstr_ci(); -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_setSimpleShadow__FP4cXyzffR13cBgS_PolyInfosfP9_GXTexObj(); -extern "C" void getRes__14dRes_control_cFPCclP11dRes_info_ci(); -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 LineCross__4cBgSFP11cBgS_LinChk(); -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__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 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 dKy_darkworld_check__Fv(); -extern "C" void Set__4cCcSFP8cCcD_Obj(); -extern "C" void __mi__4cXyzCFRC3Vec(); -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 MtxPosition__FP4cXyzP4cXyz(); -extern "C" void __ct__15Z2CreatureEnemyFv(); -extern "C" void init__15Z2CreatureEnemyFP3VecP3VecUcUc(); -extern "C" void setEnemyName__15Z2CreatureEnemyFPCc(); -extern "C" void* __nw__FUl(); -extern "C" void __dl__FPv(); -extern "C" void checkPass__12J3DFrameCtrlFf(); -extern "C" void _savegpr_19(); -extern "C" void _savegpr_28(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_19(); -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" u8 mSimpleTexObj__21dDlst_shadowControl_c[32]; -extern "C" u8 mCurrentMtx__6J3DSys[48]; -extern "C" u8 m_midnaActor__9daPy_py_c[4]; -extern "C" void __register_global_object(); - -// -// Declarations: -// - -/* ############################################################################################## */ -/* 80699CDC-80699CE0 00002C 0004+00 0/2 0/0 0/0 .rodata @3809 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3809 = 3.0f; -COMPILER_STRIP_GATE(0x80699CDC, &lit_3809); -#pragma pop - -/* 80699CE0-80699CE4 000030 0004+00 1/3 0/0 0/0 .rodata @3810 */ -SECTION_RODATA static f32 const lit_3810 = 40.0f; -COMPILER_STRIP_GATE(0x80699CE0, &lit_3810); - -/* 80699CE4-80699CE8 000034 0004+00 0/1 0/0 0/0 .rodata @3811 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3811 = 400.0f; -COMPILER_STRIP_GATE(0x80699CE4, &lit_3811); -#pragma pop - -/* 80699D84-80699DC4 000038 0040+00 1/1 0/0 0/0 .data cc_sph_src$4251 */ -static dCcD_SrcSph cc_sph_src = { - { - {0x0, {{AT_TYPE_CSTATUE_SWING, 0x1, 0xd}, {0xd8fbfdff, 0x3}, 0x75}}, // mObj - {dCcD_SE_HARD_BODY, 0x0, 0x0, 0x0, 0x0}, // mGObjAt - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg - {0x0}, // mGObjCo - }, // mObjInf - { - {{0.0f, 0.0f, 0.0f}, 40.0f} // mSph - } // mSphAttr -}; - -/* 80699DC4-80699DE4 -00001 0020+00 1/0 0/0 0/0 .data l_daE_CR_Method */ -static actor_method_class l_daE_CR_Method = { - (process_method_func)daE_CR_Create__FP10fopAc_ac_c, - (process_method_func)daE_CR_Delete__FP10e_cr_class, - (process_method_func)daE_CR_Execute__FP10e_cr_class, - (process_method_func)daE_CR_IsDelete__FP10e_cr_class, - (process_method_func)daE_CR_Draw__FP10e_cr_class, -}; - -/* 80699DE4-80699E14 -00001 0030+00 0/0 0/0 1/0 .data g_profile_E_CR */ -extern actor_process_profile_definition g_profile_E_CR = { - fpcLy_CURRENT_e, // mLayerID - 7, // mListID - fpcPi_CURRENT_e, // mListPrio - PROC_E_CR, // mProcName - &g_fpcLf_Method.base, // sub_method - sizeof(e_cr_class), // mSize - 0, // mSizeOther - 0, // mParameters - &g_fopAc_Method.base, // sub_method - 113, // mPriority - &l_daE_CR_Method, // sub_method - 0x10040100, // mStatus - fopAc_ENEMY_e, // mActorType - fopAc_CULLBOX_0_e, // cullType -}; - -/* 80699E14-80699E20 0000C8 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, -}; - -/* 80699E20-80699E2C 0000D4 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, -}; - -/* 80699E2C-80699E38 0000E0 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, -}; - -/* 80699E38-80699E44 0000EC 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, -}; - -/* 80699E44-80699E50 0000F8 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, -}; - -/* 80699E50-80699E74 000104 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_80699880, - (void*)NULL, - (void*)NULL, - (void*)func_80699878, -}; - -/* 80699E74-80699E80 000128 000C+00 2/2 0/0 0/0 .data __vt__12daE_CR_HIO_c */ -SECTION_DATA extern void* __vt__12daE_CR_HIO_c[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12daE_CR_HIO_cFv, +enum daE_CR_ACTION { + ACTION_MOVE, + ACTION_S_DAMAGE = 9, + ACTION_DAMAGE, }; /* 8069800C-80698044 0000EC 0038+00 1/1 0/0 0/0 .text __ct__12daE_CR_HIO_cFv */ daE_CR_HIO_c::daE_CR_HIO_c() { - // NONMATCHING + id = -1; + base_size = 3.0f; + move_speed = 40.0f; + pl_search_range = 400.0f; } -/* ############################################################################################## */ -/* 80699CE8-80699CEC 000038 0004+00 1/1 0/0 0/0 .rodata @3825 */ -SECTION_RODATA static f32 const lit_3825 = -1.0f; -COMPILER_STRIP_GATE(0x80699CE8, &lit_3825); - -/* 80699D40-80699D40 000090 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80699D40 = "E_CR"; -#pragma pop - /* 80698044-806980F0 000124 00AC+00 3/3 0/0 0/0 .text anm_init__FP10e_cr_classifUcf */ -static void anm_init(e_cr_class* param_0, int param_1, f32 param_2, u8 param_3, f32 param_4) { - // NONMATCHING +static void anm_init(e_cr_class* a_this, int i_anm, f32 i_morf, u8 i_mode, f32 i_speed) { + a_this->modelMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("E_CR", i_anm), i_mode, i_morf, i_speed, 0.0f, -1.0f); + a_this->anm = i_anm; } /* 806980F0-806981B4 0001D0 00C4+00 1/1 0/0 0/0 .text nodeCallBack__FP8J3DJointi */ -static void nodeCallBack(J3DJoint* param_0, int param_1) { - // NONMATCHING +static int nodeCallBack(J3DJoint* i_joint, int param_1) { + if (param_1 == 0) { + int jnt_no = i_joint->getJntNo(); + J3DModel* model = j3dSys.getModel(); + e_cr_class* a_this = (e_cr_class*)model->getUserArea(); + if (a_this != NULL) { + if (jnt_no == 2) { + MTXCopy(model->getAnmMtx(jnt_no), *calc_mtx); + cMtx_YrotM(*calc_mtx, a_this->head_rot); + model->setAnmMtx(jnt_no, *calc_mtx); + MTXCopy(*calc_mtx, J3DSys::mCurrentMtx); + } + } + } + + return 1; } /* 806981B4-80698250 000294 009C+00 1/0 0/0 0/0 .text daE_CR_Draw__FP10e_cr_class */ -static void daE_CR_Draw(e_cr_class* param_0) { - // NONMATCHING +static int daE_CR_Draw(e_cr_class* a_this) { + fopAc_ac_c* actor = &a_this->enemy; + + J3DModel* model = a_this->modelMorf->getModel(); + g_env_light.settingTevStruct(0, &actor->current.pos, &actor->tevStr); + g_env_light.setLightTevColorType_MAJI(model, &actor->tevStr); + a_this->modelMorf->entryDL(); + + dComIfGd_setSimpleShadow(&actor->current.pos, a_this->acch.GetGroundH(), 40.0f + TREG_F(11), a_this->acch.m_gnd, 0, 1.0f, dDlst_shadowControl_c::getSimpleTex()); + return 1; } /* 80698250-80698328 000330 00D8+00 1/1 0/0 0/0 .text other_bg_check__FP10e_cr_classP10fopAc_ac_c */ -static void other_bg_check(e_cr_class* param_0, fopAc_ac_c* param_1) { - // NONMATCHING +static BOOL other_bg_check(e_cr_class* a_this, fopAc_ac_c* i_other) { + fopAc_ac_c* actor = &a_this->enemy; + dBgS_LinChk linchk; + cXyz sp28; + cXyz startpos; + cXyz endpos; + + endpos = i_other->current.pos; + endpos.y += 100.0f; + startpos = actor->current.pos; + startpos.y = actor->eyePos.y; + + linchk.Set(&startpos, &endpos, actor); + if (dComIfG_Bgsp().LineCross(&linchk)) { + return TRUE; + } + + return FALSE; } /* 80698328-806983A4 000408 007C+00 1/1 0/0 0/0 .text pl_check__FP10e_cr_classfs */ -static void pl_check(e_cr_class* param_0, f32 param_1, s16 param_2) { - // NONMATCHING +static BOOL pl_check(e_cr_class* a_this, f32 i_range, s16 i_angle) { + fopAc_ac_c* actor = &a_this->enemy; + fopAc_ac_c* player = dComIfGp_getPlayer(0); + + if (a_this->dist_to_pl < i_range) { + s16 angle_diff = actor->shape_angle.y - a_this->angle_to_pl; + if (angle_diff < i_angle && angle_diff > (s16)-i_angle && !other_bg_check(a_this, player)) { + return TRUE; + } + } + + return FALSE; } /* 806983A4-80698498 000484 00F4+00 1/1 0/0 0/0 .text damage_check__FP10e_cr_class */ -static void damage_check(e_cr_class* param_0) { - // NONMATCHING -} +static void damage_check(e_cr_class* a_this) { + fopAc_ac_c* actor = &a_this->enemy; + fopAc_ac_c* player = dComIfGp_getPlayer(0); -/* ############################################################################################## */ -/* 80699CEC-80699CF0 00003C 0004+00 2/4 0/0 0/0 .rodata @3954 */ -SECTION_RODATA static f32 const lit_3954 = 50.0f; -COMPILER_STRIP_GATE(0x80699CEC, &lit_3954); + if (a_this->invulnerabilityTimer == 0) { + a_this->ccStts.Move(); + + if (a_this->ccSph.ChkTgHit()) { + a_this->atInfo.mpCollider = a_this->ccSph.GetTgHitObj(); + cc_at_check(actor, &a_this->atInfo); + + if (a_this->atInfo.mpCollider->ChkAtType(AT_TYPE_WOLF_ATTACK | AT_TYPE_WOLF_CUT_TURN | AT_TYPE_10000000 | AT_TYPE_MIDNA_LOCK)) { + a_this->invulnerabilityTimer = 20; + } else { + a_this->invulnerabilityTimer = 10; + } + + if (a_this->atInfo.mHitType == 16) { + a_this->action = ACTION_S_DAMAGE; + } else { + a_this->action = ACTION_DAMAGE; + a_this->sound.startCreatureVoice(Z2SE_EN_CR_V_DEATH, -1); + } + + actor->current.angle.y = a_this->atInfo.mHitDirection.y; + a_this->mode = 0; + } + + if (actor->health <= 10) { + a_this->ccSph.SetTgHitMark((CcG_Tg_HitMark)3); + } + } +} /* 80698498-806985A4 000578 010C+00 1/1 0/0 0/0 .text way_bg_check__FP10e_cr_classf */ -static void way_bg_check(e_cr_class* param_0, f32 param_1) { - // NONMATCHING +static BOOL way_bg_check(e_cr_class* a_this, f32 param_1) { + fopAc_ac_c* actor = &a_this->enemy; + dBgS_LinChk linchk; + cXyz sp28; + cXyz startpos; + cXyz endpos; + + startpos = actor->current.pos; + startpos.y += 50.0f; + cMtx_YrotS(*calc_mtx, actor->shape_angle.y); + sp28.x = 0.0f; + sp28.y = 50.0f; + sp28.z = param_1; + MtxPosition(&sp28, &endpos); + endpos += actor->current.pos; + + linchk.Set(&startpos, &endpos, actor); + if (dComIfG_Bgsp().LineCross(&linchk)) { + return TRUE; + } + + return FALSE; } -/* ############################################################################################## */ -/* 80699CF0-80699CF4 000040 0004+00 0/2 0/0 0/0 .rodata @4018 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4018 = 30.0f; -COMPILER_STRIP_GATE(0x80699CF0, &lit_4018); -#pragma pop - -/* 80699CF4-80699CF8 000044 0004+00 0/1 0/0 0/0 .rodata @4019 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4019 = 60.0f; -COMPILER_STRIP_GATE(0x80699CF4, &lit_4019); -#pragma pop - -/* 80699CF8-80699CFC 000048 0004+00 0/1 0/0 0/0 .rodata @4020 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4020 = 200.0f; -COMPILER_STRIP_GATE(0x80699CF8, &lit_4020); -#pragma pop - -/* 80699CFC-80699D00 00004C 0004+00 0/2 0/0 0/0 .rodata @4021 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4021 = 20.0f; -COMPILER_STRIP_GATE(0x80699CFC, &lit_4021); -#pragma pop - -/* 80699D00-80699D04 000050 0004+00 0/2 0/0 0/0 .rodata @4022 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4022 = 10.0f; -COMPILER_STRIP_GATE(0x80699D00, &lit_4022); -#pragma pop - -/* 80699D04-80699D08 000054 0004+00 0/1 0/0 0/0 .rodata @4023 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4023 = 30000.0f; -COMPILER_STRIP_GATE(0x80699D04, &lit_4023); -#pragma pop - -/* 80699D08-80699D0C 000058 0004+00 0/4 0/0 0/0 .rodata @4024 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4024 = 5.0f; -COMPILER_STRIP_GATE(0x80699D08, &lit_4024); -#pragma pop - -/* 80699D0C-80699D10 00005C 0004+00 0/1 0/0 0/0 .rodata @4025 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4025 = 15000.0f; -COMPILER_STRIP_GATE(0x80699D0C, &lit_4025); -#pragma pop - -/* 80699D10-80699D14 000060 0004+00 0/3 0/0 0/0 .rodata @4026 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4026 = 0.5f; -COMPILER_STRIP_GATE(0x80699D10, &lit_4026); -#pragma pop - -/* 80699D14-80699D18 000064 0004+00 0/1 0/0 0/0 .rodata @4027 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4027 = 35.0f; -COMPILER_STRIP_GATE(0x80699D14, &lit_4027); -#pragma pop - -/* 80699D18-80699D1C 000068 0004+00 0/2 0/0 0/0 .rodata @4028 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4028 = 15.0f; -COMPILER_STRIP_GATE(0x80699D18, &lit_4028); -#pragma pop - /* 80699E88-80699E8C 000008 0004+00 2/2 0/0 0/0 .bss None */ -static u8 data_80699E88[4]; - -/* 80699E8C-80699E98 00000C 000C+00 1/1 0/0 0/0 .bss @3804 */ -static u8 lit_3804[12]; +static u8 l_HIOInit; /* 80699E98-80699EAC 000018 0014+00 4/4 0/0 0/0 .bss l_HIO */ -static u8 l_HIO[20]; +static daE_CR_HIO_c l_HIO; /* 806985A4-80698A5C 000684 04B8+00 1/1 0/0 0/0 .text e_cr_move__FP10e_cr_class */ -static void e_cr_move(e_cr_class* param_0) { - // NONMATCHING +static void e_cr_move(e_cr_class* a_this) { + fopAc_ac_c* actor = &a_this->enemy; + int anm_frame = a_this->modelMorf->getFrame(); + f32 move_speed_target = 0.0f; + + switch (a_this->mode) { + case 0: + anm_init(a_this, 9, 3.0f, 2, 1.0f); + a_this->timers[0] = 30.0f + cM_rndF(60.0f); + a_this->mode = 1; + break; + case 1: + move_speed_target = l_HIO.move_speed; + + if (a_this->timers[0] == 0 && (anm_frame == 0 || anm_frame == 4)) { + a_this->timers[0] = 50.0f + cM_rndF(100.0f); + a_this->mode = 2; + a_this->modelMorf->setPlaySpeed(0.0f); + } + + if (a_this->timers[2] == 0 && way_bg_check(a_this, 200.0f)) { + a_this->timers[2] = 20; + a_this->timers[1] = 20.0f + cM_rndF(10.0f); + a_this->angle_target = actor->current.angle.y + 0x8000; + } + + if (a_this->timers[1] == 0) { + a_this->angle_target = actor->current.angle.y + (s16)cM_rndFX(30000.0f); + a_this->timers[1] = 10.0f + cM_rndF(5.0f); + } + break; + case 2: + a_this->field_0x690 = 1; + if (a_this->timers[0] == 0) { + a_this->modelMorf->setPlaySpeed(1.0f); + a_this->timers[0] = 30.0f + cM_rndF(60.0f); + a_this->mode = 1; + } + break; + case 3: + move_speed_target = l_HIO.move_speed; + + if (a_this->timers[0] == 0 && (anm_frame == 0 || anm_frame == 4)) { + a_this->timers[0] = 50.0f + cM_rndF(100.0f); + a_this->mode = 2; + a_this->modelMorf->setPlaySpeed(0.0f); + } + + if (a_this->timers[1] == 0) { + if (way_bg_check(a_this, 200.0f)) { + a_this->angle_target = fopAcM_searchPlayerAngleY(actor) + (s16)cM_rndFX(15000.0f); + } else { + a_this->angle_target = (fopAcM_searchPlayerAngleY(actor) + 0x10000 + (s16)cM_rndFX(15000.0f)) - 0x8000; + } + + a_this->timers[1] = 10.0f + cM_rndF(5.0f); + } + + if (a_this->timers[3] != 0 && ((a_this->lifetime & 3) == 0) && cM_rndF(1.0f) < 0.5f) { + cXyz egg_pos(actor->current.pos); + egg_pos.y += 35.0f * l_HIO.base_size; + + fopAcM_createChild(PROC_E_CR_EGG, fopAcM_GetID(actor), 0, &egg_pos, fopAcM_GetRoomNo(actor), &actor->shape_angle, NULL, -1, NULL); + a_this->sound.startCreatureSound(Z2SE_EN_CR_LAYEGG, 0, -1); + } + break; + } + + cLib_addCalcAngleS2(&actor->current.angle.y, a_this->angle_target, 4, 0x1800); + cLib_addCalc2(&actor->speedF, move_speed_target, 1.0f, 0.5f * l_HIO.move_speed); + cLib_addCalcAngleS2(&actor->shape_angle.y, actor->current.angle.y, 4, 0x2000); + + if (a_this->mode < 3 && pl_check(a_this, l_HIO.pl_search_range, 0x7FFF)) { + a_this->mode = 3; + anm_init(a_this, 9, 3.0f, 2, 1.0f); + a_this->timers[0] = 20.0f + cM_rndF(15.0f); + a_this->timers[3] = 15; + } } -/* ############################################################################################## */ -/* 80699D1C-80699D20 00006C 0004+00 0/2 0/0 0/0 .rodata @4051 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4051 = 2.0f; -COMPILER_STRIP_GATE(0x80699D1C, &lit_4051); -#pragma pop - -/* 80699D20-80699D24 000070 0004+00 0/1 0/0 0/0 .rodata @4052 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4052 = -25.0f; -COMPILER_STRIP_GATE(0x80699D20, &lit_4052); -#pragma pop - -/* 80699D24-80699D28 000074 0004+00 0/1 0/0 0/0 .rodata @4053 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4053 = 4.0f; -COMPILER_STRIP_GATE(0x80699D24, &lit_4053); -#pragma pop - /* 80698A5C-80698B80 000B3C 0124+00 1/1 0/0 0/0 .text e_cr_s_damage__FP10e_cr_class */ -static void e_cr_s_damage(e_cr_class* param_0) { - // NONMATCHING +static void e_cr_s_damage(e_cr_class* a_this) { + fopAc_ac_c* actor = &a_this->enemy; + + switch (a_this->mode) { + case 0: + anm_init(a_this, 4, 2.0f, 0, 1.0f); + a_this->mode = 1; + actor->speedF = -25.0f; + break; + case 1: + if (a_this->modelMorf->isStop()) { + anm_init(a_this, 5, 1.0f, 2, 1.0f); + a_this->timers[0] = 50.0f + cM_rndF(30.0f); + a_this->mode = 2; + } + break; + case 2: + if (a_this->timers[0] == 0) { + a_this->action = ACTION_MOVE; + a_this->mode = 0; + } + break; + } + + cLib_addCalc0(&actor->speedF, 1.0f, 4.0f); } -/* ############################################################################################## */ -/* 80699D28-80699D2C 000078 0004+00 0/1 0/0 0/0 .rodata @4074 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4074 = 38.0f; -COMPILER_STRIP_GATE(0x80699D28, &lit_4074); -#pragma pop - -/* 80699D2C-80699D30 00007C 0004+00 0/1 0/0 0/0 .rodata @4075 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4075 = 8.0f; -COMPILER_STRIP_GATE(0x80699D2C, &lit_4075); -#pragma pop - -/* 80699D30-80699D34 000080 0004+00 0/1 0/0 0/0 .rodata @4076 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4076 = -30.0f; -COMPILER_STRIP_GATE(0x80699D30, &lit_4076); -#pragma pop - -/* 80699D34-80699D38 000084 0004+00 0/1 0/0 0/0 .rodata @4077 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4077 = 1000.0f; -COMPILER_STRIP_GATE(0x80699D34, &lit_4077); -#pragma pop - -/* 80699D38-80699D3C 000088 0004+00 0/1 0/0 0/0 .rodata @4078 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4078 = 25.0f; -COMPILER_STRIP_GATE(0x80699D38, &lit_4078); -#pragma pop - /* 80698B80-80698D6C 000C60 01EC+00 1/1 0/0 0/0 .text e_cr_damage__FP10e_cr_class */ -static void e_cr_damage(e_cr_class* param_0) { - // NONMATCHING +static void e_cr_damage(e_cr_class* a_this) { + fopAc_ac_c* actor = &a_this->enemy; + + a_this->invulnerabilityTimer = 6; + + switch (a_this->mode) { + case 0: + anm_init(a_this, 6, 2.0f, 2, 1.0f); + a_this->mode = 1; + actor->speed.y = 38.0f + cM_rndF(8.0f); + actor->speedF = -30.0f; + a_this->field_0x68e = cM_rndFX(1000.0f); + break; + case 1: + if (a_this->acch.ChkGroundHit()) { + actor->speed.y = 25.0f; + actor->speedF *= 0.5f; + + if (cM_rndF(1.0f) < 0.5f) { + anm_init(a_this, 7, 15.0f, 0, 1.0f); + } else { + anm_init(a_this, 8, 15.0f, 0, 1.0f); + } + + a_this->mode = 2; + a_this->timers[0] = 40; + fopAcM_effSmokeSet2(&a_this->field_0xa48, &a_this->field_0xa4c, &actor->current.pos, &actor->shape_angle, 1.0f + NREG_F(18), &actor->tevStr); + } + break; + case 2: + if (a_this->acch.ChkGroundHit()) { + cLib_addCalc0(&actor->speedF, 1.0f, 5.0f); + cLib_addCalcAngleS2(&a_this->field_0x68e, 0, 1, 100); + + if (a_this->timers[0] == 0) { + fopAcM_createDisappear(actor, &actor->eyePos, 6, 0, 0xFF); + fopAcM_create(PROC_NPC_WORM, 0xFFFFFF01, &actor->eyePos, fopAcM_GetRoomNo(actor), NULL, NULL, -1); + fopAcM_delete(actor); + } + } + break; + } + + actor->shape_angle.y += a_this->field_0x68e; } -/* ############################################################################################## */ -/* 80699D3C-80699D40 00008C 0004+00 0/1 0/0 0/0 .rodata @4124 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4124 = 7.0f; -COMPILER_STRIP_GATE(0x80699D3C, &lit_4124); -#pragma pop - /* 80698D6C-80698F88 000E4C 021C+00 1/1 0/0 0/0 .text action__FP10e_cr_class */ -static void action(e_cr_class* param_0) { - // NONMATCHING +static void action(e_cr_class* a_this) { + fopEn_enemy_c* actor = &a_this->enemy; + cXyz mae; + cXyz ato; + + a_this->angle_to_pl = fopAcM_searchPlayerAngleY(actor); + a_this->dist_to_pl = fopAcM_searchPlayerDistance(actor); + + damage_check(a_this); + + a_this->ccSph.OffAtVsPlayerBit(); + BOOL attn_ON = TRUE; + + switch (a_this->action) { + case ACTION_MOVE: + e_cr_move(a_this); + a_this->ccSph.OnAtVsPlayerBit(); + break; + case ACTION_S_DAMAGE: + e_cr_s_damage(a_this); + break; + case ACTION_DAMAGE: + e_cr_damage(a_this); + attn_ON = FALSE; + break; + } + + if (attn_ON) { + fopAcM_OnStatus(actor, 0); + actor->attention_info.flags = 4; + } else { + fopAcM_OffStatus(actor, 0); + actor->attention_info.flags = 0; + } + + cMtx_YrotS(*calc_mtx, actor->current.angle.y); + mae.x = 0.0f; + mae.y = 0.0f; + mae.z = actor->speedF; + MtxPosition(&mae, &ato); + actor->speed.x = ato.x; + actor->speed.z = ato.z; + actor->current.pos += actor->speed; + actor->speed.y -= 5.0f; + + a_this->acch.CrrPos(dComIfG_Bgsp()); + + if (a_this->field_0x690 != 0) { + if (a_this->field_0x692 == 0) { + if (a_this->head_rot_target >= 0) { + a_this->head_rot_target = -5500; + } else { + a_this->head_rot_target = 5500; + } + a_this->field_0x692 = 7.0f + cM_rndF(10.0f); + } else { + a_this->field_0x692--; + } + a_this->field_0x690 = 0; + } else { + a_this->head_rot_target = 0; + } + + cLib_addCalcAngleS2(&a_this->head_rot, a_this->head_rot_target, 2, 0x1000); + + cXyz effsize(0.5f, 0.5f, 0.5f); + setMidnaBindEffect(actor, &a_this->sound, &actor->eyePos, &effsize); } /* 80698F88-806991BC 001068 0234+00 2/1 0/0 0/0 .text daE_CR_Execute__FP10e_cr_class */ -static void daE_CR_Execute(e_cr_class* param_0) { - // NONMATCHING +static int daE_CR_Execute(e_cr_class* a_this) { + fopEn_enemy_c* actor = &a_this->enemy; + cXyz sp18; + cXyz spC; + + a_this->lifetime++; + + for (int i = 0; i < 4; i++) { + if (a_this->timers[i] != 0) { + a_this->timers[i]--; + } + } + + if (a_this->invulnerabilityTimer != 0) { + a_this->invulnerabilityTimer--; + } + + action(a_this); + + mDoMtx_stack_c::transS(actor->current.pos.x, actor->current.pos.y, actor->current.pos.z); + mDoMtx_stack_c::YrotM(actor->shape_angle.y); + mDoMtx_stack_c::XrotM(actor->shape_angle.x); + mDoMtx_stack_c::scaleM(l_HIO.base_size, l_HIO.base_size, l_HIO.base_size); + + J3DModel* model = a_this->modelMorf->getModel(); + model->setBaseTRMtx(mDoMtx_stack_c::get()); + + a_this->modelMorf->play(0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + + if (a_this->anm == 9 && (a_this->modelMorf->checkFrame(1.0f) || a_this->modelMorf->checkFrame(5.0f))) { + a_this->sound.startCreatureSound(Z2SE_EN_CR_FOOTNOTE, 0, -1); + } + + a_this->modelMorf->modelCalc(); + + MTXCopy(model->getAnmMtx(1), *calc_mtx); + sp18.set(0.0f, 0.0f, 0.0f); + MtxPosition(&sp18, &actor->eyePos); + actor->attention_info.position = actor->eyePos; + actor->attention_info.position.y += 40.0f; + + sp18.set(0.0f, 0.0f, 0.0f); + MtxPosition(&sp18, &spC); + a_this->ccSph.SetC(spC); + a_this->ccSph.SetR((20.0f + JREG_F(3)) * l_HIO.base_size); + dComIfG_Ccsp()->Set(&a_this->ccSph); + return 1; } /* 806991BC-806991C4 00129C 0008+00 1/0 0/0 0/0 .text daE_CR_IsDelete__FP10e_cr_class */ -static bool daE_CR_IsDelete(e_cr_class* param_0) { - return true; +static int daE_CR_IsDelete(e_cr_class* a_this) { + return 1; } /* 806991C4-8069922C 0012A4 0068+00 1/0 0/0 0/0 .text daE_CR_Delete__FP10e_cr_class */ -static void daE_CR_Delete(e_cr_class* param_0) { - // NONMATCHING +static int daE_CR_Delete(e_cr_class* a_this) { + fopEn_enemy_c* actor = &a_this->enemy; + fpc_ProcID id = fopAcM_GetID(a_this); + dComIfG_resDelete(&a_this->phase, "E_CR"); + + if (a_this->HIOInit) { + l_HIOInit = FALSE; + mDoHIO_DELETE_CHILD(l_HIO.id); + } + + if (actor->heap != NULL) { + a_this->modelMorf->stopZelAnime(); + } + + return 1; } /* 8069922C-8069936C 00130C 0140+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) { + e_cr_class* a_this = (e_cr_class*)i_this; -/* ############################################################################################## */ -/* 80699D40-80699D40 000090 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80699D45 = "E_cr"; -#pragma pop + a_this->modelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_CR", 0xD), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_CR", 9), 2, 1.0f, 0, -1, &a_this->sound, 0x80000, 0x11000084); + if (a_this->modelMorf == NULL || a_this->modelMorf->getModel() == NULL) { + return 0; + } + + J3DModel* model = a_this->modelMorf->getModel(); + model->setUserArea((u32)a_this); + + for (u16 i = 0; i < model->getModelData()->getJointNum(); i++) { + if (i == 2) { + model->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack); + } + } + + return 1; +} /* 8069936C-806995E0 00144C 0274+00 1/0 0/0 0/0 .text daE_CR_Create__FP10fopAc_ac_c */ -static void daE_CR_Create(fopAc_ac_c* param_0) { - // NONMATCHING +static int daE_CR_Create(fopAc_ac_c* i_this) { + e_cr_class* a_this = (e_cr_class*)i_this; + fopAcM_SetupActor(i_this, e_cr_class); + + int phase_state = dComIfG_resLoad(&a_this->phase, "E_CR"); + if (phase_state == cPhs_COMPLEATE_e) { + OS_REPORT("E_CR PARAM %x\n", fopAcM_GetParam(a_this)); + a_this->field_0x5b4 = fopAcM_GetParam(i_this); + a_this->field_0x5b5 = (fopAcM_GetParam(i_this) & 0xF00) >> 8; + + OS_REPORT("E_CR//////////////E_CR SET 1 !!\n"); + if (!fopAcM_entrySolidHeap(i_this, useHeapInit, 0x1340)) { + OS_REPORT("//////////////E_CR SET NON !!\n"); + return cPhs_ERROR_e; + } + + OS_REPORT("//////////////E_CR SET 2 !!\n"); + if (!l_HIOInit) { + a_this->HIOInit = TRUE; + l_HIOInit = TRUE; + l_HIO.id = mDoHIO_CREATE_CHILD("クレイジーランナー", &l_HIO); + } + + i_this->attention_info.flags = 4; + fopAcM_SetMtx(i_this, a_this->modelMorf->getModel()->getBaseTRMtx()); + + i_this->health = 1; + i_this->field_0x560 = 1; + + static dCcD_SrcSph cc_sph_src = { + { + {0x0, {{AT_TYPE_CSTATUE_SWING, 0x1, 0xd}, {0xd8fbfdff, 0x3}, 0x75}}, // mObj + {dCcD_SE_HARD_BODY, 0x0, 0x0, 0x0, 0x0}, // mGObjAt + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg + {0x0}, // mGObjCo + }, // mObjInf + { + {{0.0f, 0.0f, 0.0f}, 40.0f} // mSph + } // mSphAttr + }; + + a_this->ccStts.Init(100, 0, i_this); + a_this->ccSph.Set(cc_sph_src); + a_this->ccSph.SetStts(&a_this->ccStts); + + a_this->acch.Set(fopAcM_GetPosition_p(i_this), fopAcM_GetOldPosition_p(i_this), i_this, 1, &a_this->acchcir, fopAcM_GetSpeed_p(i_this), NULL, NULL); + a_this->acchcir.SetWall(50.0f, 50.0f); + + a_this->sound.init(&i_this->current.pos, &i_this->eyePos, 3, 1); + a_this->atInfo.mpSound = &a_this->sound; + a_this->atInfo.mPowerType = 1; + a_this->sound.setEnemyName("E_cr"); + + daE_CR_Execute(a_this); + } + + return phase_state; } -/* 806995E0-80699628 0016C0 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGSphFv */ -// cM3dGSph::~cM3dGSph() { -extern "C" void __dt__8cM3dGSphFv() { - // NONMATCHING -} +/* 80699DC4-80699DE4 -00001 0020+00 1/0 0/0 0/0 .data l_daE_CR_Method */ +static actor_method_class l_daE_CR_Method = { + (process_method_func)daE_CR_Create, + (process_method_func)daE_CR_Delete, + (process_method_func)daE_CR_Execute, + (process_method_func)daE_CR_IsDelete, + (process_method_func)daE_CR_Draw, +}; -/* 80699628-80699670 001708 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGAabFv */ -// cM3dGAab::~cM3dGAab() { -extern "C" void __dt__8cM3dGAabFv() { - // NONMATCHING -} - -/* 80699670-806996CC 001750 005C+00 1/0 0/0 0/0 .text __dt__10dCcD_GSttsFv */ -// dCcD_GStts::~dCcD_GStts() { -extern "C" void __dt__10dCcD_GSttsFv() { - // NONMATCHING -} - -/* 806996CC-8069973C 0017AC 0070+00 3/2 0/0 0/0 .text __dt__12dBgS_ObjAcchFv */ -// dBgS_ObjAcch::~dBgS_ObjAcch() { -extern "C" void __dt__12dBgS_ObjAcchFv() { - // NONMATCHING -} - -/* 8069973C-806997AC 00181C 0070+00 1/0 0/0 0/0 .text __dt__12dBgS_AcchCirFv */ -// dBgS_AcchCir::~dBgS_AcchCir() { -extern "C" void __dt__12dBgS_AcchCirFv() { - // NONMATCHING -} - -/* 806997AC-806997F4 00188C 0048+00 1/0 0/0 0/0 .text __dt__10cCcD_GSttsFv */ -// cCcD_GStts::~cCcD_GStts() { -extern "C" void __dt__10cCcD_GSttsFv() { - // NONMATCHING -} - -/* 806997F4-8069983C 0018D4 0048+00 2/1 0/0 0/0 .text __dt__12daE_CR_HIO_cFv */ -daE_CR_HIO_c::~daE_CR_HIO_c() { - // NONMATCHING -} - -/* 8069983C-80699878 00191C 003C+00 0/0 1/0 0/0 .text __sinit_d_a_e_cr_cpp */ -void __sinit_d_a_e_cr_cpp() { - // NONMATCHING -} - -#pragma push -#pragma force_active on -REGISTER_CTORS(0x8069983C, __sinit_d_a_e_cr_cpp); -#pragma pop - -/* 80699878-80699880 001958 0008+00 1/0 0/0 0/0 .text @36@__dt__12dBgS_ObjAcchFv */ -static void func_80699878() { - // NONMATCHING -} - -/* 80699880-80699888 001960 0008+00 1/0 0/0 0/0 .text @20@__dt__12dBgS_ObjAcchFv */ -static void func_80699880() { - // NONMATCHING -} - -/* 80699D40-80699D40 000090 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ +/* 80699DE4-80699E14 -00001 0030+00 0/0 0/0 1/0 .data g_profile_E_CR */ +extern actor_process_profile_definition g_profile_E_CR = { + fpcLy_CURRENT_e, // mLayerID + 7, // mListID + fpcPi_CURRENT_e, // mListPrio + PROC_E_CR, // mProcName + &g_fpcLf_Method.base, // sub_method + sizeof(e_cr_class), // mSize + 0, // mSizeOther + 0, // mParameters + &g_fopAc_Method.base, // sub_method + 113, // mPriority + &l_daE_CR_Method, // sub_method + 0x10040100, // mStatus + fopAc_ENEMY_e, // mActorType + fopAc_CULLBOX_0_e, // cullType +}; diff --git a/src/d/actor/d_a_e_cr_egg.cpp b/src/d/actor/d_a_e_cr_egg.cpp index 062e28cb8cb..343ab55ddbe 100644 --- a/src/d/actor/d_a_e_cr_egg.cpp +++ b/src/d/actor/d_a_e_cr_egg.cpp @@ -5,342 +5,248 @@ #include "d/actor/d_a_e_cr_egg.h" #include "d/d_cc_d.h" -#include "dol2asm.h" - - -// -// Forward References: -// - -extern "C" static void daE_CR_EGG_Draw__FP14e_cr_egg_class(); -extern "C" static void e_cr_egg_move__FP14e_cr_egg_class(); -extern "C" static void action__FP14e_cr_egg_class(); -extern "C" static void daE_CR_EGG_Execute__FP14e_cr_egg_class(); -extern "C" static bool daE_CR_EGG_IsDelete__FP14e_cr_egg_class(); -extern "C" static void daE_CR_EGG_Delete__FP14e_cr_egg_class(); -extern "C" static void useHeapInit__FP10fopAc_ac_c(); -extern "C" static void daE_CR_EGG_Create__FP10fopAc_ac_c(); -extern "C" void __dt__8cM3dGSphFv(); -extern "C" void __dt__8cM3dGAabFv(); -extern "C" void __dt__12dBgS_ObjAcchFv(); -extern "C" static void func_8069A8B4(); -extern "C" static void func_8069A8BC(); -extern "C" extern char const* const d_a_e_cr_egg__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 transM__14mDoMtx_stack_cFfff(); -extern "C" void scaleM__14mDoMtx_stack_cFfff(); -extern "C" void mDoExt_modelUpdateDL__FP8J3DModel(); -extern "C" void mDoExt_J3DModel__create__FP12J3DModelDataUlUl(); -extern "C" void __ct__10fopAc_ac_cFv(); -extern "C" void fopAcM_delete__FP10fopAc_ac_c(); -extern "C" void fopAcM_entrySolidHeap__FP10fopAc_ac_cPFP10fopAc_ac_c_iUl(); -extern "C" void dComIfG_resLoad__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfG_resDelete__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfGd_setSimpleShadow__FP4cXyzffR13cBgS_PolyInfosfP9_GXTexObj(); -extern "C" void getRes__14dRes_control_cFPCclP11dRes_info_ci(); -extern "C" void -set__13dPa_control_cFUcUsPC4cXyzPC12dKy_tevstr_cPC5csXyzPC4cXyzUcP18dPa_levelEcallBackScPC8_GXColorPC8_GXColorPC4cXyzf(); -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 Init__9dCcD_SttsFiiP10fopAc_ac_c(); -extern "C" void __ct__12dCcD_GObjInfFv(); -extern "C" void ChkAtHit__12dCcD_GObjInfFv(); -extern "C" void ChkTgHit__12dCcD_GObjInfFv(); -extern "C" void Set__8dCcD_SphFRC11dCcD_SrcSph(); -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 __pl__4cXyzCFRC3Vec(); -extern "C" void cM_rndF__Ff(); -extern "C" void cM_rndFX__Ff(); -extern "C" void SetC__8cM3dGSphFRC4cXyz(); -extern "C" void SetR__8cM3dGSphFf(); -extern "C" void cLib_addCalc0__FPfff(); -extern "C" void MtxPosition__FP4cXyzP4cXyz(); -extern "C" void seStart__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc(); -extern "C" void __ct__10Z2CreatureFv(); -extern "C" void init__10Z2CreatureFP3VecP3VecUcUc(); -extern "C" void stopAnime__10Z2CreatureFv(); -extern "C" void __dl__FPv(); -extern "C" void _savegpr_29(); -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" u8 mSimpleTexObj__21dDlst_shadowControl_c[32]; -extern "C" extern void* calc_mtx[1 + 1 /* padding */]; -extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */]; - -// -// Declarations: -// - -/* ############################################################################################## */ -/* 8069A8CC-8069A8D0 000000 0004+00 4/4 0/0 0/0 .rodata @3657 */ -SECTION_RODATA static f32 const lit_3657 = 30.0f; -COMPILER_STRIP_GATE(0x8069A8CC, &lit_3657); - -/* 8069A8D0-8069A8D4 000004 0004+00 1/3 0/0 0/0 .rodata @3658 */ -SECTION_RODATA static f32 const lit_3658 = 1.0f; -COMPILER_STRIP_GATE(0x8069A8D0, &lit_3658); +#include "d/d_com_inf_game.h" +#include "d/d_s_play.h" /* 80699F38-80699FC8 000078 0090+00 1/0 0/0 0/0 .text daE_CR_EGG_Draw__FP14e_cr_egg_class */ -static void daE_CR_EGG_Draw(e_cr_egg_class* param_0) { - // NONMATCHING +static int daE_CR_EGG_Draw(e_cr_egg_class* a_this) { + fopAc_ac_c* actor = &a_this->enemy; + + g_env_light.settingTevStruct(0, &actor->current.pos, &actor->tevStr); + g_env_light.setLightTevColorType_MAJI(a_this->model, &actor->tevStr); + mDoExt_modelUpdateDL(a_this->model); + + dComIfGd_setSimpleShadow(&actor->current.pos, a_this->acch.GetGroundH(), 30.0f + TREG_F(10), a_this->acch.m_gnd, 0, 1.0f, dDlst_shadowControl_c::getSimpleTex()); + return 1; } -/* ############################################################################################## */ -/* 8069A8D4-8069A8E0 000008 000C+00 0/1 0/0 0/0 .rodata @3676 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3676[12] = { - 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x0A, -}; -COMPILER_STRIP_GATE(0x8069A8D4, &lit_3676); -#pragma pop - -/* 8069A8E0-8069A8E4 000014 0004+00 0/1 0/0 0/0 .rodata @3702 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3702 = 5.0f; -COMPILER_STRIP_GATE(0x8069A8E0, &lit_3702); -#pragma pop - -/* 8069A8E4-8069A8E8 000018 0004+00 0/2 0/0 0/0 .rodata @3703 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3703 = 3.0f; -COMPILER_STRIP_GATE(0x8069A8E4, &lit_3703); -#pragma pop - -/* 8069A8E8-8069A8EC 00001C 0004+00 0/1 0/0 0/0 .rodata @3704 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3704 = 10000.0f; -COMPILER_STRIP_GATE(0x8069A8E8, &lit_3704); -#pragma pop - -/* 8069A8EC-8069A8F0 000020 0004+00 0/1 0/0 0/0 .rodata @3705 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3705 = -0.5f; -COMPILER_STRIP_GATE(0x8069A8EC, &lit_3705); -#pragma pop - -/* 8069A8F0-8069A8F4 000024 0004+00 0/1 0/0 0/0 .rodata @3706 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3706 = 8000.0f; -COMPILER_STRIP_GATE(0x8069A8F0, &lit_3706); -#pragma pop - -/* 8069A8F4-8069A8F8 000028 0004+00 0/1 0/0 0/0 .rodata @3707 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3707 = -1.0f; -COMPILER_STRIP_GATE(0x8069A8F4, &lit_3707); -#pragma pop - -/* 8069A8F8-8069A8FC 00002C 0004+00 0/1 0/0 0/0 .rodata @3708 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3708 = 0.5f; -COMPILER_STRIP_GATE(0x8069A8F8, &lit_3708); -#pragma pop - -/* 8069A914-8069A920 000000 000C+00 1/1 0/0 0/0 .data spy$3662 */ -SECTION_DATA static u8 spy[12] = { - 0x41, 0x88, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x40, 0xA0, 0x00, 0x00, -}; - /* 80699FC8-8069A258 000108 0290+00 1/1 0/0 0/0 .text e_cr_egg_move__FP14e_cr_egg_class */ -static void e_cr_egg_move(e_cr_egg_class* param_0) { - // NONMATCHING +static void e_cr_egg_move(e_cr_egg_class* a_this) { + fopAc_ac_c* actor = &a_this->enemy; + + switch (a_this->mode) { + case 0: + a_this->mode = 1; + a_this->timers[0] = 150; + actor->speedF = 5.0f + cM_rndF(3.0f); + actor->current.angle.y += (int)cM_rndFX(10000.0f); + case 1: + case 2: + case 3: + case 4: + if (a_this->acch.ChkWallHit() && a_this->timers[1] == 0) { + a_this->timers[1] = 10; + actor->speedF *= -0.5f; + } + + if (a_this->acch.ChkGroundHit()) { + if (a_this->mode < 4) { + static f32 spy[] = {17.0f, 8.0f, 5.0f}; + actor->speed.y = spy[a_this->mode - 1]; + actor->current.angle.y += (int)cM_rndFX(8000.0f); + + int sp28[3] = {40, 20, 10}; + Z2GetAudioMgr()->seStart(Z2SE_EN_CR_EGG_BOUND, &actor->current.pos, sp28[a_this->mode], 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); + a_this->mode++; + } + + cLib_addCalc0(&actor->speedF, 1.0f, 0.5f + TREG_F(4)); + } + + if (a_this->timers[0] == 0 || a_this->ccSph.ChkTgHit() || a_this->ccSph.ChkAtHit()) { + fopAcM_delete(actor); + + cXyz effscale(0.5f, 0.5f, 0.5f); + u16 eff_id = 0x109; + if (a_this->timers[0] == 0) { + eff_id = 0x108; + } + cXyz effpos(actor->current.pos); + dComIfGp_particle_set(eff_id, &effpos, NULL, &effscale); + Z2GetAudioMgr()->seStart(Z2SE_EN_CR_EGG_BOMB, &actor->current.pos, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); + } + } } -/* ############################################################################################## */ -/* 8069A8FC-8069A900 000030 0004+00 0/1 0/0 0/0 .rodata @3728 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3728 = 700.0f; -COMPILER_STRIP_GATE(0x8069A8FC, &lit_3728); -#pragma pop - -/* 8069A900-8069A904 000034 0004+00 0/2 0/0 0/0 .rodata @3729 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3729[4] = { - 0x00, - 0x00, - 0x00, - 0x00, -}; -COMPILER_STRIP_GATE(0x8069A900, &lit_3729); -#pragma pop - -/* 8069A904-8069A908 000038 0004+00 1/3 0/0 0/0 .rodata @3730 */ -SECTION_RODATA static f32 const lit_3730 = 20.0f; -COMPILER_STRIP_GATE(0x8069A904, &lit_3730); - /* 8069A258-8069A378 000398 0120+00 1/1 0/0 0/0 .text action__FP14e_cr_egg_class */ -static void action(e_cr_egg_class* param_0) { - // NONMATCHING +static void action(e_cr_egg_class* a_this) { + fopAc_ac_c* actor = &a_this->enemy; + cXyz mae; + cXyz ato; + + switch (a_this->action) { + case 0: + e_cr_egg_move(a_this); + break; + } + + actor->current.angle.x += (int)(actor->speedF * (700.0f + TREG_F(9))); + + cMtx_YrotS(*calc_mtx, actor->current.angle.y); + mae.x = 0.0f; + mae.y = 0.0f; + mae.z = actor->speedF; + MtxPosition(&mae, &ato); + actor->speed.x = ato.x; + actor->speed.z = ato.z; + actor->current.pos += actor->speed; + actor->speed.y -= 3.0f; + + actor->current.pos.y -= 20.0f; + actor->old.pos.y -= 20.0f; + a_this->acch.CrrPos(dComIfG_Bgsp()); + actor->current.pos.y += 20.0f; + actor->old.pos.y += 20.0f; } -/* ############################################################################################## */ -/* 8069A908-8069A90C 00003C 0004+00 0/1 0/0 0/0 .rodata @3770 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3770 = -20.0f; -COMPILER_STRIP_GATE(0x8069A908, &lit_3770); -#pragma pop - /* 8069A378-8069A4C4 0004B8 014C+00 2/1 0/0 0/0 .text daE_CR_EGG_Execute__FP14e_cr_egg_class */ -static void daE_CR_EGG_Execute(e_cr_egg_class* param_0) { - // NONMATCHING +static int daE_CR_EGG_Execute(e_cr_egg_class* a_this) { + fopAc_ac_c* actor = &a_this->enemy; + cXyz sp2C; + cXyz sp20; + + a_this->lifetime++; + + for (int i = 0; i < 2; i++) { + if (a_this->timers[i] != 0) { + a_this->timers[i]--; + } + } + + if (a_this->field_0x656 != 0) { + a_this->field_0x656--; + } + + action(a_this); + + mDoMtx_stack_c::transS(actor->current.pos.x, actor->current.pos.y, actor->current.pos.z); + mDoMtx_stack_c::YrotM(actor->current.angle.y); + mDoMtx_stack_c::XrotM(actor->current.angle.x); + mDoMtx_stack_c::transM(0.0f, TREG_F(12) - 20.0f, 0.0f); + + f32 size = 1.0f + TREG_F(17); + mDoMtx_stack_c::scaleM(size, size, size); + a_this->model->setBaseTRMtx(mDoMtx_stack_c::get()); + + cXyz c_offset(0.0f, 20.0f, 0.0f); + a_this->ccSph.SetC(actor->current.pos + c_offset); + a_this->ccSph.SetR(size * (20.0f + BREG_F(0))); + dComIfG_Ccsp()->Set(&a_this->ccSph); + return 1; } /* 8069A4C4-8069A4CC 000604 0008+00 1/0 0/0 0/0 .text daE_CR_EGG_IsDelete__FP14e_cr_egg_class */ -static bool daE_CR_EGG_IsDelete(e_cr_egg_class* param_0) { - return true; +static int daE_CR_EGG_IsDelete(e_cr_egg_class* a_this) { + return 1; } -/* ############################################################################################## */ -/* 8069A90C-8069A90C 000040 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_8069A90C = "E_CR"; -#pragma pop - /* 8069A4CC-8069A510 00060C 0044+00 1/0 0/0 0/0 .text daE_CR_EGG_Delete__FP14e_cr_egg_class */ -static void daE_CR_EGG_Delete(e_cr_egg_class* param_0) { - // NONMATCHING +static int daE_CR_EGG_Delete(e_cr_egg_class* a_this) { + fopAc_ac_c* actor = &a_this->enemy; + + fpc_ProcID id = fopAcM_GetID(actor); + dComIfG_resDelete(&a_this->phase, "E_CR"); + a_this->sound.stopAnime(); + return 1; } /* 8069A510-8069A57C 000650 006C+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) { + e_cr_egg_class* a_this = (e_cr_egg_class*)i_this; + + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_CR", 0xC); + JUT_ASSERT(374, modelData != 0); + + a_this->model = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); + if (a_this->model == NULL) { + return 0; + } + + return 1; } -/* ############################################################################################## */ -/* 8069A920-8069A960 00000C 0040+00 1/1 0/0 0/0 .data cc_sph_src$3802 */ -static dCcD_SrcSph cc_sph_src = { - { - {0x0, {{AT_TYPE_CSTATUE_SWING, 0x1, 0xd}, {0xd8fbfdff, 0x3}, 0x75}}, // mObj - {dCcD_SE_NONE, 0x1, 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 -}; +/* 8069A57C-8069A7B4 0006BC 0238+00 1/0 0/0 0/0 .text daE_CR_EGG_Create__FP10fopAc_ac_c + */ +static int daE_CR_EGG_Create(fopAc_ac_c* i_this) { + e_cr_egg_class* a_this = (e_cr_egg_class*)i_this; + fopAcM_SetupActor(i_this, e_cr_egg_class); + + int phase_state = dComIfG_resLoad(&a_this->phase, "E_CR"); + if (phase_state == cPhs_COMPLEATE_e) { + OS_REPORT("E_CR_EGG PARAM %x\n", fopAcM_GetParam(i_this)); + + a_this->field_0x5b4 = fopAcM_GetParam(i_this); + if (a_this->field_0x5b4 == 0xFF) { + a_this->field_0x5b4 = 0; + } + + a_this->field_0x5b5 = (fopAcM_GetParam(i_this) & 0xFF00) >> 8; + if (a_this->field_0x5b5 == 0xFF) { + a_this->field_0x5b5 = 0; + } + + OS_REPORT("E_CR_EGG//////////////E_CR_EGG SET 1 !!\n"); + if (!fopAcM_entrySolidHeap(i_this, useHeapInit, 0x820)) { + OS_REPORT("//////////////E_CR_EGG SET NON !!\n"); + return cPhs_ERROR_e; + } + + OS_REPORT("//////////////E_CR_EGG SET 2 !!\n"); + + fopAcM_SetMtx(i_this, a_this->model->getBaseTRMtx()); + + static dCcD_SrcSph cc_sph_src = { + { + {0x0, {{AT_TYPE_CSTATUE_SWING, 0x1, 0xd}, {0xd8fbfdff, 0x3}, 0x75}}, // mObj + {dCcD_SE_NONE, 0x1, 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 + }; + + a_this->ccStts.Init(50, 0, i_this); + a_this->ccSph.Set(cc_sph_src); + a_this->ccSph.SetStts(&a_this->ccStts); + + a_this->sound.init(&i_this->current.pos, NULL, 3, 1); + + a_this->acch.Set(fopAcM_GetPosition_p(i_this), fopAcM_GetOldPosition_p(i_this), i_this, 1, &a_this->acchcir, fopAcM_GetSpeed_p(i_this), NULL, NULL); + a_this->acchcir.SetWall(20.0f, 20.0f); + + daE_CR_EGG_Execute(a_this); + } + + return phase_state; +} /* 8069A960-8069A980 -00001 0020+00 1/0 0/0 0/0 .data l_daE_CR_EGG_Method */ static actor_method_class l_daE_CR_EGG_Method = { - (process_method_func)daE_CR_EGG_Create__FP10fopAc_ac_c, - (process_method_func)daE_CR_EGG_Delete__FP14e_cr_egg_class, - (process_method_func)daE_CR_EGG_Execute__FP14e_cr_egg_class, - (process_method_func)daE_CR_EGG_IsDelete__FP14e_cr_egg_class, - (process_method_func)daE_CR_EGG_Draw__FP14e_cr_egg_class, + (process_method_func)daE_CR_EGG_Create, + (process_method_func)daE_CR_EGG_Delete, + (process_method_func)daE_CR_EGG_Execute, + (process_method_func)daE_CR_EGG_IsDelete, + (process_method_func)daE_CR_EGG_Draw, }; /* 8069A980-8069A9B0 -00001 0030+00 0/0 0/0 1/0 .data g_profile_E_CR_EGG */ extern actor_process_profile_definition g_profile_E_CR_EGG = { - fpcLy_CURRENT_e, // mLayerID - 7, // mListID - fpcPi_CURRENT_e, // mListPrio - PROC_E_CR_EGG, // mProcName - &g_fpcLf_Method.base, // sub_method - sizeof(e_cr_egg_class), // mSize - 0, // mSizeOther - 0, // mParameters - &g_fopAc_Method.base, // sub_method - 114, // mPriority - &l_daE_CR_EGG_Method, // sub_method - 0x00040100, // mStatus - fopAc_ENEMY_e, // mActorType - fopAc_CULLBOX_0_e, // cullType + fpcLy_CURRENT_e, // mLayerID + 7, // mListID + fpcPi_CURRENT_e, // mListPrio + PROC_E_CR_EGG, // mProcName + &g_fpcLf_Method.base, // sub_method + sizeof(e_cr_egg_class), // mSize + 0, // mSizeOther + 0, // mParameters + &g_fopAc_Method.base, // sub_method + 114, // mPriority + &l_daE_CR_EGG_Method, // sub_method + 0x00040100, // mStatus + fopAc_ENEMY_e, // mActorType + fopAc_CULLBOX_0_e, // cullType }; - -/* 8069A9B0-8069A9BC 00009C 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, -}; - -/* 8069A9BC-8069A9C8 0000A8 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, -}; - -/* 8069A9C8-8069A9EC 0000B4 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_8069A8BC, - (void*)NULL, - (void*)NULL, - (void*)func_8069A8B4, -}; - -/* 8069A57C-8069A7B4 0006BC 0238+00 1/0 0/0 0/0 .text daE_CR_EGG_Create__FP10fopAc_ac_c - */ -static void daE_CR_EGG_Create(fopAc_ac_c* param_0) { - // NONMATCHING -} - -/* 8069A7B4-8069A7FC 0008F4 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGSphFv */ -// cM3dGSph::~cM3dGSph() { -extern "C" void __dt__8cM3dGSphFv() { - // NONMATCHING -} - -/* 8069A7FC-8069A844 00093C 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGAabFv */ -// cM3dGAab::~cM3dGAab() { -extern "C" void __dt__8cM3dGAabFv() { - // NONMATCHING -} - -/* 8069A844-8069A8B4 000984 0070+00 3/2 0/0 0/0 .text __dt__12dBgS_ObjAcchFv */ -// dBgS_ObjAcch::~dBgS_ObjAcch() { -extern "C" void __dt__12dBgS_ObjAcchFv() { - // NONMATCHING -} - -/* 8069A8B4-8069A8BC 0009F4 0008+00 1/0 0/0 0/0 .text @36@__dt__12dBgS_ObjAcchFv */ -static void func_8069A8B4() { - // NONMATCHING -} - -/* 8069A8BC-8069A8C4 0009FC 0008+00 1/0 0/0 0/0 .text @20@__dt__12dBgS_ObjAcchFv */ -static void func_8069A8BC() { - // NONMATCHING -} - -/* 8069A90C-8069A90C 000040 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ diff --git a/src/d/actor/d_a_e_ws.cpp b/src/d/actor/d_a_e_ws.cpp index bb9c38717de..1b58104b515 100644 --- a/src/d/actor/d_a_e_ws.cpp +++ b/src/d/actor/d_a_e_ws.cpp @@ -182,10 +182,12 @@ int daE_WS_c::checkPlayerPos() { gndchk.SetPos(&gndpos); gndpos.y = dComIfG_Bgsp().GroundCross(&gndchk); if (current.pos.y - gndpos.y > l_HIO.dist_to_ground) { + // Return 1 if walltula is looking towards player if (cLib_distanceAngleS(shape_angle.y, calcTargetAngle(current.pos, player_pos)) < l_HIO.search_angle) { return 1; } + // otherwise return 2 if player is near the walltula if (calcTargetDist(current.pos, player_pos) < 150.0f) { return 2; } @@ -230,12 +232,12 @@ void daE_WS_c::executeWait() { switch (mMode) { case 0: - field_0x68c = 50.0f + cM_rndF(50.0f); + mMoveWaitTimer = 50.0f + cM_rndF(50.0f); setBck(9, 2, 3.0f, 1.0f); mMode = 1; /* fallthrough */ case 1: - if (field_0x68c == 0) { + if (mMoveWaitTimer == 0) { mMode = 2; } break; @@ -263,19 +265,19 @@ void daE_WS_c::executeWait() { if (cLib_chaseAngleS(&shape_angle.y, mTargetAngle, mTargetStep)) { mMode = 4; - field_0x68c = 10; + mMoveWaitTimer = 10; setBck(9, 2, 3.0f, 1.0f); } break; case 4: - if (field_0x68c == 0) { + if (mMoveWaitTimer == 0) { mMode = 5; } break; case 5: mMode = 6; speedF = 3.0f; - field_0x68c = 20.0f + cM_rndF(10.0f); + mMoveWaitTimer = 20.0f + cM_rndF(10.0f); setBck(7, 2, 3.0f, 1.0f); /* fallthrough */ case 6: @@ -283,15 +285,15 @@ void daE_WS_c::executeWait() { if (field_0x690 == 0) { if (calcTargetDist(current.pos, field_0x65c) >= l_HIO.move_range) { - field_0x68c = 0; + mMoveWaitTimer = 0; } } if (checkBeforeBg(shape_angle.y)) { - field_0x68c = 0; + mMoveWaitTimer = 0; } - if (field_0x68c == 0) { + if (mMoveWaitTimer == 0) { speedF = 0.0f; mMode = 0; } @@ -322,12 +324,12 @@ void daE_WS_c::executeAttack() { mMode = 2; setBck(10, 2, 3.0f, 1.0f); mSound.startCreatureVoice(Z2SE_EN_WS_V_YOKOKU, -1); - field_0x68c = 10; + mMoveWaitTimer = 10; } } break; case 2: - if (field_0x68c == 0) { + if (mMoveWaitTimer == 0) { speedF = l_HIO.attack_speed * mBodyScale; setBck(7, 2, 3.0f, 3.0f); mMode = 3; @@ -410,7 +412,7 @@ void daE_WS_c::executeDown() { speedF = 3.0f + cM_rndF(2.0f); speed.y = 12.0f; mMode = 3; - field_0x68c = 30; + mMoveWaitTimer = 30; setBck(6, 0, 5.0f, 1.0f); mSound.startCreatureSound(Z2SE_CM_BODYFALL_S, 0, -1); } @@ -445,7 +447,7 @@ void daE_WS_c::executeDown() { cLib_addCalc2(&mDownColor, -20.0f, 1.0f, 0.4f); if (mpModelMorf->isStop()) { - field_0x68c = 15; + mMoveWaitTimer = 15; mMode = 5; return; } @@ -453,7 +455,7 @@ void daE_WS_c::executeDown() { case 5: cLib_addCalc2(&mDownColor, -20.0f, 1.0f, 0.4f); - if (field_0x68c == 0) { + if (mMoveWaitTimer == 0) { fopAcM_delete(this); fopAcM_createDisappear(this, ¤t.pos, 7, 0, 7); @@ -480,7 +482,7 @@ void daE_WS_c::executeWindDown() { setBck(7, 2, 3.0f, 1.0f); mSound.startCreatureVoice(Z2SE_EN_WS_V_DAMAGE, -1); - field_0x68c = 5; + mMoveWaitTimer = 5; mAcch.SetGroundUpY(20.0f); attention_info.flags = 0; speed.y = 0.0f; @@ -496,7 +498,7 @@ void daE_WS_c::executeWindDown() { shape_angle.z += 0x800; speed.y = 30.0f; - if (field_0x68c == 0) { + if (mMoveWaitTimer == 0) { mMode = 2; gravity = -3.0f; } @@ -512,7 +514,7 @@ void daE_WS_c::executeWindDown() { speedF = 3.0f + cM_rndF(2.0f); speed.y = 12.0f; mMode = 3; - field_0x68c = 30; + mMoveWaitTimer = 30; setBck(6, 0, 5.0f, 1.0f); mSound.startCreatureVoice(Z2SE_EN_WS_V_DEATH, -1); mSound.startCreatureSound(Z2SE_CM_BODYFALL_S, 0, -1); @@ -539,13 +541,13 @@ void daE_WS_c::executeWindDown() { shape_angle.y += mTargetStep; if (mpModelMorf->isStop()) { - field_0x68c = 15; + mMoveWaitTimer = 15; mMode = 5; } break; case 5: cLib_addCalc2(&mDownColor, -20.0f, 1.0f, 0.4f); - if (field_0x68c == 0) { + if (mMoveWaitTimer == 0) { fopAcM_delete(this); fopAcM_createDisappear(this, ¤t.pos, 7, 0, 7); @@ -690,8 +692,8 @@ void daE_WS_c::cc_set() { /* 807E5C0C-807E5CB8 0022EC 00AC+00 1/1 0/0 0/0 .text execute__8daE_WS_cFv */ int daE_WS_c::execute() { - if (field_0x68c != 0) { - field_0x68c--; + if (mMoveWaitTimer != 0) { + mMoveWaitTimer--; } if (mInvulnerabilityTimer != 0) {