diff --git a/configure.py b/configure.py index 46395c26a..775a07def 100644 --- a/configure.py +++ b/configure.py @@ -413,7 +413,7 @@ config.libs = [ Object(NonMatching, "d/actor/d_a_boomerang.cpp"), Object(NonMatching, "d/actor/d_a_dai_item.cpp"), Object(NonMatching, "d/actor/d_a_demo00.cpp"), - Object(NonMatching, "d/actor/d_a_disappear.cpp"), + Object(Matching, "d/actor/d_a_disappear.cpp"), Object(NonMatching, "d/actor/d_a_esa.cpp"), Object(NonMatching, "d/actor/d_a_grid.cpp"), Object(NonMatching, "d/actor/d_a_himo2.cpp"), diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 5cb4580df..fd9d354b1 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -838,6 +838,11 @@ inline JPABaseEmitter* dComIfGp_particle_set(u16 particleID, const cXyz* pos, co return dComIfGp_particle_set(particleID, pos, angle, scale, 0xFF, NULL, -1, NULL, NULL, NULL); } +inline void dComIfGp_particle_setStripes(u16 particleID, cXyz* pos, csXyz* angle, cXyz* scale, u8 param_4, u16 param_5) { + dPa_control_c* pParticle = g_dComIfG_gameInfo.play.getParticle(); + pParticle->setNormalStripes(particleID, pos, angle, scale, param_4, param_5); +} + inline void dComIfGp_particle_calc3D() { g_dComIfG_gameInfo.play.getParticle()->calc3D(); } diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index 4e6e70547..afe880c70 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -449,6 +449,8 @@ s32 fopAcM_createItemFromTable(cXyz* p_pos, int i_tableNo, int i_itemBitNo, int csXyz* p_angle, int param_5, cXyz * p_scale, f32* speedF, f32* speedY, bool createDirect); +s32 fopAcM_createIball(cXyz*, int, int, csXyz*, int); + s32 fopAcM_createDemoItem(cXyz* p_pos, int itemNo, int itemBitNo, csXyz* p_angle, int roomNo, cXyz* scale, u8 param_7); @@ -466,8 +468,8 @@ void* fopAcM_createItemForSimpleDemo(cXyz* p_pos, int i_itemNo, int i_roomNo, csXyz* p_angle, cXyz* p_scale, f32 speedF, f32 speedY); -s32 fopAcM_createItem(cXyz* p_pos, int itemNo, int param_3, int roomNo, csXyz* p_angle, - cXyz* p_scale, int param_7); +s32 fopAcM_createItem(cXyz* p_pos, int itemNo, int param_3, int roomNo, int param_4, csXyz* p_angle, + int param_7, cXyz* p_scale); void* fopAcM_fastCreateItem2(cXyz* p_pos, int itemNo, int param_3, int roomNo, int param_5, csXyz* p_angle, cXyz* p_scale); diff --git a/src/d/actor/d_a_disappear.cpp b/src/d/actor/d_a_disappear.cpp index ab4249210..0a195f121 100644 --- a/src/d/actor/d_a_disappear.cpp +++ b/src/d/actor/d_a_disappear.cpp @@ -3,36 +3,151 @@ // Translation Unit: d_a_disappear.cpp // -#include "d_a_disappear.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "f_op/f_op_actor.h" +#include "f_op/f_op_actor_mng.h" +#include "d/d_procname.h" +#include "d/d_com_inf_game.h" +#include "d/d_s_play.h" +#include "m_Do/m_Do_ext.h" #include "dolphin/types.h" + +extern dScnPly_reg_HIO_c g_regHIO; + +class disappear_class : public fopAc_ac_c { +public: + int m0000; + int m0004; + s32 mSwitchId; + s16 mTimer; +}; + /* 800E79C0-800E79C8 .text daDisappear_Draw__FP15disappear_class */ -void daDisappear_Draw(disappear_class*) { - /* Nonmatching */ +s32 daDisappear_Draw(disappear_class*) { + return TRUE; } /* 800E79C8-800E7AC0 .text daDisappear_Execute__FP15disappear_class */ -void daDisappear_Execute(disappear_class*) { - /* Nonmatching */ +s32 daDisappear_Execute(disappear_class* i_this) { + if (i_this->mTimer != 0) { + i_this->mTimer--; + + if (i_this->mTimer == 0) { + s8 health = i_this->mHealth; + + if (health != 1 && health != 3) { + if (health == 2) { + fopAcM_createItemForBoss(i_this->getPositionP(), 0, i_this->getRoomNo(), &i_this->current.angle, NULL, 0); + } + else if (health >= 0x0A && health <= 0x0D) { + if (health < 0x0D) { + static u32 ki_item_d[] = { + 0, 10, 16 + }; + + fopAcM_createItem(i_this->getPositionP(), ki_item_d[health - 0xA], -1, -1, 0, NULL, 4, NULL); + } + } + else { + fopAcM_createIball(i_this->getPositionP(), i_this->mItemTableIdx, i_this->getRoomNo(), &i_this->current.angle, i_this->mSwitchId); + } + } + } + } + else { + fopAcM_delete(i_this); + } + + return TRUE; } /* 800E7AC0-800E7AC8 .text daDisappear_IsDelete__FP15disappear_class */ -void daDisappear_IsDelete(disappear_class*) { - /* Nonmatching */ +s32 daDisappear_IsDelete(disappear_class*) { + return TRUE; } /* 800E7AC8-800E7AD0 .text daDisappear_Delete__FP15disappear_class */ -void daDisappear_Delete(disappear_class*) { - /* Nonmatching */ +s32 daDisappear_Delete(disappear_class*) { + return TRUE; } /* 800E7AD0-800E7DBC .text set_disappear__FP15disappear_classf */ -void set_disappear(disappear_class*, float) { +void set_disappear(disappear_class* i_this, float scale) { /* Nonmatching */ + s8 rev = dComIfGp_getReverb(i_this->getRoomNo()); + mDoAud_seStart(0x5801, &i_this->mEyePos, 0, rev); + + cXyz particleScale(scale, scale, scale); + i_this->mTimer = g_regHIO.mChild[8].mShortRegs[0] + 0x3A; + + switch (i_this->mHealth) { + case 0: + case 2: + case 10: + case 0xB: + case 0xC: + case 0xD: + dComIfGp_particle_set(0x14, &i_this->current.pos, 0, &particleScale, 0xFF, 0, -1, 0, 0, 0); + case 3: + dComIfGp_particle_set(0x13, &i_this->current.pos, 0, &particleScale, 0xff, 0, -1, 0, 0, 0); + dComIfGp_particle_setStripes(0x15, &i_this->current.pos, 0, &particleScale, 0xFF, 0x96); + dComIfGp_particle_set(0x16, &i_this->current.pos, 0, &particleScale, 0xff, 0, -1, 0, 0, 0); + break; + case 1: + dComIfGp_particle_set(0x13, &i_this->current.pos, 0, &particleScale, 0xff, 0, -1, 0, 0, 0); + dComIfGp_particle_set(0x16, &i_this->current.pos, 0, &particleScale, 0xff, 0, -1, 0, 0, 0); + break; + case 4: + dComIfGp_particle_set(0x043C, &i_this->current.pos, 0, 0, 0xff, 0, -1, 0, 0, 0); + dComIfGp_particle_set(0x043D, &i_this->current.pos, 0, 0, 0xff, 0, -1, 0, 0, 0); + dComIfGp_particle_set(0x043E, &i_this->current.pos, 0, 0, 0xff, 0, -1, 0, 0, 0); + break; + } } /* 800E7DBC-800E7E60 .text daDisappear_Create__FP10fopAc_ac_c */ -void daDisappear_Create(fopAc_ac_c*) { +s32 daDisappear_Create(fopAc_ac_c* i_this) { /* Nonmatching */ + disappear_class* dis = static_cast(i_this); + + fopAcM_SetupActor(dis, disappear_class); + + u32 params = dis->mBase.mParameters; + + dis->mHealth = dis->mBase.mParameters & 0xFF; + float scale = ((dis->mBase.mParameters >> 8) & 0xFF) * 0.1f; + + dis->mSwitchId = (dis->mBase.mParameters >> 0x10) & 0xFF; + if (dis->mSwitchId == 0xFF) { + dis->mSwitchId = -1; + } + + set_disappear(dis, scale); + return cPhs_COMPLEATE_e; } +actor_method_class l_daDisappear_Method = { + (process_method_func)daDisappear_Create, + (process_method_func)daDisappear_Delete, + (process_method_func)daDisappear_Execute, + (process_method_func)daDisappear_IsDelete, + (process_method_func)daDisappear_Draw, +}; + +extern actor_process_profile_definition g_profile_DISAPPEAR = { + fpcLy_CURRENT_e, + 7, + fpcLy_CURRENT_e, + PROC_DISAPPEAR, + &g_fpcLf_Method.mBase, + sizeof(disappear_class), + 0, + 0, + &g_fopAc_Method.base, + 0x0188, + &l_daDisappear_Method, + 0x00044000, + fopAc_ACTOR_e, + fopAc_CULLBOX_0_e, +};