diff --git a/configure.py b/configure.py index a074a5ab0..1e383b958 100644 --- a/configure.py +++ b/configure.py @@ -1266,7 +1266,7 @@ config.libs = [ ActorRel(Matching, "d_a_obj_hole", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_obj_ice"), ActorRel(NonMatching, "d_a_obj_ikada"), - ActorRel(NonMatching, "d_a_obj_kanat"), + ActorRel(Matching, "d_a_obj_kanat"), ActorRel(NonMatching, "d_a_obj_leaves"), ActorRel(NonMatching, "d_a_obj_lpalm"), ActorRel(Matching, "d_a_obj_monument"), diff --git a/include/d/actor/d_a_obj_kanat.h b/include/d/actor/d_a_obj_kanat.h index 39492ebd7..dfb3fae3a 100644 --- a/include/d/actor/d_a_obj_kanat.h +++ b/include/d/actor/d_a_obj_kanat.h @@ -2,24 +2,41 @@ #define D_A_OBJ_KANAT_H #include "f_op/f_op_actor.h" +#include "d/d_bg_s_movebg_actor.h" +#include "JSystem/J3DGraphAnimator/J3DModel.h" +#include "d/d_particle.h" +#include "d/d_a_obj.h" namespace daObjKanat { - class Act_c : public fopAc_ac_c { + class Act_c : public dBgS_MoveBgActor { public: - void prm_get_swSave() const {} + enum Prm_e { + PRM_SWSAVE_W = 0x08, + PRM_UNK_S = 0x00, + }; + + static Mtx M_tmp_mtx; + static const char M_arcname[]; - void CreateHeap(); - s32 Create(); - void Mthd_Create(); + int prm_get_swSave() const { return daObj::PrmAbstract(this, PRM_SWSAVE_W, PRM_UNK_S); } + + int CreateHeap(); + int Create(); BOOL Delete(); - void Mthd_Delete(); + BOOL Execute(Mtx**); + BOOL Draw(); + + s32 Mthd_Create(); + BOOL Mthd_Delete(); void set_mtx(); void init_mtx(); - void Execute(float(**)[3][4]); - BOOL Draw(); public: - /* Place member variables here */ + /* 0x2C8 */ request_of_phase_process_class mPhs; + /* 0x2D0 */ J3DModel* mpModel; + /* 0x2D4 */ dPa_smokeEcallBack m2D4; + /* 0x2F4 */ u8 m2F4; + /* 0x2F5 */ u8 m2F5; }; }; diff --git a/include/d/d_particle.h b/include/d/d_particle.h index 38c8cfd7c..40e7032d9 100644 --- a/include/d/d_particle.h +++ b/include/d/d_particle.h @@ -48,13 +48,13 @@ public: virtual void end(); JPABaseEmitter* getEmitter() { return mpEmitter; } - void setRateOff(u8 param_0) { field_0x11 = param_0; } - bool isEnd() { return field_0x10 & 1; } + void setRateOff(u8 param_0) { mRateOff = param_0; } + bool isEnd() { return mFlag & 1; } /* 0x04 */ JPABaseEmitter* mpEmitter; /* 0x08 */ u8 field_0x08[0x10 - 0x08]; - /* 0x10 */ u8 field_0x10; - /* 0x11 */ u8 field_0x11; + /* 0x10 */ u8 mFlag; + /* 0x11 */ u8 mRateOff; /* 0x12 */ u8 field_0x12; /* 0x13 */ u8 field_0x13; }; // Size: 0x14 diff --git a/src/d/actor/d_a_obj_kanat.cpp b/src/d/actor/d_a_obj_kanat.cpp index 596df3a88..4a5ddb57b 100644 --- a/src/d/actor/d_a_obj_kanat.cpp +++ b/src/d/actor/d_a_obj_kanat.cpp @@ -4,55 +4,175 @@ // #include "d/actor/d_a_obj_kanat.h" -#include "dolphin/types.h" +#include "d/d_procname.h" +#include "m_Do/m_Do_mtx.h" +#include "d/d_com_inf_game.h" +#include "JSystem/JKernel/JKRHeap.h" + +Mtx daObjKanat::Act_c::M_tmp_mtx; +const char daObjKanat::Act_c::M_arcname[] = "Kanat"; + +enum KANAT_RES_FILE_ID { // IDs and indexes are synced + /* BDL */ + KANAT_BDL_KANAT=0x4, + + /* DZB */ + KANAT_DZB_KANAT=0x7, +}; /* 00000078-0000012C .text CreateHeap__Q210daObjKanat5Act_cFv */ -void daObjKanat::Act_c::CreateHeap() { - /* Nonmatching */ +int daObjKanat::Act_c::CreateHeap() { + J3DModelData* model_data = (J3DModelData*)dComIfG_getObjectRes(M_arcname, KANAT_BDL_KANAT); + JUT_ASSERT(79, model_data != 0); + mpModel = mDoExt_J3DModel__create(model_data, 0, 0x11020203); + return !!mpModel; } /* 0000012C-000001AC .text Create__Q210daObjKanat5Act_cFv */ -s32 daObjKanat::Act_c::Create() { - /* Nonmatching */ +int daObjKanat::Act_c::Create() { + fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); + init_mtx(); + fopAcM_setCullSizeBox(this, -500.0, -100.0f, -500.0f, 500.0f, 200.0f, 500.0f); + m2F4 = 0; + m2F5 = 1; + m2D4.setRateOff(0); + return TRUE; } /* 000001AC-000002EC .text Mthd_Create__Q210daObjKanat5Act_cFv */ -void daObjKanat::Act_c::Mthd_Create() { - /* Nonmatching */ +s32 daObjKanat::Act_c::Mthd_Create() { + fopAcM_SetupActor(this, daObjKanat::Act_c); + + if (fopAcM_isSwitch(this, prm_get_swSave())) { + return cPhs_UNK3_e; + } + + s32 phase_state = dComIfG_resLoad(&mPhs, M_arcname); + if (phase_state == cPhs_COMPLEATE_e) { + phase_state = MoveBGCreate(M_arcname, KANAT_DZB_KANAT, NULL, 0x6440); + JUT_ASSERT(126, (phase_state == cPhs_COMPLEATE_e) || (phase_state == cPhs_ERROR_e)); + } + + return phase_state; } /* 000002EC-0000031C .text Delete__Q210daObjKanat5Act_cFv */ BOOL daObjKanat::Act_c::Delete() { - /* Nonmatching */ + m2D4.end(); + return TRUE; } /* 0000031C-00000374 .text Mthd_Delete__Q210daObjKanat5Act_cFv */ -void daObjKanat::Act_c::Mthd_Delete() { - /* Nonmatching */ +BOOL daObjKanat::Act_c::Mthd_Delete() { + s32 result = MoveBGDelete(); + if (fpcM_CreateResult(this) != cPhs_UNK3_e) { + dComIfG_resDelete(&mPhs, M_arcname); + } + return result; } /* 00000374-000003F4 .text set_mtx__Q210daObjKanat5Act_cFv */ void daObjKanat::Act_c::set_mtx() { - /* Nonmatching */ + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::ZXYrotM(shape_angle); + mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); + cMtx_copy(mDoMtx_stack_c::get(), M_tmp_mtx); } /* 000003F4-00000430 .text init_mtx__Q210daObjKanat5Act_cFv */ void daObjKanat::Act_c::init_mtx() { - /* Nonmatching */ + mpModel->setBaseScale(mScale); + set_mtx(); } /* 00000430-00000590 .text Execute__Q210daObjKanat5Act_cFPPA3_A4_f */ -void daObjKanat::Act_c::Execute(float(**)[3][4]) { - /* Nonmatching */ +BOOL daObjKanat::Act_c::Execute(Mtx** pMtx) { + if (m2F4 == 0) { + if (fopAcM_isSwitch(this, prm_get_swSave())) { + m2F4 = 1; + GXColor color; + color.r = mTevStr.mColorC0.r; + color.g = mTevStr.mColorC0.g; + color.b = mTevStr.mColorC0.b; + color.a = mTevStr.mColorC0.a; + dComIfGp_particle_set( + 0x82A2, ¤t.pos, ¤t.angle, NULL, 0xFF, + NULL, current.roomNo, &mTevStr.mColorK0, &color + ); + dComIfGp_particle_setToon( + 0xA2A3, ¤t.pos, ¤t.angle, NULL, 0xB4, + &m2D4, current.roomNo, &mTevStr.mColorK0, &color + ); + } + } else { + m2F5 = 0; + if (m2D4.isEnd()) { + fopAcM_delete(this); + } + } + set_mtx(); + *pMtx = &M_tmp_mtx; + return TRUE; } /* 00000590-00000644 .text Draw__Q210daObjKanat5Act_cFv */ BOOL daObjKanat::Act_c::Draw() { - /* Nonmatching */ + g_env_light.settingTevStruct(TEV_TYPE_BG0, ¤t.pos, &mTevStr); + g_env_light.setLightTevColorType(mpModel, &mTevStr); + if (m2F5 == 0) { + return TRUE; + } + dComIfGd_setListBG(); + mDoExt_modelUpdateDL(mpModel); + dComIfGd_setList(); + return TRUE; } +namespace daObjKanat { + namespace { + s32 Mthd_Create(void* i_this) { + return static_cast(i_this)->Mthd_Create(); + } + + BOOL Mthd_Delete(void* i_this) { + return static_cast(i_this)->Mthd_Delete(); + } + + BOOL Mthd_Execute(void* i_this) { + return static_cast(i_this)->MoveBGExecute(); + } + + BOOL Mthd_Draw(void* i_this) { + return static_cast(i_this)->MoveBGDraw(); + } + + BOOL Mthd_IsDelete(void* i_this) { + return static_cast(i_this)->MoveBGIsDelete(); + } + + static actor_method_class Mthd_Kanat = { + (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_Kanat = { + /* LayerID */ fpcLy_CURRENT_e, + /* ListID */ 3, + /* ListPrio */ fpcLy_CURRENT_e, + /* ProcName */ PROC_Obj_Kanat, + /* Proc SubMtd */ &g_fpcLf_Method.mBase, + /* Size */ sizeof(daObjKanat::Act_c), + /* SizeOther */ 0, + /* Parameters */ 0, + /* Leaf SubMtd */ &g_fopAc_Method.base, + /* Priority */ 0x0079, + /* Actor SubMtd */ &daObjKanat::Mthd_Kanat, + /* Status */ fopAcStts_CULL_e | fopAcStts_UNK40000_e, + /* Group */ fopAc_ACTOR_e, + /* CullType */ fopAc_CULLBOX_CUSTOM_e, +}; diff --git a/src/d/actor/d_a_sea.cpp b/src/d/actor/d_a_sea.cpp index 7cf8e0a11..d23364b1d 100644 --- a/src/d/actor/d_a_sea.cpp +++ b/src/d/actor/d_a_sea.cpp @@ -13,7 +13,7 @@ daSea_packet_c l_cloth; -f32 daSea_packet_c::BASE_HEIGHT = 1.0; +f32 daSea_packet_c::BASE_HEIGHT = 1.0f; daSea_WaveInfo__Table wi_prm_ocean[4] = { {