From 3df4a4b8d553c0a079954b936cadb9cd03759d38 Mon Sep 17 00:00:00 2001 From: Carco_21 <144170194+carter-ktb21@users.noreply.github.com> Date: Tue, 1 Apr 2025 16:29:46 -0400 Subject: [PATCH] d_a_ep work (#2364) * Started work on d_a_ep * Work on daEp_Create * daEp_Execute work and other smaller functions * Work on execute function and started on move function * Work on ep_move * Data matching and pushed some functions to 100% * Pull request cleanup --- include/d/actor/d_a_ep.h | 97 ++ src/d/actor/d_a_ep.cpp | 1973 +++++++++++++++++--------------------- 2 files changed, 985 insertions(+), 1085 deletions(-) diff --git a/include/d/actor/d_a_ep.h b/include/d/actor/d_a_ep.h index 73697193cb0..e89bce1e175 100644 --- a/include/d/actor/d_a_ep.h +++ b/include/d/actor/d_a_ep.h @@ -1,5 +1,102 @@ #ifndef D_A_EP_H #define D_A_EP_H +#include "d/d_bg_s_gnd_chk.h" +#include "d/d_cc_d.h" +#include "d/d_cc_uty.h" +#include "f_op/f_op_actor.h" + +class ep_hahen_s { + public: + /* 8046ACC0 */ ~ep_hahen_s() {}; + /* 8046AD44 */ ep_hahen_s() {}; + + /* 0x00 */ J3DModel* mpModel; + /* 0x04 */ cXyz field_0x4; + /* 0x10 */ cXyz field_0x10; + /* 0x1C */ cXyz field_0x1c; + /* 0x28 */ csXyz field_0x28; + /* 0x2E */ u8 field_0x2e; + /* 0x2F */ u8 field_0x2f; + /* 0x30 */ f32 field_0x30; + /* 0x34 */ f32 field_0x34; + /* 0x38 */ f32 mGroundY; + /* 0x3C */ dBgS_ObjGndChk mObjGndCheck; + /* 0x90 */ s16 field_0x90; + /* 0x92 */ s16 field_0x92; + /* 0x94 */ s16 field_0x94; + /* 0x96 */ s8 field_0x96; + /* 0x97 */ u8 field_0x97; + /* 0x98 */ u8 field_0x98; + /* 0x99 */ u8 field_0x99[0x9c - 0x99]; + /* 0x9C */ u32 mShadow; + /* 0xA0 */ u32 field_0xa0; + /* 0xA4 */ u8 field_0xa4; + /* 0xA7 */ u8 field_0xa7; +}; + +STATIC_ASSERT(sizeof(ep_hahen_s) == 0xa8); + +class ep_class : public fopAc_ac_c { + public: + /* 8046AB2C */ ep_class() {}; + + /* 0x0568 */ request_of_phase_process_class mPhase; + /* 0x0570 */ Mtx field_0x570; + /* 0x05A0 */ J3DModel* mpModel; + /* 0x05A4 */ u32 field_0x5a4; + /* 0x05A8 */ u8 field_0x5a8[0x5b0 - 0x5a8]; + /* 0x05B0 */ f32 field_0x5b0; + /* 0x05B4 */ f32 field_0x5b4; + /* 0x05B8 */ f32 field_0x5b8; + /* 0x05BC */ f32 field_0x5bc; + /* 0x05C0 */ f32 field_0x5c0; + /* 0x05C4 */ f32 field_0x5c4; + /* 0x05C8 */ s16 field_0x5c8[3]; + /* 0x05CE */ s16 field_0x5ce; + /* 0x05D0 */ u8 field_0x5d0[0x5dc - 0x5d0]; + /* 0x05DC */ cXyz field_0x5dc; + /* 0x05E8 */ cXyz field_0x5e8; + /* 0x05F4 */ cXyz field_0x5f4; + /* 0x0600 */ u8 field_0x600; + /* 0x0601 */ u8 field_0x601; + /* 0x0602 */ u8 field_0x602; + /* 0x0603 */ u8 field_0x603[0x609 - 0x603]; + /* 0x0609 */ u8 field_0x609; + /* 0x060A */ u8 field_0x60a; + /* 0x060B */ u8 field_0x60b; + /* 0x060C */ u8 field_0x60c; + /* 0x060D */ u8 field_0x60d; + /* 0x060E */ u8 field_0x60e; + /* 0x060F */ u8 field_0x60f; + /* 0x0610 */ JPABaseEmitter* mBaseEmitter; + /* 0x0614 */ LIGHT_INFLUENCE mLightInf; + /* 0x0634 */ cXyz field_0x634; + /* 0x0640 */ s8 field_0x640; + /* 0x0641 */ u8 field_0x641[0x644 - 0x641]; + /* 0x0644 */ dCcD_Stts mStts; + /* 0x0680 */ dCcD_Cyl mCyl; + /* 0x07BC */ dCcD_Sph mSph1; + /* 0x08F4 */ dCcD_Sph mSph2; + /* 0x0A2C */ dCcU_AtInfo mAtInfo; + /* 0x0A50 */ s16 field_0xa50; + /* 0x0A52 */ u8 field_0xa52[0xa54 - 0xa52]; + /* 0x0A54 */ f32 field_0xa54; + /* 0x0A58 */ s16 field_0xa58; + /* 0x0A5A */ s8 field_0xa5a; + /* 0x0A5B */ u8 field_0xa5b; + /* 0x0A5C */ int field_0xa5c; + /* 0x0A60 */ u32 field_0xa60; + /* 0x0A64 */ u32 field_0xa64; + /* 0x0A68 */ u8 field_0xa68[0xa78 - 0xa68]; + /* 0x0A78 */ u8 field_0xa78; + /* 0x0A79 */ s8 field_0xa79; + /* 0x0A7A */ u8 field_0xa7a; + /* 0x0A7B */ u8 field_0xa7b; + /* 0x0A7C */ ep_hahen_s mHahen[6]; + /* 0x0E6C */ u8 field_0xe6c; +}; + +STATIC_ASSERT(sizeof(ep_class) == 0xe70); #endif /* D_A_EP_H */ diff --git a/src/d/actor/d_a_ep.cpp b/src/d/actor/d_a_ep.cpp index 114a3e601c7..857dcff4833 100644 --- a/src/d/actor/d_a_ep.cpp +++ b/src/d/actor/d_a_ep.cpp @@ -1,1164 +1,967 @@ // -// Generated By: dol2asm // Translation Unit: d_a_ep // #include "d/actor/d_a_ep.h" -#include "d/d_cc_d.h" -#include "dol2asm.h" +#include "d/d_com_inf_game.h" +#include "m_Do/m_Do_lib.h" +#include "d/d_a_obj.h" +#include "d/d_s_play.h" -// -// Types: -// - -struct mDoLib_clipper { - static u8 mClipper[92]; - static f32 mSystemFar; -}; - -struct fopAc_ac_c { - /* 80018B64 */ fopAc_ac_c(); -}; - -struct fopAcM_gc_c { - /* 8001DCBC */ void gndCheck(cXyz const*); - - static u8 mGndCheck[84]; - static f32 mGroundY; -}; - -struct ep_hahen_s { - /* 8046ACC0 */ ~ep_hahen_s(); - /* 8046AD44 */ ep_hahen_s(); -}; - -struct ep_class { - /* 8046AB2C */ ep_class(); -}; - -struct daObj { - /* 80037900 */ void HitSeStart(cXyz const*, int, dCcD_GObjInf const*, u32); -}; - -struct dSv_info_c { - /* 80035200 */ void onSwitch(int, int); - /* 800352B0 */ void offSwitch(int, int); - /* 80035360 */ void isSwitch(int, int) const; -}; - -struct dKy_tevstr_c {}; - -struct J3DModelData {}; - -struct dScnKy_env_light_c { - /* 801A37C4 */ void settingTevStruct(int, cXyz*, dKy_tevstr_c*); - /* 801A4DA0 */ void setLightTevColorType_MAJI(J3DModelData*, dKy_tevstr_c*); -}; - -struct dRes_info_c {}; - -struct dRes_control_c { - /* 8003C2EC */ void getRes(char const*, s32, dRes_info_c*, int); -}; - -struct dPa_levelEcallBack {}; - -struct csXyz {}; - -struct dPa_control_c { - /* 8004CA90 */ void set(u8, u16, cXyz const*, dKy_tevstr_c const*, csXyz const*, cXyz const*, - u8, dPa_levelEcallBack*, s8, _GXColor const*, _GXColor const*, - cXyz const*, f32); - /* 8004D4CC */ void set(u32, u8, u16, cXyz const*, dKy_tevstr_c const*, csXyz const*, - cXyz const*, u8, dPa_levelEcallBack*, s8, _GXColor const*, - _GXColor const*, cXyz const*, f32); - /* 8004D1B8 */ void setSimple(u16, cXyz const*, dKy_tevstr_c const*, u8, _GXColor const&, - _GXColor const&, int, f32); -}; - -struct dEvt_control_c { - /* 80042468 */ void reset(); -}; - -struct dEvent_manager_c { - /* 800474BC */ void getEventData(s16); - /* 80047514 */ void getEventIdx(char const*, u8, s32); - /* 80047ADC */ void endCheckOld(char const*); - /* 80047B1C */ void getMyStaffId(char const*, fopAc_ac_c*, int); - /* 80047D4C */ void getIsAddvance(int); - /* 80047E10 */ void getMyActIdx(int, char const* const*, int, int, int); - /* 8004817C */ void cutEnd(int); -}; - -struct dDlst_shadowControl_c { - static u8 mSimpleTexObj[32]; -}; - -struct dCcU_AtInfo {}; - -struct dBgS_PolyPassChk { - /* 80078E68 */ void SetObj(); -}; - -struct dBgS_ObjGndChk_Spl { - /* 800777B0 */ dBgS_ObjGndChk_Spl(); - /* 80077848 */ ~dBgS_ObjGndChk_Spl(); -}; - -struct dBgS_ObjGndChk { - /* 8046ADB0 */ ~dBgS_ObjGndChk(); -}; - -struct dBgS_LinChk { - /* 80077C68 */ dBgS_LinChk(); - /* 80077CDC */ ~dBgS_LinChk(); - /* 80077D64 */ void Set(cXyz const*, cXyz const*, fopAc_ac_c const*); -}; - -struct dBgS_GndChk { - /* 8007757C */ dBgS_GndChk(); - /* 800775F0 */ ~dBgS_GndChk(); -}; - -struct dAttention_c { - /* 8007353C */ void LockonTarget(s32); - /* 800737E4 */ void LockonTruth(); -}; - -struct cCcS { - /* 80264BA8 */ void Set(cCcD_Obj*); -}; - -struct cBgS_PolyInfo {}; - -struct cBgS_LinChk {}; - -struct cBgS_GndChk { - /* 80267D28 */ void SetPos(cXyz const*); -}; - -struct cBgS { - /* 800743B4 */ void LineCross(cBgS_LinChk*); - /* 800744A0 */ void GroundCross(cBgS_GndChk*); -}; - -struct LIGHT_INFLUENCE {}; - -struct J3DUClipper { - /* 8027378C */ void calcViewFrustum(); -}; - -struct J3DModel {}; - -// -// Forward References: -// - -extern "C" static void hahen_draw__FP8ep_class(); -extern "C" static void move_calc__FP8ep_classP10ep_hahen_s(); -extern "C" static void hahen_normal__FP8ep_classP10ep_hahen_s(); -extern "C" static void hahen_water__FP8ep_classP10ep_hahen_s(); -extern "C" static void hahen_carry__FP8ep_classP10ep_hahen_s(); -extern "C" static void hahen_cast__FP8ep_classP10ep_hahen_s(); -extern "C" static void hahen_move__FP8ep_class(); -extern "C" static void daEp_Draw__FP8ep_class(); -extern "C" static void ep_switch_event_end__FP8ep_class(); -extern "C" static void ep_switch_event_begin__FP8ep_class(); -extern "C" static void ep_switch_event_move__FP8ep_class(); -extern "C" static void ep_move__FP8ep_class(); -extern "C" static void daEp_set_mtx__FP8ep_class(); -extern "C" static void daEp_Execute__FP8ep_class(); -extern "C" static bool daEp_IsDelete__FP8ep_class(); -extern "C" static void daEp_Delete__FP8ep_class(); -extern "C" static void daEp_CreateHeap__FP10fopAc_ac_c(); -extern "C" static void daEp_CreateInit__FP10fopAc_ac_c(); -extern "C" static void daEp_Create__FP10fopAc_ac_c(); -extern "C" void __ct__8ep_classFv(); -extern "C" void __dt__10ep_hahen_sFv(); -extern "C" void __ct__10ep_hahen_sFv(); -extern "C" void __dt__14dBgS_ObjGndChkFv(); -extern "C" void __dt__8cM3dGSphFv(); -extern "C" void __dt__8cM3dGCylFv(); -extern "C" void __dt__8cM3dGAabFv(); -extern "C" void __dt__10dCcD_GSttsFv(); -extern "C" void __dt__10cCcD_GSttsFv(); -extern "C" static void func_8046AFA4(); -extern "C" static void func_8046AFAC(); -extern "C" static void func_8046AFB4(); -extern "C" extern char const* const d_a_ep__stringBase0; - -// -// External References: -// - -extern "C" void mDoMtx_XrotS__FPA4_fs(); -extern "C" void mDoMtx_XrotM__FPA4_fs(); -extern "C" void mDoMtx_YrotS__FPA4_fs(); -extern "C" void mDoMtx_YrotM__FPA4_fs(); -extern "C" void mDoMtx_ZrotM__FPA4_fs(); -extern "C" void 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 fopAcM_SetMin__FP10fopAc_ac_cfff(); -extern "C" void fopAcM_SetMax__FP10fopAc_ac_cfff(); -extern "C" void fopAcM_rollPlayerCrash__FPC10fopAc_ac_cfUlffif(); -extern "C" void fopAcM_checkCullingBox__FPA4_fffffff(); -extern "C" void fopAcM_orderOtherEvent__FP10fopAc_ac_cPCcUsUsUs(); -extern "C" void fopAcM_effSmokeSet1__FPUlPUlPC4cXyzPC5csXyzfPC12dKy_tevstr_ci(); -extern "C" void fopAcM_effHamonSet__FPUlPC4cXyzff(); -extern "C" void gndCheck__11fopAcM_gc_cFPC4cXyz(); -extern "C" void dComIfG_resLoad__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfG_resDelete__FP30request_of_phase_process_classPCc(); -extern "C" void -dComIfGd_setShadow__FUlScP8J3DModelP4cXyzffffR13cBgS_PolyInfoP12dKy_tevstr_csfP9_GXTexObj(); -extern "C" void onSwitch__10dSv_info_cFii(); -extern "C" void offSwitch__10dSv_info_cFii(); -extern "C" void isSwitch__10dSv_info_cCFii(); -extern "C" void HitSeStart__5daObjFPC4cXyziPC12dCcD_GObjInfUl(); -extern "C" void getRes__14dRes_control_cFPCclP11dRes_info_ci(); -extern "C" void reset__14dEvt_control_cFv(); -extern "C" void getEventData__16dEvent_manager_cFs(); -extern "C" void getEventIdx__16dEvent_manager_cFPCcUcl(); -extern "C" void endCheckOld__16dEvent_manager_cFPCc(); -extern "C" void getMyStaffId__16dEvent_manager_cFPCcP10fopAc_ac_ci(); -extern "C" void getIsAddvance__16dEvent_manager_cFi(); -extern "C" void getMyActIdx__16dEvent_manager_cFiPCPCciii(); -extern "C" void cutEnd__16dEvent_manager_cFi(); -extern "C" void -set__13dPa_control_cFUcUsPC4cXyzPC12dKy_tevstr_cPC5csXyzPC4cXyzUcP18dPa_levelEcallBackScPC8_GXColorPC8_GXColorPC4cXyzf(); -extern "C" void setSimple__13dPa_control_cFUsPC4cXyzPC12dKy_tevstr_cUcRC8_GXColorRC8_GXColorif(); -extern "C" void -set__13dPa_control_cFUlUcUsPC4cXyzPC12dKy_tevstr_cPC5csXyzPC4cXyzUcP18dPa_levelEcallBackScPC8_GXColorPC8_GXColorPC4cXyzf(); -extern "C" void LockonTarget__12dAttention_cFl(); -extern "C" void LockonTruth__12dAttention_cFv(); -extern "C" void LineCross__4cBgSFP11cBgS_LinChk(); -extern "C" void GroundCross__4cBgSFP11cBgS_GndChk(); -extern "C" void __ct__11dBgS_GndChkFv(); -extern "C" void __dt__11dBgS_GndChkFv(); -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 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 GetTgHitGObj__12dCcD_GObjInfFv(); -extern "C" void Set__8dCcD_CylFRC11dCcD_SrcCyl(); -extern "C" void Set__8dCcD_SphFRC11dCcD_SrcSph(); -extern "C" void at_power_check__FP11dCcU_AtInfo(); -extern "C" void settingTevStruct__18dScnKy_env_light_cFiP4cXyzP12dKy_tevstr_c(); -extern "C" void setLightTevColorType_MAJI__18dScnKy_env_light_cFP12J3DModelDataP12dKy_tevstr_c(); -extern "C" void dKy_plight_set__FP15LIGHT_INFLUENCE(); -extern "C" void dKy_plight_cut__FP15LIGHT_INFLUENCE(); -extern "C" void GetAc__8cCcD_ObjFv(); -extern "C" void Set__4cCcSFP8cCcD_Obj(); -extern "C" void __pl__4cXyzCFRC3Vec(); -extern "C" void __mi__4cXyzCFRC3Vec(); -extern "C" void __ml__4cXyzCFf(); -extern "C" void cM_atan2s__Fff(); -extern "C" void cM_rndF__Ff(); -extern "C" void cM_rndFX__Ff(); -extern "C" void SetPos__11cBgS_GndChkFPC4cXyz(); -extern "C" void SetC__8cM3dGCylFRC4cXyz(); -extern "C" void SetH__8cM3dGCylFf(); -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 MtxTrans__FfffUc(); -extern "C" void MtxScale__FfffUc(); -extern "C" void MtxPosition__FP4cXyzP4cXyz(); -extern "C" void calcViewFrustum__11J3DUClipperFv(); -extern "C" void seStart__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc(); -extern "C" void __dl__FPv(); -extern "C" void __construct_array(); -extern "C" void _savegpr_22(); -extern "C" void _savegpr_25(); -extern "C" void _savegpr_26(); -extern "C" void _savegpr_27(); -extern "C" void _savegpr_28(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_22(); -extern "C" void _restgpr_25(); -extern "C" void _restgpr_26(); -extern "C" void _restgpr_27(); -extern "C" void _restgpr_28(); -extern "C" void _restgpr_29(); -extern "C" extern void* g_fopAc_Method[8]; -extern "C" extern void* __vt__8dCcD_Sph[36]; -extern "C" extern void* __vt__8dCcD_Cyl[36]; -extern "C" extern void* __vt__9dCcD_Stts[11]; -extern "C" extern void* __vt__12cCcD_SphAttr[25]; -extern "C" extern void* __vt__12cCcD_CylAttr[25]; -extern "C" extern void* __vt__14cCcD_ShapeAttr[22]; -extern "C" extern void* __vt__9cCcD_Stts[8]; -extern "C" u8 mClipper__14mDoLib_clipper[92]; -extern "C" u8 mGndCheck__11fopAcM_gc_c[84]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; -extern "C" u8 mSimpleTexObj__21dDlst_shadowControl_c[32]; -extern "C" extern u8 g_env_light[4880]; -extern "C" u8 sincosTable___5JMath[65536]; -extern "C" extern u32 g_whiteColor; -extern "C" extern void* calc_mtx[1 + 1 /* padding */]; -extern "C" f32 mSystemFar__14mDoLib_clipper; -extern "C" f32 mGroundY__11fopAcM_gc_c; -extern "C" extern u8 pauseTimer__9dScnPly_c[4]; -extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */]; - -// -// Declarations: -// - -/* ############################################################################################## */ -/* 8046AFC4-8046AFC8 000000 0004+00 9/9 0/0 0/0 .rodata @3681 */ -SECTION_RODATA static f32 const lit_3681 = 50.0f; -COMPILER_STRIP_GATE(0x8046AFC4, &lit_3681); - -/* 8046AFC8-8046AFCC 000004 0004+00 0/3 0/0 0/0 .rodata @3682 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3682 = 200.0f; -COMPILER_STRIP_GATE(0x8046AFC8, &lit_3682); -#pragma pop - -/* 8046AFCC-8046AFD0 000008 0004+00 2/10 0/0 0/0 .rodata @3683 */ -SECTION_RODATA static u8 const lit_3683[4] = { - 0x00, - 0x00, - 0x00, - 0x00, -}; -COMPILER_STRIP_GATE(0x8046AFCC, &lit_3683); - -/* 8046AFD0-8046AFD4 00000C 0004+00 1/8 0/0 0/0 .rodata @3684 */ -SECTION_RODATA static f32 const lit_3684 = 1.0f; -COMPILER_STRIP_GATE(0x8046AFD0, &lit_3684); +UNK_REL_DATA /* 804681F8-804682F8 000078 0100+00 1/1 0/0 0/0 .text hahen_draw__FP8ep_class */ -static void hahen_draw(ep_class* param_0) { +static void hahen_draw(ep_class* i_this) { // NONMATCHING + ep_hahen_s* epHahenS = i_this->mHahen; + g_env_light.settingTevStruct(16, &i_this->current.pos, &i_this->tevStr); + + for (int i = 0; i < 6; i++) { + if (epHahenS[i].field_0x97 != 0) { + g_env_light.setLightTevColorType_MAJI(epHahenS[i].mpModel, &i_this->tevStr); + mDoExt_modelUpdateDL(epHahenS[i].mpModel); + + if (epHahenS[i].field_0x96 < 2) { + cXyz local_28(epHahenS[i].field_0x4.x, epHahenS[i].field_0x4.y + 50.0f, epHahenS[i].field_0x4.z); + epHahenS[i].mShadow = dComIfGd_setShadow(epHahenS[i].mShadow, 1, epHahenS[i].mpModel, + &local_28, 200.0f, 0.0f, epHahenS[i].field_0x4.y, epHahenS[i].mGroundY, + epHahenS[i].mObjGndCheck, &i_this->tevStr, 0, 1.0f, + dDlst_shadowControl_c::getSimpleTex()); + } + } + } } -/* ############################################################################################## */ -/* 8046AFD4-8046AFD8 000010 0004+00 0/2 0/0 0/0 .rodata @3859 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3859 = 5.0f; -COMPILER_STRIP_GATE(0x8046AFD4, &lit_3859); -#pragma pop - -/* 8046AFD8-8046AFDC 000014 0004+00 0/1 0/0 0/0 .rodata @3860 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3860 = -90.0f; -COMPILER_STRIP_GATE(0x8046AFD8, &lit_3860); -#pragma pop - -/* 8046AFDC-8046AFE0 000018 0004+00 0/1 0/0 0/0 .rodata @3861 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3861 = 100.0f; -COMPILER_STRIP_GATE(0x8046AFDC, &lit_3861); -#pragma pop - -/* 8046AFE0-8046AFE4 00001C 0004+00 0/2 0/0 0/0 .rodata @3862 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3862 = 35.0f; -COMPILER_STRIP_GATE(0x8046AFE0, &lit_3862); -#pragma pop - -/* 8046AFE4-8046AFE8 000020 0004+00 0/2 0/0 0/0 .rodata @3863 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3863 = 6.0f; -COMPILER_STRIP_GATE(0x8046AFE4, &lit_3863); -#pragma pop - -/* 8046AFE8-8046AFEC 000024 0004+00 0/1 0/0 0/0 .rodata @3864 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3864 = -20.0f; -COMPILER_STRIP_GATE(0x8046AFE8, &lit_3864); -#pragma pop - -/* 8046AFEC-8046AFF0 000028 0004+00 0/1 0/0 0/0 .rodata @3865 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3865 = -3.0f / 10.0f; -COMPILER_STRIP_GATE(0x8046AFEC, &lit_3865); -#pragma pop - -/* 8046AFF0-8046AFF4 00002C 0004+00 0/1 0/0 0/0 .rodata @3866 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3866 = 17000.0f; -COMPILER_STRIP_GATE(0x8046AFF0, &lit_3866); -#pragma pop - -/* 8046AFF4-8046AFF8 000030 0004+00 0/1 0/0 0/0 .rodata @3867 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3867 = 10000.0f; -COMPILER_STRIP_GATE(0x8046AFF4, &lit_3867); -#pragma pop - -/* 8046AFF8-8046AFFC 000034 0004+00 0/3 0/0 0/0 .rodata @3868 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3868 = 0.5f; -COMPILER_STRIP_GATE(0x8046AFF8, &lit_3868); -#pragma pop - -/* 8046AFFC-8046B000 000038 0004+00 1/6 0/0 0/0 .rodata @3869 */ -SECTION_RODATA static f32 const lit_3869 = -1.0f; -COMPILER_STRIP_GATE(0x8046AFFC, &lit_3869); - -/* 8046B000-8046B004 00003C 0004+00 0/1 0/0 0/0 .rodata @3870 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3870 = -10.0f; -COMPILER_STRIP_GATE(0x8046B000, &lit_3870); -#pragma pop - -/* 8046B004-8046B00C 000040 0008+00 0/3 0/0 0/0 .rodata @3871 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3871[8] = { - 0x3F, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x8046B004, &lit_3871); -#pragma pop - -/* 8046B00C-8046B014 000048 0008+00 0/3 0/0 0/0 .rodata @3872 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3872[8] = { - 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x8046B00C, &lit_3872); -#pragma pop - -/* 8046B014-8046B01C 000050 0008+00 0/3 0/0 0/0 .rodata @3873 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3873[8] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x8046B014, &lit_3873); -#pragma pop - -/* 8046B01C-8046B020 000058 0004+00 0/2 0/0 0/0 .rodata @3874 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3874 = 1.0f / 100.0f; -COMPILER_STRIP_GATE(0x8046B01C, &lit_3874); -#pragma pop - -/* 8046B020-8046B024 00005C 0004+00 0/1 0/0 0/0 .rodata @3875 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3875 = 11.0f / 10.0f; -COMPILER_STRIP_GATE(0x8046B020, &lit_3875); -#pragma pop - -/* 8046B024-8046B028 000060 0004+00 0/1 0/0 0/0 .rodata @3876 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3876 = -0.5f; -COMPILER_STRIP_GATE(0x8046B024, &lit_3876); -#pragma pop - -/* 8046B028-8046B02C 000064 0004+00 0/1 0/0 0/0 .rodata @3877 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3877 = 65536.0f; -COMPILER_STRIP_GATE(0x8046B028, &lit_3877); -#pragma pop - -/* 8046B02C-8046B030 000068 0004+00 0/1 0/0 0/0 .rodata @3878 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3878 = 7.0f / 10.0f; -COMPILER_STRIP_GATE(0x8046B02C, &lit_3878); -#pragma pop - -/* 8046B0F8-8046B104 000000 000C+00 2/2 0/0 0/0 .data cNullVec__6Z2Calc */ -SECTION_DATA static u8 cNullVec__6Z2Calc[12] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -/* 8046B104-8046B118 00000C 0004+10 0/0 0/0 0/0 .data @1787 */ -#pragma push -#pragma force_active on -SECTION_DATA static u32 lit_1787[1 + 4 /* padding */] = { - 0x02000201, - /* padding */ - 0x40080000, - 0x00000000, - 0x3FE00000, - 0x00000000, -}; -#pragma pop - -/* 8046B118-8046B120 000020 0008+00 1/1 0/0 0/0 .data w_eff_id$3717 */ -SECTION_DATA static u8 w_eff_id[8] = { - 0x01, 0xB8, 0x01, 0xB9, 0x01, 0xBA, 0x01, 0xBB, -}; - -/* 804682F8-80468A70 000178 0778+00 2/2 0/0 0/0 .text move_calc__FP8ep_classP10ep_hahen_s - */ -static void move_calc(ep_class* param_0, ep_hahen_s* param_1) { +/* 804682F8-80468A70 000178 0778+00 2/2 0/0 0/0 .text move_calc__FP8ep_classP10ep_hahen_s */ +static int move_calc(ep_class* i_this, ep_hahen_s* hahen_s) { // NONMATCHING + static u16 w_eff_id[4] = { + 0x01B8, 0x01B9, 0x01BA, 0x01BB, + }; + + dBgS_LinChk dStack_bc; + int rv = 0; + + hahen_s->field_0x10 = hahen_s->field_0x4; + hahen_s->field_0x4 += hahen_s->field_0x1c; + + hahen_s->field_0x1c.y -= 5.0f; + if (hahen_s->field_0x1c.y < -90.0f) { + hahen_s->field_0x1c.y = -90.0f; + } + + cXyz local_11c(hahen_s->field_0x4.x, hahen_s->field_0x4.y + 100.0f, hahen_s->field_0x4.z); + f32 fVar11 = fabsf(35.0f * cM_ssin(hahen_s->field_0x28.x)) + 6.0f; + s16 sVar9 = 1000; + if (fopAcM_gc_c::gndCheck(&local_11c)) { + hahen_s->mGroundY = fopAcM_gc_c::getGroundY(); + hahen_s->mObjGndCheck = *fopAcM_gc_c::getGroundCheck(); + + if (hahen_s->field_0x1c.y <= 0.0f && hahen_s->field_0x4.y <= hahen_s->mGroundY + fVar11) { + hahen_s->field_0x4.y = hahen_s->mGroundY + fVar11; + rv = 1; + + if (hahen_s->field_0x1c.y < -20.0f && hahen_s->field_0x96 < 2) { + hahen_s->field_0x1c.y *= -0.3f; + if (hahen_s->field_0x96 == 0) { + hahen_s->field_0x28.x = cM_rndFX(17000.0f); + } else { + hahen_s->field_0x28.x = cM_rndFX(10000.0f); + } + + hahen_s->field_0x90 = 0; + hahen_s->field_0x92 /= 2; + hahen_s->field_0x96 += 1; + fopAcM_effSmokeSet1(&i_this->field_0xa60, &i_this->field_0xa64, &hahen_s->field_0x4, NULL, 0.5f, &i_this->tevStr, 0); + + Z2GetAudioMgr()->seStart(Z2SE_OBJ_WOODSTICK_BOUND, &hahen_s->field_0x4, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); + } else { + hahen_s->field_0x96 = 3; + hahen_s->field_0x1c.y = -10.0f; + sVar9 = 5000; + hahen_s->field_0x90 = 0; + hahen_s->field_0x92 = 0; + } + + hahen_s->field_0x1c.x *= 0.5f; + hahen_s->field_0x1c.z *= 0.5f; + } + + if (hahen_s->field_0x97 == 1) { + hahen_s->field_0x28.y += hahen_s->field_0x92; + if (hahen_s->field_0x90 != 0) { + hahen_s->field_0x28.z += hahen_s->field_0x90; + } else { + cLib_addCalcAngleS2(&hahen_s->field_0x28.z, 0, 1, sVar9); + } + cLib_addCalcAngleS2(&hahen_s->field_0x28.x, 0, 0, 0x800); + } + } + + if (hahen_s->field_0x98 == 0) { + cXyz local_158 = hahen_s->field_0x4 - hahen_s->field_0x10; + local_158.y = 0.0f; + if (local_158.abs() > 0.01f) { + cXyz local_170 = hahen_s->field_0x4 + (local_158 * 1.1f); + dStack_bc.Set(&hahen_s->field_0x10, &local_170, i_this); + if (dComIfG_Bgsp().LineCross(&dStack_bc)) { + hahen_s->field_0x4 = hahen_s->field_0x10; + hahen_s->field_0x1c.x *= -0.5f; + hahen_s->field_0x1c.z *= -0.5f; + hahen_s->field_0x1c.y = 0.0f; + hahen_s->field_0x4 += hahen_s->field_0x1c; + hahen_s->field_0x98 = 5; + rv = 2; + + Z2GetAudioMgr()->seStart(Z2SE_OBJ_WOODSTICK_BOUND, &hahen_s->field_0x4, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); + } + } + } + + dBgS_ObjGndChk_Spl cStack_110; + cXyz local_140(hahen_s->field_0x4); + local_140.y += 100.0f; + cStack_110.SetPos(&local_140); + hahen_s->field_0x34 = dComIfG_Bgsp().GroundCross(&cStack_110); + + if (hahen_s->field_0x4.y <= hahen_s->field_0x34) { + hahen_s->field_0x97 = 2; + hahen_s->field_0x4.y = hahen_s->field_0x34; + hahen_s->field_0x1c.x *= 0.5f; + hahen_s->field_0x1c.z *= 0.5f; + hahen_s->field_0x94 = cM_rndF(65536.0f); + rv = 3; + + cXyz local_14c(0.7f, 0.7f, 0.7f); + for (int i = 0; i < 4; i++) { + i_this->mHahen[i].field_0xa0 = dComIfGp_particle_set(0, w_eff_id[i], &hahen_s->field_0x4, &i_this->tevStr); + } + + mDoAud_seStart(Z2SE_CM_BODYFALL_WATER_S, &hahen_s->field_0x4, 0, 0); + } + + return rv; } /* 80468A70-80468A90 0008F0 0020+00 1/1 0/0 0/0 .text hahen_normal__FP8ep_classP10ep_hahen_s */ -static void hahen_normal(ep_class* param_0, ep_hahen_s* param_1) { - // NONMATCHING +static void hahen_normal(ep_class* i_this, ep_hahen_s* hahen_s) { + move_calc(i_this, hahen_s); } -/* ############################################################################################## */ -/* 8046B030-8046B034 00006C 0004+00 0/1 0/0 0/0 .rodata @3959 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3959 = 60.0f; -COMPILER_STRIP_GATE(0x8046B030, &lit_3959); -#pragma pop - -/* 8046B034-8046B038 000070 0004+00 0/3 0/0 0/0 .rodata @3960 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3960 = 3.0f; -COMPILER_STRIP_GATE(0x8046B034, &lit_3960); -#pragma pop - -/* 8046B038-8046B03C 000074 0004+00 0/1 0/0 0/0 .rodata @3961 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3961 = 19.0f / 20.0f; -COMPILER_STRIP_GATE(0x8046B038, &lit_3961); -#pragma pop - -/* 8046B03C-8046B040 000078 0004+00 0/1 0/0 0/0 .rodata @3962 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3962 = 2.0f; -COMPILER_STRIP_GATE(0x8046B03C, &lit_3962); -#pragma pop - -/* 8046B040-8046B044 00007C 0004+00 0/2 0/0 0/0 .rodata @3963 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3963 = 1.0f / 20.0f; -COMPILER_STRIP_GATE(0x8046B040, &lit_3963); -#pragma pop - /* 80468A90-80468E50 000910 03C0+00 1/1 0/0 0/0 .text hahen_water__FP8ep_classP10ep_hahen_s */ -static void hahen_water(ep_class* param_0, ep_hahen_s* param_1) { +static void hahen_water(ep_class* i_this, ep_hahen_s* hahen_s) { // NONMATCHING + fopAc_ac_c* player = dComIfGp_getPlayer(0); + dBgS_LinChk dStack_8c; + hahen_s->field_0x94++; + if (hahen_s->field_0x98) { + hahen_s->field_0x98--; + } + + hahen_s->field_0x10 = hahen_s->field_0x4; + + f32 x = hahen_s->field_0x4.x - player->current.pos.x; + f32 z = hahen_s->field_0x4.z - player->current.pos.z; + if (JMAFastSqrt(x * x + z * z) < 60.0f) { + s16 sVar1 = cM_atan2s(x, z); + cLib_addCalcAngleS2(&hahen_s->field_0x28.y, sVar1, 0x10, 200); + cMtx_YrotS(*calc_mtx, sVar1); + + cXyz local_98(0.0f, 0.0f, 3.0f); + MtxPosition(&local_98, &hahen_s->field_0x1c); + } + + hahen_s->field_0x4 += hahen_s->field_0x1c; + hahen_s->field_0x1c.y = 0.0f; + hahen_s->field_0x4.y = hahen_s->field_0x34; + hahen_s->field_0x1c.x *= 0.95f; + hahen_s->field_0x1c.z *= 0.95f; + hahen_s->field_0x28.y += hahen_s->field_0x92; + cLib_addCalcAngleS2(&hahen_s->field_0x92, 0, 1, 0x28); + + cLib_addCalcAngleS2(&hahen_s->field_0x28.z, (200.0f * cM_ssin(hahen_s->field_0x94 * 0x708)), 1, 0x800); + cLib_addCalcAngleS2(&hahen_s->field_0x28.x, 0, 4, 0x1000); + + if (hahen_s->field_0x98 == 0) { + cXyz local_bc = hahen_s->field_0x4 - hahen_s->field_0x10; + local_bc.y = 0.0f; + + if (local_bc.abs() > 0.01f) { + cXyz local_d4 = hahen_s->field_0x4 + local_bc * 2.0f; + dStack_8c.Set(&hahen_s->field_0x10, &local_d4, i_this); + + if (dComIfG_Bgsp().LineCross(&dStack_8c)) { + hahen_s->field_0x4 = hahen_s->field_0x10; + hahen_s->field_0x1c.x *= -1.0f; + hahen_s->field_0x1c.z *= -1.0f; + hahen_s->field_0x98 = 5; + } + } + } + + fopAcM_effHamonSet(&hahen_s->field_0xa0, &hahen_s->field_0x4, 1.0f, 0.05f); } -/* ############################################################################################## */ -/* 8046B044-8046B048 000080 0004+00 0/1 0/0 0/0 .rodata @4015 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4015 = 80.0f; -COMPILER_STRIP_GATE(0x8046B044, &lit_4015); -#pragma pop - -/* 8046B048-8046B04C 000084 0004+00 0/2 0/0 0/0 .rodata @4016 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4016 = 10.0f; -COMPILER_STRIP_GATE(0x8046B048, &lit_4016); -#pragma pop - -/* 8046B04C-8046B050 000088 0004+00 0/3 0/0 0/0 .rodata @4017 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4017 = 70.0f; -COMPILER_STRIP_GATE(0x8046B04C, &lit_4017); -#pragma pop - -/* 8046B050-8046B054 00008C 0004+00 0/4 0/0 0/0 .rodata @4018 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4018 = 30.0f; -COMPILER_STRIP_GATE(0x8046B050, &lit_4018); -#pragma pop - /* 80468E50-80469034 000CD0 01E4+00 1/1 0/0 0/0 .text hahen_carry__FP8ep_classP10ep_hahen_s */ -static void hahen_carry(ep_class* param_0, ep_hahen_s* param_1) { - // NONMATCHING +static void hahen_carry(ep_class* i_this, ep_hahen_s* hahen_s) { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + + if (!fopAcM_checkCarryNow(i_this)) { + if (fopAcM_GetSpeedF(i_this) > 0.0f) { + hahen_s->field_0x97 = 4; + hahen_s->field_0x96 = 0; + hahen_s->field_0x28.x = 0; + hahen_s->field_0x28.z = 0x4000; + hahen_s->field_0x28.y = player->shape_angle.y; + if (dComIfGp_getAttention().Lockon()) { + hahen_s->field_0x30 = 80.0f; + + fopAc_ac_c* lockOnTarget = dComIfGp_getAttention().LockonTarget(0); + if (lockOnTarget) { + cXyz local_34, cStack_28; + local_34 = lockOnTarget->current.pos - hahen_s->field_0x4; + hahen_s->field_0x28.y = cM_atan2s(local_34.x, local_34.z); + + f32 fVar1 = JMAFastSqrt(local_34.x * local_34.x + local_34.z * local_34.z); + s16 sVar1 = -cM_atan2s(local_34.y, fVar1); + cMtx_XrotS(*calc_mtx, -0x800 + sVar1); + + local_34.y = 0.0f; + local_34.x = 0.0f; + local_34.z = hahen_s->field_0x30; + MtxPosition(&local_34, &cStack_28); + hahen_s->field_0x1c.y = cStack_28.y; + } else { + hahen_s->field_0x1c.y = 10.0f; + } + } else { + hahen_s->field_0x30 = 70.0f; + hahen_s->field_0x1c.y = 30.0f; + } + } else { + hahen_s->field_0x97 = 1; + Z2GetAudioMgr()->seStart(Z2SE_OBJ_WOODSTICK_PUT, &hahen_s->field_0x4, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); + } + } } /* 80469034-804690F8 000EB4 00C4+00 1/1 0/0 0/0 .text hahen_cast__FP8ep_classP10ep_hahen_s */ -static void hahen_cast(ep_class* param_0, ep_hahen_s* param_1) { - // NONMATCHING +static void hahen_cast(ep_class* i_this, ep_hahen_s* hahen_s) { + cXyz local_1c, local_28; + + hahen_s->field_0x28.x += 0x1450; + + cMtx_YrotS(*calc_mtx, hahen_s->field_0x28.y); + local_1c.x = 0.0f; + local_1c.y = 0.0f; + local_1c.z = hahen_s->field_0x30; + MtxPosition(&local_1c, &local_28); + hahen_s->field_0x1c.x = local_28.x; + hahen_s->field_0x1c.z = local_28.z; + + if (move_calc(i_this, hahen_s)) { + hahen_s->field_0x97 = 1; + } + + i_this->mSph2.SetC(hahen_s->field_0x4); + dComIfG_Ccsp()->Set(&i_this->mSph2); } -/* ############################################################################################## */ -/* 8046B054-8046B058 000090 0004+00 0/3 0/0 0/0 .rodata @4205 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4205 = 20.0f; -COMPILER_STRIP_GATE(0x8046B054, &lit_4205); -#pragma pop - /* 804690F8-80469568 000F78 0470+00 1/1 0/0 0/0 .text hahen_move__FP8ep_class */ -static void hahen_move(ep_class* param_0) { +static void hahen_move(ep_class* i_this) { // NONMATCHING + fopAc_ac_c* player = dComIfGp_getPlayer(0); + dBgS_LinChk dStack_cc; + + if (!fopAcM_checkCarryNow(i_this)) { + f32 fVar1 = 50.0f; + bool bVar2 = false; + for (int i = 0; i < 10; i++) { + ep_hahen_s* epHahenS = i_this->mHahen; + for (int j = 0; j < 6; j++) { + cXyz local_d8; + local_d8 = player->current.pos - epHahenS[j].field_0x4; + if (local_d8.abs() < fVar1) { + cLib_onBit(i_this->attention_info.flags, 0x80); + i_this->current.pos = epHahenS[j].field_0x4; + i_this->eyePos = i_this->current.pos; + i_this->attention_info.position = i_this->eyePos; + i_this->shape_angle = epHahenS[j].field_0x28; + i_this->current.angle = i_this->shape_angle; + i_this->field_0xa78 = j; + bVar2 = true; + break; + } + } + + // if (bVar2) break; + fVar1 += 20.0f; + } + } else { + cLib_offBit(i_this->attention_info.flags, 0x80); + i_this->mHahen[i_this->field_0xa78].field_0x97 = 3; + i_this->mHahen[i_this->field_0xa78].field_0x4 = i_this->current.pos; + i_this->mHahen[i_this->field_0xa78].field_0x28 = i_this->shape_angle; + } + + ep_hahen_s* epHahenS = i_this->mHahen; + for (int i = 0; i < 6; i++) { + if (epHahenS[i].field_0x97) { + if (epHahenS[i].field_0x98) { + epHahenS[i].field_0x98 += -1; + } + + if (i_this->field_0xa79 == 3) { + if (epHahenS[i].field_0x97 == 1) { + hahen_normal(i_this, epHahenS); + } else if (epHahenS[i].field_0x97 == 2) { + hahen_water(i_this, epHahenS); + } else if (epHahenS[i].field_0x97 == 3) { + hahen_carry(i_this, epHahenS); + } else if (epHahenS[i].field_0x97 == 4) { + hahen_cast(i_this, epHahenS); + } + } + + MtxTrans(epHahenS[i].field_0x4.x, epHahenS[i].field_0x4.y, epHahenS[i].field_0x4.z, 0); + cMtx_YrotM(*calc_mtx, epHahenS[i].field_0x28.y); + cMtx_XrotM(*calc_mtx, epHahenS[i].field_0x28.x); + cMtx_ZrotM(*calc_mtx, epHahenS[i].field_0x28.z); + cMtx_YrotM(*calc_mtx, 0x4000); + MtxTrans(3.0f, 0.0f, 0.0f, 1); + cMtx_XrotM(*calc_mtx, 0x4000); + MtxScale(1.0f, 0.5, 1.0f, 1); + epHahenS[i].mpModel->setBaseTRMtx(*calc_mtx); + } + } + + if (i_this->field_0xa79 == 2) { + i_this->field_0xa79 = 3; + } } /* 80469568-804695F8 0013E8 0090+00 1/0 0/0 0/0 .text daEp_Draw__FP8ep_class */ -static void daEp_Draw(ep_class* param_0) { - // NONMATCHING -} +static int daEp_Draw(ep_class* i_this) { + if (i_this->mpModel) { + if (i_this->field_0x602 != 1) { + g_env_light.settingTevStruct(16, &i_this->current.pos, &i_this->tevStr); + g_env_light.setLightTevColorType_MAJI(i_this->mpModel->mModelData, &i_this->tevStr); + mDoExt_modelUpdateDL(i_this->mpModel); + } + } -/* ############################################################################################## */ -/* 8046B0D0-8046B0D0 00010C 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_8046B0D0 = "SHOKUDAI_SWITCH"; -#pragma pop + if (i_this->field_0xa79 != 0) { + hahen_draw(i_this); + } + + return 1; +} /* 804695F8-80469658 001478 0060+00 2/2 0/0 0/0 .text ep_switch_event_end__FP8ep_class */ -static void ep_switch_event_end(ep_class* param_0) { - // NONMATCHING +static BOOL ep_switch_event_end(ep_class* i_this) { + int rv = FALSE; + if (dComIfGp_evmng_endCheck("SHOKUDAI_SWITCH") != 0) { + dComIfGp_event_reset(); + rv = TRUE; + } + return rv; } -/* ############################################################################################## */ -/* 8046B0D0-8046B0D0 00010C 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_8046B0E0 = "SHOKUDAI"; -#pragma pop +/* 80469658-80469700 0014D8 00A8+00 1/1 0/0 0/0 .text ep_switch_event_begin__FP8ep_class */ +static BOOL ep_switch_event_begin(ep_class* i_this) { + BOOL rv = 0; -/* 80469658-80469700 0014D8 00A8+00 1/1 0/0 0/0 .text ep_switch_event_begin__FP8ep_class - */ -static void ep_switch_event_begin(ep_class* param_0) { - // NONMATCHING + if (!i_this->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderOtherEvent(i_this, "SHOKUDAI_SWITCH", 0xffff, 1, 0); + } else { + i_this->eventInfo.onCondition(2); + rv = dComIfGp_evmng_getMyStaffId("SHOKUDAI", 0, 0); + if (rv == -1) { + ep_switch_event_end(i_this); + } + } + + return rv; } -/* ############################################################################################## */ -/* 8046B0D0-8046B0D0 00010C 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_8046B0E9 = "WAIT"; -SECTION_DEAD static char const* const stringBase_8046B0EE = "FIRE"; -#pragma pop - -/* 8046B120-8046B128 -00001 0008+00 1/1 0/0 0/0 .data actions$4245 */ -SECTION_DATA static void* actions[2] = { - (void*)(((char*)&d_a_ep__stringBase0) + 0x19), - (void*)(((char*)&d_a_ep__stringBase0) + 0x1E), -}; - -/* 80469700-804697F4 001580 00F4+00 1/1 0/0 0/0 .text ep_switch_event_move__FP8ep_class - */ -static void ep_switch_event_move(ep_class* param_0) { +/* 80469700-804697F4 001580 00F4+00 1/1 0/0 0/0 .text ep_switch_event_move__FP8ep_class */ +static int ep_switch_event_move(ep_class* i_this) { // NONMATCHING + static char* actions[2] = { + "WAIT", + "FIRE", + }; + + int rv = 0; + + if (dComIfGp_evmng_getIsAddvance(i_this->field_0xa5c)) { + rv = dComIfGp_evmng_getMyActIdx(i_this->field_0xa5c, actions, 2, 0, 0); + switch (rv) { + case 1: + if (i_this->field_0xa5b == 0) { + mDoAud_seStart(Z2SE_OBJ_FIRE_IGNITION, &i_this->field_0x634, 0, 0); + } + break; + default: + rv = 0; + dComIfGp_evmng_cutEnd(i_this->field_0xa5c); + } + } + + return rv; } -/* ############################################################################################## */ -/* 8046B058-8046B05C 000094 0004+00 0/2 0/0 0/0 .rodata @4461 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4461 = 15.0f; -COMPILER_STRIP_GATE(0x8046B058, &lit_4461); -#pragma pop - -/* 8046B05C-8046B060 000098 0004+00 0/1 0/0 0/0 .rodata @4462 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4462 = 235.0f; -COMPILER_STRIP_GATE(0x8046B05C, &lit_4462); -#pragma pop - -/* 8046B060-8046B064 00009C 0004+00 0/1 0/0 0/0 .rodata @4463 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4463 = -240.0f; -COMPILER_STRIP_GATE(0x8046B060, &lit_4463); -#pragma pop - -/* 8046B064-8046B068 0000A0 0004+00 0/2 0/0 0/0 .rodata @4464 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4464 = 1.0f / 5.0f; -COMPILER_STRIP_GATE(0x8046B064, &lit_4464); -#pragma pop - -/* 8046B068-8046B06C 0000A4 0004+00 0/1 0/0 0/0 .rodata @4465 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4465 = 1.0f / 10.0f; -COMPILER_STRIP_GATE(0x8046B068, &lit_4465); -#pragma pop - -/* 8046B06C-8046B070 0000A8 0004+00 0/1 0/0 0/0 .rodata @4466 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4466 = 500.0f; -COMPILER_STRIP_GATE(0x8046B06C, &lit_4466); -#pragma pop - -/* 8046B070-8046B074 0000AC 0004+00 0/2 0/0 0/0 .rodata @4467 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4467 = 4.0f; -COMPILER_STRIP_GATE(0x8046B070, &lit_4467); -#pragma pop - -/* 8046B128-8046B12C 000030 0004+00 0/1 0/0 0/0 .data l_particle_fire_A$4270 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_particle_fire_A[4] = { - 0x01, - 0x00, - 0x81, - 0x10, -}; -#pragma pop - -/* 8046B12C-8046B130 000034 0004+00 0/1 0/0 0/0 .data l_particle_fire_B$4271 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_particle_fire_B[4] = { - 0x01, - 0x01, - 0x81, - 0x11, -}; -#pragma pop - -/* 8046B130-8046B134 000038 0004+00 0/1 0/0 0/0 .data l_particle_kagerou$4272 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_particle_kagerou[4] = { - 0x01, - 0x03, - 0x81, - 0x12, -}; -#pragma pop +// static inline bool dComIfGp_evmng_existence(char eventIdx) { +// return g_dComIfG_gameInfo.play.getEvtManager().getEventData( +// dComIfGp_evmng_getEventIdx(&eventIdx, -1)) != NULL; +// } /* 804697F4-80469EDC 001674 06E8+00 1/1 0/0 0/0 .text ep_move__FP8ep_class */ -static void ep_move(ep_class* param_0) { +static void ep_move(ep_class* i_this) { // NONMATCHING + static u16 l_particle_fire_A[2] = { + 0x0100, 0x8110, + }; + static u16 l_particle_fire_B[2] = { + 0x0101, 0x8111 + }; + static u16 l_particle_kagerou[2] = { + 0x0103, 0x8112 + }; + + cXyz sp1C(i_this->field_0x634.x, i_this->field_0x634.y + -240.0f + 235.0f +15.0f, i_this->field_0x634.z); + + switch (i_this->field_0x5a4) { + case 0: + if (i_this->field_0x60d != 0) { + cLib_addCalc0(&i_this->field_0x5b0, 0.5f, 0.05f); + if (!i_this->mSph1.ChkTgHit() || + (i_this->mSph1.GetTgHitObj()->ChkAtType(0) || i_this->mSph1.GetTgHitGObj())) { + if (i_this->mSph1.GetTgHitGObj()->GetAtMtrl() == 1) { + if (i_this->field_0x609 != 0xff) { + i_this->field_0x5ce = i_this->field_0x609 * 10 + 1; + } + } + } + + if (dComIfGs_isSwitch(i_this->field_0x60d - 1, fopAcM_GetRoomNo(i_this))) { + if (i_this->field_0x60b == 0xff || + g_dComIfG_gameInfo.play.getEvtManager().getEventData( + dComIfGp_evmng_getEventIdx("SHOKUDAI_SWITCH", -1))) { + int iVar3 = ep_switch_event_begin(i_this); + i_this->field_0xa5c = iVar3; + if (iVar3) { + i_this->field_0x60d = 0; + if (i_this->field_0xa5c != -1) { + ep_switch_event_move(i_this); + } + } + } else { + if (i_this->field_0xa5b == 0) { + mDoAud_seStart(Z2SE_OBJ_FIRE_IGNITION, &i_this->field_0x634, + 0, 0); + } + i_this->field_0x60d = 0; + } + } + } else { + if (i_this->field_0x60b == -1 || i_this->field_0xa5c == -1) { + if (ep_switch_event_move(i_this)) { + i_this->field_0x5a4 = 3; + i_this->field_0x5b4 = i_this->scale.x; + } + } else { + i_this->field_0x5a4 = 3; + i_this->field_0x5b4 = i_this->scale.x; + } + } + case 3: + i_this->field_0x5a4++; + case 4: + cLib_addCalc2(&i_this->field_0x5b0, i_this->field_0x5b4, 0.5f, 0.2f); + if (i_this->field_0xa79 == 0) { + if (i_this->field_0xa50 < 7) { + dComIfGp_particle_setSimple(l_particle_fire_A[i_this->field_0x60c], + &sp1C, 0xff, g_whiteColor, g_whiteColor, + 0, 0.0f); + dComIfGp_particle_setSimple(l_particle_fire_B[i_this->field_0x60c], + &sp1C, 0xff, g_whiteColor, g_whiteColor, + 0, 0.0f); + + if (i_this->field_0xa50 == 0 && i_this->mSph1.ChkTgHit()) { + fopAc_ac_c* pfVar4 = dCc_GetAc(i_this->mSph1.GetTgHitObj()->GetAc()); + i_this->field_0xa58 = cM_atan2s(i_this->current.pos.x - pfVar4->current.pos.x, + i_this->current.pos.z - pfVar4->current.pos.z); + i_this->field_0xa50 = 0x28; + } + } + + dComIfGp_particle_setSimple(l_particle_kagerou[i_this->field_0x60c], + &sp1C, 0xff, g_whiteColor, g_whiteColor, + 0, 0.0f); + } + + if (i_this->field_0x5ce == 1 && i_this->field_0x60a != 0xff) { + dComIfGs_offSwitch(i_this->field_0x60a, fopAcM_GetRoomNo(i_this)); + } + + if (i_this->field_0x60a != 0xff) { + if (!dComIfGs_isSwitch(i_this->field_0x60a, fopAcM_GetRoomNo(i_this))) { + i_this->field_0x5a4 = 0; + if (i_this->field_0x60a != 0xff) { + i_this->field_0x60d = i_this->field_0x60a + 1; + } + + if (i_this->field_0xa5b == 0) { + mDoAud_seStart(Z2SE_OBJ_FIRE_OFF, &i_this->field_0x634, 0, 0); + } + } + } else { + mDoAud_seStart(Z2SE_OBJ_FIRE_BURNING, &i_this->field_0x634, 0, 0); + } + + if (i_this->field_0xa5c != -1) { + if (ep_switch_event_end(i_this)) { + i_this->field_0xa5c = -1; + } else { + dComIfGp_evmng_cutEnd(i_this->field_0xa5c); + } + } + break; + case 10: + cLib_addCalc0(&i_this->field_0x5b0, 1.0f, 0.1f); + if (i_this->field_0x5b0 < 0.05f) { + if (i_this->mpModel) { + i_this->field_0x5a4 = 0; + if (i_this->field_0x60a != 0xff) { + dComIfGs_offSwitch(i_this->field_0x60a, fopAcM_GetRoomNo(i_this)); + i_this->field_0x60d = i_this->field_0x60a + 1; + } + } else { + fopAcM_delete(i_this); + } + } + break; + } + + i_this->mLightInf.mPosition = i_this->field_0x634; + i_this->mLightInf.mColor.r = 0xaf; + i_this->mLightInf.mColor.g = 0x5d; + i_this->mLightInf.mColor.b = 0; + i_this->mLightInf.mPow = i_this->field_0x5b0 * 500.0f; + i_this->mLightInf.mFluctuation = 1.0f; + i_this->scale.y = i_this->field_0x5b0; + + if (i_this->scale.y > 0.5f) { + i_this->mSph1.OnAtSetBit(); + } else { + i_this->mSph1.OffAtSetBit(); + } + + cXyz local_28(i_this->field_0x634.x, i_this->field_0x634.y + 30.0f, i_this->field_0x634.z); + i_this->mSph1.SetC(local_28); + dComIfG_Ccsp()->Set(&i_this->mSph1); + + if (i_this->field_0xa50 != 0) { + if (i_this->mBaseEmitter != NULL) { + f32 fVar1; + if (i_this->field_0xa50 > 10) { + fVar1 = 4.0f; + } else { + fVar1 = 0.0f; + } + + cLib_addCalc2(&i_this->field_0xa54, fVar1, 1.0f, 0.5f); + cMtx_YrotS(*calc_mtx, i_this->field_0xa58); + + cXyz local_34(0.0f, 1.0f, i_this->field_0xa54); + cXyz cStack_40; + MtxPosition(&local_34, &cStack_40); + + i_this->mBaseEmitter->setDirection(cStack_40); + + if (i_this->field_0xa50 == 1) { + i_this->mBaseEmitter->becomeInvalidEmitter(); + i_this->mBaseEmitter = NULL; + } + } + + i_this->field_0xa50--; + } + return; } -/* ############################################################################################## */ -/* 8046B074-8046B078 0000B0 0004+00 0/1 0/0 0/0 .rodata @4502 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4502 = 140.0f; -COMPILER_STRIP_GATE(0x8046B074, &lit_4502); -#pragma pop - -/* 8046B078-8046B07C 0000B4 0004+00 0/1 0/0 0/0 .rodata @4503 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4503 = 280.0f; -COMPILER_STRIP_GATE(0x8046B078, &lit_4503); -#pragma pop - /* 80469EDC-8046A0A8 001D5C 01CC+00 1/1 0/0 0/0 .text daEp_set_mtx__FP8ep_class */ -static void daEp_set_mtx(ep_class* param_0) { - // NONMATCHING +static void daEp_set_mtx(ep_class* i_this) { + if (i_this->mpModel) { + f32 fVar1 = 70.0f; + if ((i_this->field_0xa5a & 1) != 0) { + fVar1 = 140.0f; + } + + MtxTrans(i_this->current.pos.x, i_this->current.pos.y, i_this->current.pos.z, 0); + cMtx_YrotM(*calc_mtx, i_this->current.angle.y); + MtxTrans(0.0f, fVar1, 0.0f, 1); + cMtx_XrotM(*calc_mtx, i_this->shape_angle.x); + MtxTrans(0.0f, -fVar1, 0.0f, 1); + i_this->mpModel->setBaseTRMtx(*calc_mtx); + + i_this->field_0x5dc = i_this->field_0x634; + i_this->field_0x5f4 = i_this->field_0x5e8; + + cXyz local_28; + local_28.z = 0.0f; + local_28.x = 0.0f; + if ((i_this->field_0xa5a & 1) != 0) { + local_28.y = 280.0f; + } else { + local_28.y = 140.0f; + } + MtxPosition(&local_28, &i_this->field_0x634); + + i_this->eyePos = i_this->field_0x634; + i_this->eyePos.y += 20.0f; + i_this->attention_info.position = i_this->eyePos; + i_this->attention_info.position.y += 30.0f; + + local_28.y = 0.0f; + MtxPosition(&local_28, &i_this->field_0x5e8); + } else { + i_this->field_0x634 = i_this->current.pos; + } } -/* ############################################################################################## */ -/* 8046B07C-8046B080 0000B8 0004+00 0/1 0/0 0/0 .rodata @4627 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4627 = 8000.0f; -COMPILER_STRIP_GATE(0x8046B07C, &lit_4627); -#pragma pop - -/* 8046B080-8046B084 0000BC 0004+00 0/1 0/0 0/0 .rodata @4628 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4628 = -100.0f; -COMPILER_STRIP_GATE(0x8046B080, &lit_4628); -#pragma pop - -/* 8046B084-8046B088 0000C0 0004+00 0/1 0/0 0/0 .rodata @4629 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4629 = -9.0f / 10.0f; -COMPILER_STRIP_GATE(0x8046B084, &lit_4629); -#pragma pop - -/* 8046B088-8046B08C 0000C4 0004+00 0/1 0/0 0/0 .rodata @4630 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4630 = 1000000.0f; -COMPILER_STRIP_GATE(0x8046B088, &lit_4630); -#pragma pop - -/* 8046B08C-8046B090 0000C8 0004+00 0/1 0/0 0/0 .rodata @4631 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4631 = -30.0f; -COMPILER_STRIP_GATE(0x8046B08C, &lit_4631); -#pragma pop - -/* 8046B090-8046B094 0000CC 0004+00 0/1 0/0 0/0 .rodata @4632 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4632 = 180.0f; -COMPILER_STRIP_GATE(0x8046B090, &lit_4632); -#pragma pop - -/* 8046B094-8046B098 0000D0 0004+00 0/1 0/0 0/0 .rodata @4633 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4633 = 8.0f; -COMPILER_STRIP_GATE(0x8046B094, &lit_4633); -#pragma pop - -/* 8046B098-8046B09C 0000D4 0004+00 0/1 0/0 0/0 .rodata @4634 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4634 = 11.0f / 20.0f; -COMPILER_STRIP_GATE(0x8046B098, &lit_4634); -#pragma pop - -/* 8046B09C-8046B0A0 0000D8 0004+00 0/1 0/0 0/0 .rodata @4635 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4635 = 0.75f; -COMPILER_STRIP_GATE(0x8046B09C, &lit_4635); -#pragma pop - -/* 8046B0A0-8046B0A4 0000DC 0004+00 0/1 0/0 0/0 .rodata @4636 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4636 = 3.0f / 40.0f; -COMPILER_STRIP_GATE(0x8046B0A0, &lit_4636); -#pragma pop - -/* 8046B0A4-8046B0A8 0000E0 0004+00 0/1 0/0 0/0 .rodata @4637 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4637 = 2.0f / 5.0f; -COMPILER_STRIP_GATE(0x8046B0A4, &lit_4637); -#pragma pop - -/* 8046B0A8-8046B0AC 0000E4 0004+00 0/1 0/0 0/0 .rodata @4638 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4638 = 1.0f / 25.0f; -COMPILER_STRIP_GATE(0x8046B0A8, &lit_4638); -#pragma pop - -/* 8046B0AC-8046B0B0 0000E8 0004+00 1/2 0/0 0/0 .rodata @4639 */ -SECTION_RODATA static f32 const lit_4639 = -160.0f; -COMPILER_STRIP_GATE(0x8046B0AC, &lit_4639); - -/* 8046B0B0-8046B0B4 0000EC 0004+00 1/2 0/0 0/0 .rodata @4640 */ -SECTION_RODATA static f32 const lit_4640 = 160.0f; -COMPILER_STRIP_GATE(0x8046B0B0, &lit_4640); - -/* 8046B0B4-8046B0B8 0000F0 0004+00 0/1 0/0 0/0 .rodata @4641 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4641 = 40.0f; -COMPILER_STRIP_GATE(0x8046B0B4, &lit_4641); -#pragma pop - -/* 8046B0B8-8046B0BC 0000F4 0004+00 0/1 0/0 0/0 .rodata @4642 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4642 = 110.0f; -COMPILER_STRIP_GATE(0x8046B0B8, &lit_4642); -#pragma pop - -/* 8046B0BC-8046B0C0 0000F8 0004+00 0/1 0/0 0/0 .rodata @4643 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4643 = 3000.0f; -COMPILER_STRIP_GATE(0x8046B0BC, &lit_4643); -#pragma pop - -/* 8046B0C0-8046B0C4 0000FC 0004+00 0/1 0/0 0/0 .rodata @4644 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4644 = 1000.0f; -COMPILER_STRIP_GATE(0x8046B0C0, &lit_4644); -#pragma pop - -/* 8046B0C4-8046B0C8 000100 0004+00 0/1 0/0 0/0 .rodata @4645 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4645 = 2000.0f; -COMPILER_STRIP_GATE(0x8046B0C4, &lit_4645); -#pragma pop - -/* 8046B134-8046B13C 00003C 0006+02 1/1 0/0 0/0 .data eff_name$4560 */ -SECTION_DATA static u8 eff_name[6 + 2 /* padding */] = { - 0x83, - 0x40, - 0x83, - 0x41, - 0x83, - 0x42, - /* padding */ - 0x00, - 0x00, -}; - /* 8046A0A8-8046A6D4 001F28 062C+00 1/0 0/0 0/0 .text daEp_Execute__FP8ep_class */ -static void daEp_Execute(ep_class* param_0) { +static int daEp_Execute(ep_class* i_this) { // NONMATCHING + static u16 eff_name[3] = { + 0x8340, 0x8341, 0x8342, + }; + + i_this->field_0x601 = 0; + i_this->field_0x602 = 0; + if (i_this->field_0x640) { + i_this->field_0x640--; + } + + if (i_this->mpModel) { + cXyz local_78 = i_this->current.pos; + if (i_this->field_0x640 != 0) { + local_78.y -= 8000.0f; + } + + i_this->mCyl.SetC(i_this->current.pos); + dComIfG_Ccsp()->Set(&i_this->mCyl); + + if (i_this->field_0x640 == 0 && i_this->mCyl.ChkTgHit()) { + i_this->field_0x640 = 10; + daObj::HitSeStart(&i_this->current.pos, fopAcM_GetRoomNo(i_this), &i_this->mCyl, 11); + } + + fopAcM_rollPlayerCrash(i_this, 35.0f, 0, 200.0f, -100.0f, 0, -0.8999999761581421); + mDoLib_clipper::changeFar(1000000.0f); + i_this->field_0x602 = fopAcM_checkCullingBox(i_this->mpModel->mBaseTransformMtx, -30.0f, 0.0f, -30.0f, 30.0f, 180.0f, 30.0f); + mDoLib_clipper::resetFar(); + } + + for (int i = 0; i < 3; i++) { + if (i_this->field_0x5c8[i]) { + i_this->field_0x5c8[i]--; + } + } + + if (i_this->field_0x5ce && i_this->field_0x5ce < 10000) { + i_this->field_0x5ce--; + } + + if (!dComIfGp_event_runCheck() && i_this->field_0xa5b != 0) { + i_this->field_0xa5b--; + } + + if (!i_this->field_0x5c8[0]) { + i_this->field_0x5c8[0] = cM_rndF(5.0f); + i_this->field_0x5c4 = cM_rndF(4.0f) + 8.0f; + } + + if (!i_this->field_0x5c8[1]) { + if (i_this->field_0xa50) { + i_this->field_0x5c8[1] = cM_rndF(5.0f); + i_this->field_0x5bc = cM_rndF(0.2f) + 0.55f; + } else { + i_this->field_0x5c8[1] = cM_rndF(6.0f) + 3.0f; + i_this->field_0x5bc = cM_rndF(0.075f) + 0.75f; + } + } + + cLib_addCalc2(&i_this->field_0x5c0, i_this->field_0x5c4, 1.0f, 1.0f); + cLib_addCalc2(&i_this->field_0x5b8, i_this->field_0x5bc, 0.4f, 0.04f); + + mDoLib_clipper::changeFar(1000000.0f); + i_this->field_0x601 = fopAcM_checkCullingBox(i_this->field_0x570, -160.0f, -160.0f, -160.0f, 160.0f, 160.0f, 160.0f); + mDoLib_clipper::resetFar(); + + if (i_this->field_0xa79 == 0) { + ep_move(i_this); + if (i_this->mCyl.ChkTgHit()) { + i_this->mAtInfo.mpCollider = i_this->mCyl.GetTgHitObj(); + if (i_this->mAtInfo.mpCollider) { + at_power_check(&i_this->mAtInfo); + if (i_this->mAtInfo.mpCollider->ChkAtType(0x10040) || i_this->mAtInfo.mAttackPower >= 10) { + i_this->field_0xa79 = 1; + if (i_this->mAtInfo.mHitType == 1) { + dScnPly_c::setPauseTimer(2); + } + + mDoAud_seStart(JA_SE_OBJ_BREAK_WOOD_L, &i_this->field_0x634, 0, 0); + dKy_plight_cut(&i_this->mLightInf); + } + } + } + } + + fopAcM_OffStatus(i_this, 0); + i_this->attention_info.flags = 0; + cLib_offBit(i_this->attention_info.flags, 4); + + if (i_this->field_0xa79 == 1) { + i_this->field_0xa79 = 2; + i_this->mpModel = NULL; + ep_hahen_s* epHahenS = i_this->mHahen; + + for (int i = 0; i < 6; i++) { + epHahenS[i].field_0x97 = 1; + epHahenS[i].field_0x4 = i_this->home.pos; + if (i < 3) { + epHahenS[i].field_0x4.y += 40.0f; + epHahenS[i].field_0x28.z = 0x363c; + } else { + epHahenS[i].field_0x4.y += 110.0f; + epHahenS[i].field_0x28.z = -0x363c; + } + epHahenS[i].field_0x28.y = (i * 0x5555) + 1000; + + cMtx_YrotS(*calc_mtx, epHahenS[i].field_0x28.y); + cXyz local_84(0.0f, 0.0f, 10.0f); + cXyz cStack_90; + MtxPosition(&local_84, &cStack_90); + epHahenS[i].field_0x4 += cStack_90; + + epHahenS[i].field_0x90 = 3000.0f + cM_rndF(1000.0f); + epHahenS[i].field_0x92 = cM_rndFX(2000.0f); + epHahenS[i].field_0x1c.y = 20.0f + cM_rndF(15.0f); + epHahenS[i].field_0x1c.x = cM_rndFX(15.0f); + epHahenS[i].field_0x1c.z = cM_rndFX(15.0f); + epHahenS[i].field_0x96 = 0; + } + + cXyz local_9c = i_this->field_0x634; + local_9c.y += 20.0f; + + for (int i = 0; i < 3; i++) { + dComIfGp_particle_set(eff_name[i], &local_9c, NULL, NULL); + } + } + + if (i_this->field_0xa79) { + hahen_move(i_this); + } + + return 1; } /* 8046A6D4-8046A6DC 002554 0008+00 1/0 0/0 0/0 .text daEp_IsDelete__FP8ep_class */ -static bool daEp_IsDelete(ep_class* param_0) { - return true; +static int daEp_IsDelete(ep_class* i_this) { + return 1; } -/* ############################################################################################## */ -/* 8046B0D0-8046B0D0 00010C 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_8046B0F3 = "Ep"; -#pragma pop - /* 8046A6DC-8046A724 00255C 0048+00 1/0 0/0 0/0 .text daEp_Delete__FP8ep_class */ -static void daEp_Delete(ep_class* param_0) { - // NONMATCHING +static int daEp_Delete(ep_class* i_this) { + dComIfG_resDelete(&i_this->mPhase, "Ep"); + dKy_plight_cut(&i_this->mLightInf); + return 1; } -/* ############################################################################################## */ /* 8046B13C-8046B15C 000044 0020+00 1/1 0/0 0/0 .data model_d */ -SECTION_DATA static u8 model_d[32] = { - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x06, - 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, +static int model_d[8] = { + 3,4, 5, 6, 6, 6, 6, 6, }; /* 8046A724-8046A858 0025A4 0134+00 1/1 0/0 0/0 .text daEp_CreateHeap__FP10fopAc_ac_c */ -static void daEp_CreateHeap(fopAc_ac_c* param_0) { +static int daEp_CreateHeap(fopAc_ac_c* a_this) { // NONMATCHING + ep_class* i_this = (ep_class*)a_this; + + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Ep", model_d[i_this->field_0xa5a]); + JUT_ASSERT(0x855, modelData != 0); + + i_this->mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); + if (i_this->mpModel == NULL) { + return 0; + } + + MtxScale(0.0f, 0.0f, 0.0f, 0); + i_this->mpModel->setBaseTRMtx(*calc_mtx); + + modelData = (J3DModelData*)dComIfG_getObjectRes("Ep", 7); + JUT_ASSERT(0x884, modelData != 0); + + for (int i = 0; i < 6; i++) { + i_this->mHahen[i].mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); + if (i_this->mHahen[i].mpModel == NULL) { + return 0; + } + } + + return 1; + } /* 8046A858-8046A8D4 0026D8 007C+00 1/1 0/0 0/0 .text daEp_CreateInit__FP10fopAc_ac_c */ -static void daEp_CreateInit(fopAc_ac_c* param_0) { - // NONMATCHING +static void daEp_CreateInit(fopAc_ac_c* a_this) { + ep_class* i_this = (ep_class*)a_this; + + i_this->field_0x5a4 = 0; + i_this->field_0x60d = 0; + fopAcM_SetMtx(i_this, i_this->field_0x570); + fopAcM_SetMin(i_this, -160.0f, -160.0f, -160.0f); + fopAcM_SetMax(i_this, 160.0f, 160.0f, 160.0f); + daEp_set_mtx(i_this); + i_this->field_0x601 = 0; + i_this->field_0x602 = 0; } -/* ############################################################################################## */ -/* 8046B0C8-8046B0CC 000104 0004+00 0/1 0/0 0/0 .rodata @4763 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4763 = 240.0f; -COMPILER_STRIP_GATE(0x8046B0C8, &lit_4763); -#pragma pop - -/* 8046B0CC-8046B0D0 000108 0004+00 0/1 0/0 0/0 .rodata @4764 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4764 = 255.0f; -COMPILER_STRIP_GATE(0x8046B0CC, &lit_4764); -#pragma pop - -/* 8046B15C-8046B19C 000064 0040+00 0/1 0/0 0/0 .data sph_src$4695 */ -#pragma push -#pragma force_active on -static dCcD_SrcSph sph_src = { - { - {0x0, {{0x0, 0x0, 0x10}, {0x20, 0x11}, 0x0}}, // mObj - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt - {dCcD_SE_NONE, 0x0, 0x0, 0x1, 0x0}, // mGObjTg - {0x0}, // mGObjCo - }, // mObjInf - { - {{0.0f, 0.0f, 0.0f}, 40.0f} // mSph - } // mSphAttr -}; -#pragma pop - -/* 8046B19C-8046B1E0 0000A4 0044+00 0/1 0/0 0/0 .data co_cyl_src$4702 */ -#pragma push -#pragma force_active on -static dCcD_SrcCyl co_cyl_src = { - { - {0x0, {{0x0, 0x0, 0x0}, {0xd8fbfdbf, 0x1f}, 0x79}}, // 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}, // mCenter - 35.0f, // mRadius - 120.0f // mHeight - } // mCyl -}; -#pragma pop - -/* 8046B1E0-8046B220 0000E8 0040+00 0/1 0/0 0/0 .data at_sph_src$4710 */ -#pragma push -#pragma force_active on -static dCcD_SrcSph at_sph_src = { - { - {0x0, {{AT_TYPE_THROW_OBJ, 0x0, 0x1f}, {0x0, 0x0}, 0x0}}, // mObj - {dCcD_SE_THROW_OBJ, 0x1, 0x0, 0x0, 0x1}, // mGObjAt - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg - {0x0}, // mGObjCo - }, // mObjInf - { - {{0.0f, 0.0f, 0.0f}, 40.0f} // mSph - } // mSphAttr -}; -#pragma pop - /* 8046A8D4-8046AB2C 002754 0258+00 1/0 0/0 0/0 .text daEp_Create__FP10fopAc_ac_c */ -static void daEp_Create(fopAc_ac_c* param_0) { - // NONMATCHING +static int daEp_Create(fopAc_ac_c* a_this) { + static dCcD_SrcSph sph_src = { + { + {0x0, {{0x0, 0x0, 0x10}, {0x20, 0x11}, 0x0}}, // mObj + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt + {dCcD_SE_NONE, 0x0, 0x0, 0x1, 0x0}, // mGObjTg + {0x0}, // mGObjCo + }, // mObjInf + { + {{0.0f, 0.0f, 0.0f}, 40.0f} // mSph + } // mSphAttr + }; + + static dCcD_SrcCyl co_cyl_src = { + { + {0x0, {{0x0, 0x0, 0x0}, {0xd8fbfdbf, 0x1f}, 0x79}}, // 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}, // mCenter + 35.0f, // mRadius + 120.0f // mHeight + } // mCyl + }; + + static dCcD_SrcSph at_sph_src = { + { + {0x0, {{AT_TYPE_THROW_OBJ, 0x0, 0x1f}, {0x0, 0x0}, 0x0}}, // mObj + {dCcD_SE_THROW_OBJ, 0x1, 0x0, 0x0, 0x1}, // mGObjAt + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg + {0x0}, // mGObjCo + }, // mObjInf + { + {{0.0f, 0.0f, 0.0f}, 40.0f} // mSph + } // mSphAttr + }; + + int rv; + ep_class* i_this = (ep_class*)a_this; + fopAcM_SetupActor(a_this, ep_class); + + rv = dComIfG_resLoad(&i_this->mPhase, "Ep"); + if (rv == cPhs_COMPLEATE_e) { + if (fopAcM_GetParam(i_this) & 8) { + i_this->field_0x60c = fopAcM_GetParam(i_this) & 7; + i_this->field_0x60c += 1; + i_this->field_0x60c &= 1; + i_this->field_0xa5a = -1; + } else { + i_this->field_0xa5a = fopAcM_GetParam(i_this) & 7; + i_this->field_0xa5a += 1; + i_this->field_0xa5a &= 7; + } + + i_this->field_0x609 = fopAcM_GetParam(i_this) >> 8; + i_this->field_0x60b = fopAcM_GetParam(i_this) >> 16; + i_this->field_0x60a = fopAcM_GetParam(i_this) >> 24; + + i_this->mStts.Init(0xff, 0xff, i_this); + i_this->mSph1.Set(sph_src); + i_this->mSph1.SetStts(&i_this->mStts); + + if (i_this->field_0x60c == 1) { + i_this->mSph1.SetR(70.0f); + } + + if (i_this->field_0xa5a < 0) { + OS_REPORT(" ///// EP PARAM %x\n"); + } else { + if (!fopAcM_entrySolidHeap(i_this, daEp_CreateHeap, 0x4b000)) { + return cPhs_ERROR_e; + } + + i_this->mCyl.Set(co_cyl_src); + i_this->mCyl.SetStts(&i_this->mStts); + i_this->mCyl.OnTgNoHitMark(); + + if ((i_this->field_0xa5a & 1) != 0) { + i_this->mCyl.SetH(240.0f); + } + } + + daEp_CreateInit(i_this); + if (i_this->field_0x60a != 0xff) { + if (!dComIfGs_isSwitch(i_this->field_0x60a, fopAcM_GetRoomNo(i_this))) { + i_this->field_0x60d = i_this->field_0x60a + 1; + } + } + + i_this->field_0x5ce = 20000; + dKy_plight_set(&i_this->mLightInf); + i_this->field_0xe6c = cM_rndF(255.0f); + } + + i_this->field_0xa5c = -1; + i_this->attention_info.distances[4] = 7; + fopAcM_OnCarryType(i_this, fopAcM_CARRY_UNK_30); + + i_this->mSph2.Set(at_sph_src); + i_this->mSph2.SetStts(&i_this->mStts); + i_this->mSph2.OffAtVsPlayerBit(); + i_this->field_0xa5b = 60; + + return rv; } -/* ############################################################################################## */ /* 8046B220-8046B240 -00001 0020+00 1/0 0/0 0/0 .data l_daEp_Method */ -SECTION_DATA static void* l_daEp_Method[8] = { - (void*)daEp_Create__FP10fopAc_ac_c, - (void*)daEp_Delete__FP8ep_class, - (void*)daEp_Execute__FP8ep_class, - (void*)daEp_IsDelete__FP8ep_class, - (void*)daEp_Draw__FP8ep_class, - (void*)NULL, - (void*)NULL, - (void*)NULL, +static actor_method_class l_daEp_Method = { + (process_method_func)daEp_Create, + (process_method_func)daEp_Delete, + (process_method_func)daEp_Execute, + (process_method_func)daEp_IsDelete, + (process_method_func)daEp_Draw, }; /* 8046B240-8046B270 -00001 0030+00 0/0 0/0 1/0 .data g_profile_EP */ -SECTION_DATA extern void* g_profile_EP[12] = { - (void*)0xFFFFFFFD, (void*)0x0007FFFD, (void*)0x01050000, (void*)&g_fpcLf_Method, - (void*)0x00000E70, (void*)NULL, (void*)NULL, (void*)&g_fopAc_Method, - (void*)0x02B30000, (void*)&l_daEp_Method, (void*)0x10244000, (void*)0x000E0000, +extern actor_process_profile_definition g_profile_EP = { + fpcLy_CURRENT_e, + 7, + fpcPi_CURRENT_e, + PROC_EP, + &g_fpcLf_Method.base, + sizeof(ep_class), + 0, + 0, + &g_fopAc_Method.base, + 691, + &l_daEp_Method, + 0x10244000, + fopAc_ACTOR_e, + fopAc_CULLBOX_CUSTOM_e }; - -/* 8046B270-8046B27C 000178 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, -}; - -/* 8046B27C-8046B288 000184 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, -}; - -/* 8046B288-8046B2B8 000190 0030+00 3/3 0/0 0/0 .data __vt__14dBgS_ObjGndChk */ -SECTION_DATA extern void* __vt__14dBgS_ObjGndChk[12] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__14dBgS_ObjGndChkFv, - (void*)NULL, - (void*)NULL, - (void*)func_8046AFA4, - (void*)NULL, - (void*)NULL, - (void*)func_8046AFB4, - (void*)NULL, - (void*)NULL, - (void*)func_8046AFAC, -}; - -/* 8046B2B8-8046B2C4 0001C0 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, -}; - -/* 8046B2C4-8046B2D0 0001CC 000C+00 2/2 0/0 0/0 .data __vt__8cM3dGCyl */ -SECTION_DATA extern void* __vt__8cM3dGCyl[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__8cM3dGCylFv, -}; - -/* 8046B2D0-8046B2DC 0001D8 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, -}; - -/* 8046AB2C-8046ACC0 0029AC 0194+00 1/1 0/0 0/0 .text __ct__8ep_classFv */ -ep_class::ep_class() { - // NONMATCHING -} - -/* 8046ACC0-8046AD44 002B40 0084+00 1/1 0/0 0/0 .text __dt__10ep_hahen_sFv */ -ep_hahen_s::~ep_hahen_s() { - // NONMATCHING -} - -/* 8046AD44-8046ADB0 002BC4 006C+00 1/1 0/0 0/0 .text __ct__10ep_hahen_sFv */ -ep_hahen_s::ep_hahen_s() { - // NONMATCHING -} - -/* 8046ADB0-8046AE28 002C30 0078+00 4/3 0/0 0/0 .text __dt__14dBgS_ObjGndChkFv */ -dBgS_ObjGndChk::~dBgS_ObjGndChk() { - // NONMATCHING -} - -/* 8046AE28-8046AE70 002CA8 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGSphFv */ -// cM3dGSph::~cM3dGSph() { -extern "C" void __dt__8cM3dGSphFv() { - // NONMATCHING -} - -/* 8046AE70-8046AEB8 002CF0 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGCylFv */ -// cM3dGCyl::~cM3dGCyl() { -extern "C" void __dt__8cM3dGCylFv() { - // NONMATCHING -} - -/* 8046AEB8-8046AF00 002D38 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGAabFv */ -// cM3dGAab::~cM3dGAab() { -extern "C" void __dt__8cM3dGAabFv() { - // NONMATCHING -} - -/* 8046AF00-8046AF5C 002D80 005C+00 1/0 0/0 0/0 .text __dt__10dCcD_GSttsFv */ -// dCcD_GStts::~dCcD_GStts() { -extern "C" void __dt__10dCcD_GSttsFv() { - // NONMATCHING -} - -/* 8046AF5C-8046AFA4 002DDC 0048+00 1/0 0/0 0/0 .text __dt__10cCcD_GSttsFv */ -// cCcD_GStts::~cCcD_GStts() { -extern "C" void __dt__10cCcD_GSttsFv() { - // NONMATCHING -} - -/* 8046AFA4-8046AFAC 002E24 0008+00 1/0 0/0 0/0 .text @20@__dt__14dBgS_ObjGndChkFv */ -static void func_8046AFA4() { - // NONMATCHING -} - -/* 8046AFAC-8046AFB4 002E2C 0008+00 1/0 0/0 0/0 .text @76@__dt__14dBgS_ObjGndChkFv */ -static void func_8046AFAC() { - // NONMATCHING -} - -/* 8046AFB4-8046AFBC 002E34 0008+00 1/0 0/0 0/0 .text @60@__dt__14dBgS_ObjGndChkFv */ -static void func_8046AFB4() { - // NONMATCHING -} - -/* 8046B0D0-8046B0D0 00010C 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */