From 533cd90a5fc209043b0b3f766b867698c1973909 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Wed, 28 Feb 2024 22:20:26 -0500 Subject: [PATCH] d_a_hitobj OK (#606) * d_a_hitobj OK * Corrections to d_a_hitobj * Corrections to d_a_hitobj configure.py * Corrections to d_a_hitobj configure.py * Remove unnessecary pointer destructure * Cleanup d_a_hitobj --------- Co-authored-by: Jason Carpenter <5916026+breadbored@users.noreply.github.com> --- configure.py | 2 +- include/d/actor/d_a_hitobj.h | 15 ++++- src/d/actor/d_a_hitobj.cpp | 105 +++++++++++++++++++++++++++++++---- 3 files changed, 109 insertions(+), 13 deletions(-) diff --git a/configure.py b/configure.py index eac7b1de1..b423c1c3b 100644 --- a/configure.py +++ b/configure.py @@ -1230,7 +1230,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_ep"), ActorRel(Matching, "d_a_floor"), ActorRel(Matching, "d_a_grass"), - ActorRel(NonMatching, "d_a_hitobj"), + ActorRel(Matching, "d_a_hitobj", extra_cflags=['-pragma "nosyminline on"']), ActorRel(Matching, "d_a_hot_floor", extra_cflags=['-pragma "nosyminline on"']), ActorRel(Matching, "d_a_ikari"), ActorRel(NonMatching, "d_a_jbo"), diff --git a/include/d/actor/d_a_hitobj.h b/include/d/actor/d_a_hitobj.h index a8c17b5d6..4d16da6a4 100644 --- a/include/d/actor/d_a_hitobj.h +++ b/include/d/actor/d_a_hitobj.h @@ -2,10 +2,21 @@ #define D_A_HITOBJ_H #include "f_op/f_op_actor.h" +#include "dolphin/types.h" +#include "d/d_com_inf_game.h" +#include "SSystem/SComponent/c_m3d_g_sph.h" +#include "SSystem/SComponent/c_cc_s.h" +#include "SSystem/SComponent/c_phase.h" +#include "d/d_cc_d.h" class hitobj_class : public fopAc_ac_c { public: - /* Place member variables here */ -}; + /* 0x0290 */ request_of_phase_process_class mPhs; + /* 0x0298 */ u8 m0298; + /* 0x0299 */ u8 m0299; + /* 0x029A */ s16 m029a; + /* 0x029C */ dCcD_Stts mStts; + /* 0x02D8 */ dCcD_Sph mSph; +}; // Size: 0x0404 #endif /* D_A_HITOBJ_H */ diff --git a/src/d/actor/d_a_hitobj.cpp b/src/d/actor/d_a_hitobj.cpp index 72942dcb9..7394de457 100644 --- a/src/d/actor/d_a_hitobj.cpp +++ b/src/d/actor/d_a_hitobj.cpp @@ -5,28 +5,113 @@ #include "d/actor/d_a_hitobj.h" #include "dolphin/types.h" +#include "d/d_com_inf_game.h" +#include "f_op/f_op_actor.h" +#include "f_op/f_op_kankyo_mng.h" +#include "f_op/f_op_actor_mng.h" +#include "d/d_procname.h" + +static dCcD_SrcSph m_co_sph_src = { + // dCcD_SrcGObjInf + { + /* Flags */ 0, + /* SrcObjAt Type */ AT_TYPE_WATER, + /* SrcObjAt Atp */ 0, + /* SrcObjAt SPrm */ AT_SPRM_SET | AT_SPRM_VS_ENEMY | AT_SPRM_VS_OTHER, + /* SrcObjTg Type */ 0, + /* SrcObjTg SPrm */ TG_SPRM_SET | TG_SPRM_IS_ENEMY, + /* SrcObjCo SPrm */ 0, + /* SrcGObjAt Se */ 0, + /* SrcGObjAt HitMark */ 0, + /* SrcGObjAt Spl */ 0, + /* SrcGObjAt Mtrl */ 0, + /* SrcGObjAt SPrm */ 0, + /* SrcGObjTg Se */ 0, + /* SrcGObjTg HitMark */ 0, + /* SrcGObjTg Spl */ 0, + /* SrcGObjTg Mtrl */ 0, + /* SrcGObjTg SPrm */ 0, + /* SrcGObjCo SPrm */ 0, + }, + // cM3dGSphS + { + /* Center */ 0.0f, 0.0f, 0.0f, + /* Radius */ 100.0f, + }, +}; /* 00000078-00000080 .text daHitobj_Draw__FP12hitobj_class */ -static BOOL daHitobj_Draw(hitobj_class*) { - /* Nonmatching */ +static BOOL daHitobj_Draw(hitobj_class* i_this) { + return TRUE; } /* 00000080-000000E8 .text daHitobj_Execute__FP12hitobj_class */ -static BOOL daHitobj_Execute(hitobj_class*) { - /* Nonmatching */ +static BOOL daHitobj_Execute(hitobj_class* i_this) { + if (i_this->m029a != 0) { + i_this->m029a--; + + i_this->mSph.SetC(i_this->current.pos); + + dComIfG_Ccsp()->Set(&i_this->mSph); + } else { + fopKyM_Delete(i_this); + } + + return TRUE; } /* 000000E8-000000F0 .text daHitobj_IsDelete__FP12hitobj_class */ -static BOOL daHitobj_IsDelete(hitobj_class*) { - /* Nonmatching */ +static BOOL daHitobj_IsDelete(hitobj_class* i_this) { + return TRUE; } /* 000000F0-00000120 .text daHitobj_Delete__FP12hitobj_class */ -static BOOL daHitobj_Delete(hitobj_class*) { - /* Nonmatching */ +static BOOL daHitobj_Delete(hitobj_class* i_this) { + dComIfG_resDelete(&(i_this->mPhs), "Hitobj"); + return TRUE; } /* 00000120-0000025C .text daHitobj_Create__FP10fopAc_ac_c */ -static s32 daHitobj_Create(fopAc_ac_c*) { - /* Nonmatching */ +static s32 daHitobj_Create(fopAc_ac_c* pActor) { + hitobj_class* i_this = (hitobj_class*)pActor; + fopAcM_SetupActor(i_this, hitobj_class); + + int res = dComIfG_resLoad(&(i_this->mPhs), "Hitobj"); + if (res == cPhs_COMPLEATE_e) { + i_this->m0298 = fopAcM_GetParam(i_this) & 0xFF; + + i_this->mStts.Init(0xFF, 0xFF, i_this); + + i_this->mSph.Set(m_co_sph_src); + + i_this->mSph.SetStts(&i_this->mStts); + + i_this->m029a = 3; + } + return res; } + +static actor_method_class l_daHitobj_Method = { + (process_method_func)daHitobj_Create, + (process_method_func)daHitobj_Delete, + (process_method_func)daHitobj_Execute, + (process_method_func)daHitobj_IsDelete, + (process_method_func)daHitobj_Draw, +}; + +actor_process_profile_definition g_profile_HITOBJ = { + fpcLy_CURRENT_e, + 7, + fpcPi_CURRENT_e, + PROC_HITOBJ, + &g_fpcLf_Method.mBase, + sizeof(hitobj_class), + 0, + 0, + &g_fopAc_Method.base, + 0x00AB, + &l_daHitobj_Method, + fopAcStts_UNK40000_e, + fopAc_ACTOR_e, + fopAc_CULLBOX_0_e, +};