diff --git a/configure.py b/configure.py index c4754cc55..dc5155d96 100644 --- a/configure.py +++ b/configure.py @@ -1530,7 +1530,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_obj_ftree"), ActorRel(Matching, "d_a_obj_ganonbed", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_obj_gaship"), - ActorRel(NonMatching, "d_a_obj_gaship2"), + ActorRel(Matching, "d_a_obj_gaship2"), ActorRel(NonMatching, "d_a_obj_gnnbtltaki"), ActorRel(NonMatching, "d_a_obj_gnndemotakie"), ActorRel(NonMatching, "d_a_obj_gnndemotakis"), diff --git a/include/d/actor/d_a_obj_gaship2.h b/include/d/actor/d_a_obj_gaship2.h index 1e5d556b9..37e545a2a 100644 --- a/include/d/actor/d_a_obj_gaship2.h +++ b/include/d/actor/d_a_obj_gaship2.h @@ -1,22 +1,30 @@ #ifndef D_A_OBJ_GASHIP2_H #define D_A_OBJ_GASHIP2_H +#include "SSystem/SComponent/c_phase.h" +#include "d/d_bg_w.h" #include "f_op/f_op_actor.h" namespace daObjGaship2 { - class Act_c : public fopAc_ac_c { - public: - void solidHeapCB(fopAc_ac_c*); - void create_heap(); - s32 _create(); - BOOL _delete(); - void set_mtx(); - BOOL _execute(); - BOOL _draw(); - - public: - /* Place member variables here */ - }; +class Act_c : public fopAc_ac_c { +public: + virtual ~Act_c() {} + static BOOL solidHeapCB(fopAc_ac_c*); + bool create_heap(); + s32 _create(); + BOOL _delete(); + void set_mtx(); + BOOL _execute(); + BOOL _draw(); + + static const char M_arcname[8]; + + /* 0x290 */ request_of_phase_process_class mphs; + /* 0x29C */ J3DModel* mpModel; + /* 0x2A0 */ dBgW* field_x2A0; + /* 0x2A4 */ Mtx field_x2A4; + /* 0x2D4 u8 padding? */ }; +}; // namespace daObjGaship2 #endif /* D_A_OBJ_GASHIP2_H */ diff --git a/src/d/actor/d_a_obj_gaship2.cpp b/src/d/actor/d_a_obj_gaship2.cpp index e6808e355..fbde0c09b 100644 --- a/src/d/actor/d_a_obj_gaship2.cpp +++ b/src/d/actor/d_a_obj_gaship2.cpp @@ -4,39 +4,147 @@ // #include "d/actor/d_a_obj_gaship2.h" +#include "SSystem/SComponent/c_bg_w.h" +#include "d/d_com_inf_game.h" #include "dolphin/types.h" +#include "d/d_bg_s_movebg_actor.h" +#include "d/d_procname.h" +#include "m_Do/m_Do_mtx.h" + +const char daObjGaship2::Act_c::M_arcname[] = "YakeRom"; /* 00000078-0000009C .text solidHeapCB__Q212daObjGaship25Act_cFP10fopAc_ac_c */ -void daObjGaship2::Act_c::solidHeapCB(fopAc_ac_c*) { - /* Nonmatching */ +BOOL daObjGaship2::Act_c::solidHeapCB(fopAc_ac_c *i_this) { + return ((Act_c *) i_this)->create_heap(); } /* 0000009C-00000220 .text create_heap__Q212daObjGaship25Act_cFv */ -void daObjGaship2::Act_c::create_heap() { - /* Nonmatching */ +bool daObjGaship2::Act_c::create_heap() { + J3DModelData *mdl_data; + cBgD_t *bgw_data; + bool uVar4; + + mdl_data = (J3DModelData *) (dComIfG_getObjectRes(M_arcname, 4)); + JUT_ASSERT(0x5A, mdl_data != 0); + + mpModel = mDoExt_J3DModel__create(mdl_data, 0, 0x11000002); + set_mtx(); + bgw_data = (cBgD_t *) (dComIfG_getObjectRes(M_arcname, 7)); + JUT_ASSERT(0x67, bgw_data != 0); + if (bgw_data != NULL) { + field_x2A0 = new dBgW(); + if (field_x2A0 != NULL && (field_x2A0->Set(bgw_data, cBgW::MOVE_BG_e, &field_x2A4) == 1)) { + return false; + } + } + + uVar4 = false; + if (mdl_data != NULL && mpModel != NULL && bgw_data != NULL && field_x2A0 != NULL) { + uVar4 = true; + } + return uVar4; } /* 00000220-000002F8 .text _create__Q212daObjGaship25Act_cFv */ s32 daObjGaship2::Act_c::_create() { - /* Nonmatching */ + fopAcM_SetupActor(this, Act_c); + cPhs__Step phase = (cPhs__Step) dComIfG_resLoad(&mphs, M_arcname); + if (phase == cPhs_COMPLEATE_e) { + if (fopAcM_entrySolidHeap(this, solidHeapCB, 0x0) & 0xFF) { + fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); + dComIfG_Bgsp()->Regist(field_x2A0, this); + field_x2A0->SetCrrFunc(dBgS_MoveBGProc_Typical); + } else { + phase = cPhs_ERROR_e; + } + } + return phase; } /* 000002F8-00000384 .text _delete__Q212daObjGaship25Act_cFv */ BOOL daObjGaship2::Act_c::_delete() { - /* Nonmatching */ + if (heap != NULL && field_x2A0 != NULL) { + if (field_x2A0->ChkUsed()) { + dComIfG_Bgsp()->Release(field_x2A0); + } + } + + dComIfG_resDelete(&mphs, M_arcname); + return true; } /* 00000384-00000430 .text set_mtx__Q212daObjGaship25Act_cFv */ +// Not Matching void daObjGaship2::Act_c::set_mtx() { - /* Nonmatching */ + mpModel->setBaseScale(mScale); + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::ZXYrotM(shape_angle); + + mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); + MTXCopy(mDoMtx_stack_c::now, field_x2A4); + mpModel->calc(); } /* 00000430-00000468 .text _execute__Q212daObjGaship25Act_cFv */ BOOL daObjGaship2::Act_c::_execute() { - /* Nonmatching */ + set_mtx(); + field_x2A0->Move(); + return TRUE; } /* 00000468-00000508 .text _draw__Q212daObjGaship25Act_cFv */ BOOL daObjGaship2::Act_c::_draw() { - /* Nonmatching */ + dKy_getEnvlight().settingTevStruct(TEV_TYPE_BG0, ¤t.pos, &mTevStr); + dComIfGd_setListBG(); + dKy_getEnvlight().setLightTevColorType(mpModel, &mTevStr); + mDoExt_modelUpdateDL(mpModel); + dComIfGd_setList(); + return TRUE; +}; +namespace daObjGaship2 { + namespace { + s32 Mthd_Create(void *i_this) { + return ((daObjGaship2::Act_c *) i_this)->_create(); + } + + u8 Mthd_Delete(void *i_this) { + return ((daObjGaship2::Act_c *) i_this)->_delete(); + } + + u8 Mthd_Execute(void *i_this) { + return ((daObjGaship2::Act_c *) i_this)->_execute(); + } + + u8 Mthd_Draw(void *i_this) { + return ((daObjGaship2::Act_c *) i_this)->_draw(); + } + + BOOL Mthd_IsDelete(void *i_this) { + return TRUE; + } + actor_method_class Mthd_Table = { + (process_method_func) Mthd_Create, + (process_method_func) Mthd_Delete, + (process_method_func) Mthd_Execute, + (process_method_func) Mthd_IsDelete, + (process_method_func) Mthd_Draw, + }; + } } + +actor_process_profile_definition g_profile_Obj_Gaship2 = { + /* LayerID */ fpcLy_CURRENT_e, + /* ListID */ 3, + /* ListPrio */ fpcPi_CURRENT_e, + /* ProcName */ PROC_Obj_Gaship2, + /* Proc SubMtd */ &g_fpcLf_Method.mBase, + /* Size */ sizeof(daObjGaship2::Act_c), + /* SizeOther */ 0, + /* Parameters */ 0, + /* Leaf SubMtd */ &g_fopAc_Method.base, + /* Priority */ 0x0040, + /* Actor SubMtd */ &daObjGaship2::Mthd_Table, + /* Status */ fopAcStts_UNK40000_e, + /* Group */ fopAc_ACTOR_e, + /* Cull Type */ fopAc_CULLBOX_0_e, +}; \ No newline at end of file