diff --git a/configure.py b/configure.py index f322bc4f9..39d72e7c8 100644 --- a/configure.py +++ b/configure.py @@ -1539,7 +1539,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_obj_hha"), ActorRel(NonMatching, "d_a_obj_hlift"), ActorRel(NonMatching, "d_a_obj_homen"), - ActorRel(NonMatching, "d_a_obj_homensmoke"), + ActorRel(Matching, "d_a_obj_homensmoke", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_obj_hsehi1"), ActorRel(NonMatching, "d_a_obj_htetu1"), ActorRel(NonMatching, "d_a_obj_iceisland"), diff --git a/include/JSystem/JParticle/JPAEmitter.h b/include/JSystem/JParticle/JPAEmitter.h index f9e247ca0..31c528625 100644 --- a/include/JSystem/JParticle/JPAEmitter.h +++ b/include/JSystem/JParticle/JPAEmitter.h @@ -128,10 +128,18 @@ public: void setGlobalDynamicsScale(const JGeometry::TVec3& scale) { mGlobalDynamicsScale.set(scale); } + void setEmitterScale(const JGeometry::TVec3& scale) { + mEmitterScale.set(scale); + } void setDirection(const JGeometry::TVec3& dir) { mEmitterDir.set(dir); } void setMaxFrame(s32 maxFrame) { mMaxFrame = maxFrame; } + void setGlobalPrmColor(u8 r, u8 g, u8 b) { + mGlobalPrmColor.r = r; + mGlobalPrmColor.g = g; + mGlobalPrmColor.b = b; + } void setVolumeSweep(float i_volSweep) { mVolumeSweep = i_volSweep; } void setLifeTime(s16 i_lifeTime) { mLifeTime = i_lifeTime; } @@ -156,7 +164,7 @@ public: static JPAEmitterInfo emtrInfo; /* 0x000 */ VolumeFunc mVolumeFunc; - /* 0x00C */ cXyz mEmitterScale; + /* 0x00C */ JGeometry::TVec3 mEmitterScale; /* 0x018 */ cXyz mEmitterTranslation; /* 0x024 */ csXyz mEmitterRot; /* 0x02A */ u8 mVolumeType; diff --git a/include/d/d_particle.h b/include/d/d_particle.h index 59d7dc5ce..42e3b25b0 100644 --- a/include/d/d_particle.h +++ b/include/d/d_particle.h @@ -49,6 +49,7 @@ public: JPABaseEmitter* getEmitter() { return mpEmitter; } void setRateOff(u8 param_0) { field_0x11 = param_0; } + bool isEnd() { return field_0x10 & 1; } /* 0x04 */ JPABaseEmitter* mpEmitter; /* 0x08 */ u8 field_0x08[0x10 - 0x08]; @@ -76,7 +77,7 @@ public: /* 0x16 */ GXColor field_0x16; /* 0x1A */ u8 field_0x1A[0x1C - 0x1A]; /* 0x1C */ dKy_tevstr_c* mTevstr; -}; +}; // Size: 0x20 STATIC_ASSERT(sizeof(dPa_smokeEcallBack) == 0x20); diff --git a/src/d/actor/d_a_obj_homensmoke.cpp b/src/d/actor/d_a_obj_homensmoke.cpp index 17af8cdbe..8d79275d5 100644 --- a/src/d/actor/d_a_obj_homensmoke.cpp +++ b/src/d/actor/d_a_obj_homensmoke.cpp @@ -3,101 +3,198 @@ // Translation Unit: d_a_obj_homensmoke.cpp // -#include "d_a_obj_homensmoke.h" -#include "dolphin/types.h" +#include "d/d_a_obj.h" +#include "d/d_procname.h" +#include "d/d_particle.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "m_Do/m_Do_mtx.h" +#include "d/d_com_inf_game.h" -/* 000000EC-00000230 .text set_mtx__Q215daObjHomensmoke5Act_cFv */ -void daObjHomensmoke::Act_c::set_mtx() { - /* Nonmatching */ -} +static u8 temp[0x4C]; -/* 00000230-0000026C .text __dt__4cXyzFv */ -cXyz::~cXyz() { - /* Nonmatching */ -} +namespace daObjHomensmoke { + class Act_c : public fopAc_ac_c { + public: + virtual ~Act_c() {} + void set_mtx(); + s32 _create(); + bool _delete(); + bool _execute(); + bool _draw(); + + int param_get_arg0() const { return daObj::PrmAbstract(this, 1, 0) & 0x1; } + int param_get_axis() const { return daObj::PrmAbstract(this, 1, 1) & 0x1; } + + /* 0x290 */ /* vtable */ + /* 0x294 */ u8 m294[0x29C - 0x294]; + /* 0x29C */ Mtx mMtx; + /* 0x2CC */ int mType; + /* 0x2D0 */ dPa_smokeEcallBack mSmokeCb; + /* 0x2F0 */ BOOL mbInitialized; + /* 0x2F4 */ cXyz mSmokePos; + }; -/* 0000026C-0000048C .text _create__Q215daObjHomensmoke5Act_cFv */ -void daObjHomensmoke::Act_c::_create() { - /* Nonmatching */ -} + /* 000000EC-00000230 .text set_mtx__Q215daObjHomensmoke5Act_cFv */ + void Act_c::set_mtx() { + if (param_get_axis() != 0) { + cXyz backOffset(0.0f, 0.0f, -200.0f); + cXyz forwardOffset(0.0f, 0.0f, 200.0f); + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::transM(forwardOffset); + cMtx_ZrotM(mDoMtx_stack_c::get(), shape_angle.z); + cMtx_YrotM(mDoMtx_stack_c::get(), shape_angle.y); + cMtx_XrotM(mDoMtx_stack_c::get(), shape_angle.x); + mDoMtx_stack_c::transM(backOffset); + mDoMtx_copy(mDoMtx_stack_c::get(), mMtx); + } else { + mDoMtx_stack_c::transS(current.pos); + cMtx_ZrotM(mDoMtx_stack_c::get(), shape_angle.z); + cMtx_YrotM(mDoMtx_stack_c::get(), shape_angle.y); + cMtx_XrotM(mDoMtx_stack_c::get(), shape_angle.x); + mDoMtx_copy(mDoMtx_stack_c::get(), mMtx); + } + } -/* 0000048C-000004C8 .text _delete__Q215daObjHomensmoke5Act_cFv */ -void daObjHomensmoke::Act_c::_delete() { - /* Nonmatching */ -} + /* 0000026C-0000048C .text _create__Q215daObjHomensmoke5Act_cFv */ + s32 Act_c::_create() { + fopAcM_SetupActor(this, Act_c); + + mbInitialized = FALSE; + + set_mtx(); + fopAcM_SetMtx(this, mMtx); + + mType = param_get_arg0(); + + struct daObjHomensmoke__cullbox { + /* 0x0 */ Vec mMin; + /* 0xC */ Vec mMax; + }; + static daObjHomensmoke__cullbox culling_dat[2] = { + {-300.0, -30.0, -100.0, 300.0, 600.0, 300.0}, + {-100.0, -30.0, -100.0, 100.0, 250.0, 120.0}, + }; + fopAcM_setCullSizeBox(this, + culling_dat[mType].mMin.x, culling_dat[mType].mMin.y, culling_dat[mType].mMin.z, + culling_dat[mType].mMax.x, culling_dat[mType].mMax.y, culling_dat[mType].mMax.z + ); + + fopAc_ac_c* parent = fopAcM_SearchByID(mParentPcId); + if (parent) { + mTevStr = parent->mTevStr; + } + + return cPhs_COMPLEATE_e; + } -/* 000004C8-00000738 .text _execute__Q215daObjHomensmoke5Act_cFv */ -void daObjHomensmoke::Act_c::_execute() { - /* Nonmatching */ -} + /* 0000048C-000004C8 .text _delete__Q215daObjHomensmoke5Act_cFv */ + bool Act_c::_delete() { + if (mSmokeCb.getEmitter()) { + mSmokeCb.end(); + } + return true; + } -/* 00000738-00000740 .text _draw__Q215daObjHomensmoke5Act_cFv */ -void daObjHomensmoke::Act_c::_draw() { - /* Nonmatching */ -} + /* 000004C8-00000738 .text _execute__Q215daObjHomensmoke5Act_cFv */ + bool Act_c::_execute() { + if (!mbInitialized) { + static cXyz norse_offsetL(0.0f, 300.0f, 20.0f); + static cXyz norse_offsetS(0.0f, 70.0f, 20.0f); + if (mType == 0) { + cMtx_multVec(mMtx, &norse_offsetL, &mSmokePos); + } else { + cMtx_multVec(mMtx, &norse_offsetS, &mSmokePos); + } + + JPABaseEmitter* smokeEmitter = dComIfGp_particle_setToon(0x2027, &mSmokePos, NULL, NULL, 0xFF, &mSmokeCb, fopAcM_GetRoomNo(this)); + if (smokeEmitter) { + static f32 rate_table[2] = {1.0f, 0.5f}; + f32 rate = rate_table[mType & 1]; + smokeEmitter->setGlobalAlpha(0xB4); + smokeEmitter->setRate(50.0f); + smokeEmitter->setMaxFrame(1); + JGeometry::TVec3 scale1; + scale1.set(rate, 0.0f, rate); + smokeEmitter->setEmitterScale(scale1); + scale1.set(rate*5.0f, rate*5.0f, rate*5.0f); + smokeEmitter->setGlobalDynamicsScale(scale1); + scale1.set(rate*6.0f, rate*6.0f, rate*6.0f); + smokeEmitter->setGlobalParticleScale(scale1); + } + + JPABaseEmitter* rubbleEmitter = dComIfGp_particle_setToon(0x81B1, ¤t.pos); + if (rubbleEmitter) { + rubbleEmitter->setGlobalPrmColor(mTevStr.mColorK0.r, mTevStr.mColorK0.g, mTevStr.mColorK0.b); + if (mType == 1) { + JGeometry::TVec3 scale(0.6f, 0.6f, 0.6f); + rubbleEmitter->setEmitterScale(scale); + rubbleEmitter->setGlobalDynamicsScale(scale); + rubbleEmitter->setGlobalParticleScale(scale); + } + rubbleEmitter->setGlobalRTMatrix(mMtx); + } + + mbInitialized = TRUE; + } else if (mSmokeCb.isEnd()) { + fopAcM_delete(this); + } + return true; + } -/* 00000740-00000760 .text Mthd_Create__Q215daObjHomensmoke32@unnamed@d_a_obj_homensmoke_cpp@FPv */ -void daObjHomensmoke::@unnamed@d_a_obj_homensmoke_cpp@::Mthd_Create(void*) { - /* Nonmatching */ -} + /* 00000738-00000740 .text _draw__Q215daObjHomensmoke5Act_cFv */ + bool Act_c::_draw() { + return true; + } -/* 00000760-00000784 .text Mthd_Delete__Q215daObjHomensmoke32@unnamed@d_a_obj_homensmoke_cpp@FPv */ -void daObjHomensmoke::@unnamed@d_a_obj_homensmoke_cpp@::Mthd_Delete(void*) { - /* Nonmatching */ -} + namespace { + /* 00000740-00000760 .text Mthd_Create__Q215daObjHomensmoke32@unnamed@d_a_obj_homensmoke_cpp@FPv */ + s32 Mthd_Create(void* i_this) { + return ((Act_c*)i_this)->_create(); + } -/* 00000784-000007A8 .text Mthd_Execute__Q215daObjHomensmoke32@unnamed@d_a_obj_homensmoke_cpp@FPv */ -void daObjHomensmoke::@unnamed@d_a_obj_homensmoke_cpp@::Mthd_Execute(void*) { - /* Nonmatching */ -} + /* 00000760-00000784 .text Mthd_Delete__Q215daObjHomensmoke32@unnamed@d_a_obj_homensmoke_cpp@FPv */ + BOOL Mthd_Delete(void* i_this) { + return ((Act_c*)i_this)->_delete(); + } -/* 000007A8-000007CC .text Mthd_Draw__Q215daObjHomensmoke32@unnamed@d_a_obj_homensmoke_cpp@FPv */ -void daObjHomensmoke::@unnamed@d_a_obj_homensmoke_cpp@::Mthd_Draw(void*) { - /* Nonmatching */ -} + /* 00000784-000007A8 .text Mthd_Execute__Q215daObjHomensmoke32@unnamed@d_a_obj_homensmoke_cpp@FPv */ + BOOL Mthd_Execute(void* i_this) { + return ((Act_c*)i_this)->_execute(); + } -/* 000007CC-000007D4 .text Mthd_IsDelete__Q215daObjHomensmoke32@unnamed@d_a_obj_homensmoke_cpp@FPv */ -void daObjHomensmoke::@unnamed@d_a_obj_homensmoke_cpp@::Mthd_IsDelete(void*) { - /* Nonmatching */ -} + /* 000007A8-000007CC .text Mthd_Draw__Q215daObjHomensmoke32@unnamed@d_a_obj_homensmoke_cpp@FPv */ + BOOL Mthd_Draw(void* i_this) { + return ((Act_c*)i_this)->_draw(); + } -/* 000007D4-000007D8 .text draw__34JPACallBackBaseFP14JPABaseEmitter */ -void JPACallBackBase::draw(JPABaseEmitter*) { - /* Nonmatching */ -} - -/* 000007D8-000007DC .text executeAfter__34JPACallBackBaseFP14JPABaseEmitter */ -void JPACallBackBase::executeAfter(JPABaseEmitter*) { - /* Nonmatching */ -} - -/* 000007DC-000007E0 .text execute__34JPACallBackBaseFP14JPABaseEmitter */ -void JPACallBackBase::execute(JPABaseEmitter*) { - /* Nonmatching */ -} - -/* 000007E0-000007E4 .text init__34JPACallBackBaseFP14JPABaseEmitter */ -void JPACallBackBase::init(JPABaseEmitter*) { - /* Nonmatching */ -} - -/* 000007E4-0000082C .text __dt__34JPACallBackBaseFv */ -JPACallBackBase::~JPACallBackBase() { - /* Nonmatching */ -} - -/* 0000082C-00000888 .text __dt__18dPa_levelEcallBackFv */ -dPa_levelEcallBack::~dPa_levelEcallBack() { - /* Nonmatching */ -} - -/* 00000888-0000093C .text __dt__Q215daObjHomensmoke5Act_cFv */ -daObjHomensmoke::Act_c::~Act_c() { - /* Nonmatching */ -} - -/* 0000093C-00000958 .text PrmAbstract__5daObjFPC10fopAc_ac_cii */ -void daObj::PrmAbstract(const fopAc_ac_c*, int, int) { - /* Nonmatching */ -} + /* 000007CC-000007D4 .text Mthd_IsDelete__Q215daObjHomensmoke32@unnamed@d_a_obj_homensmoke_cpp@FPv */ + BOOL Mthd_IsDelete(void* i_this) { + return TRUE; + } + + static 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_Homensmk = { + /* LayerID */ fpcLy_CURRENT_e, + /* ListID */ 3, + /* ListPrio */ fpcLy_CURRENT_e, + /* ProcName */ PROC_Obj_Homensmk, + /* Proc SubMtd */ &g_fpcLf_Method.mBase, + /* Size */ sizeof(daObjHomensmoke::Act_c), + /* SizeOther */ 0, + /* Parameters */ 0, + /* Leaf SubMtd */ &g_fopAc_Method.base, + /* Priority */ 0x0043, + /* Actor SubMtd */ &daObjHomensmoke::Mthd_Table, + /* Status */ fopAcStts_NOCULLEXEC_e | fopAcStts_CULL_e | fopAcStts_UNK4000_e | fopAcStts_UNK40000_e, + /* Group */ fopAc_ACTOR_e, + /* CullType */ fopAc_CULLBOX_CUSTOM_e, +};