diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 17e6d878c..7f5c4a055 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -1015,6 +1015,14 @@ inline void dComIfGd_setAlphaModel(unsigned char param_0, float(*param_1)[4], un g_dComIfG_gameInfo.drawlist.setAlphaModel(param_0, param_1, param_2); } +inline void dComIfGd_setAlphaModel2(unsigned char param_0, float(*param_1)[4], unsigned char param_2) { + g_dComIfG_gameInfo.drawlist.setAlphaModel2(param_0, param_1, param_2); +} + +inline const dDlst_alphaModel_c* dComIfGd_getAlphaModel2(unsigned char param_0, float(*param_1)[4], unsigned char param_2) { + return g_dComIfG_gameInfo.drawlist.getAlphaModel2(); +} + /** * === RESOURCE === */ diff --git a/include/d/d_drawlist.h b/include/d/d_drawlist.h index 822f660bb..d5000eca4 100644 --- a/include/d/d_drawlist.h +++ b/include/d/d_drawlist.h @@ -171,6 +171,11 @@ public: void create(int); void set(unsigned char, float(*)[4], unsigned char); void draw(float(*)[4]); +public: + short pad; + short pad2; + short pad3; + short mCount; }; class dDlst_list_c { @@ -200,6 +205,12 @@ public: void setAlphaModel(unsigned char param_0, float(*param_1)[4], unsigned char param_2) { mpAlphaModel0->set(param_0, param_1, param_2); } + void setAlphaModel2(unsigned char param_0, float(*param_1)[4], unsigned char param_2) { + mpAlphaModel2->set(param_0, param_1, param_2); + } + const dDlst_alphaModel_c* getAlphaModel2() { + return mpAlphaModel2; + } static void offWipe() { mWipe = false; } diff --git a/src/d/actor/d_a_spotbox.cpp b/src/d/actor/d_a_spotbox.cpp index c5138268d..aac6bb6f0 100644 --- a/src/d/actor/d_a_spotbox.cpp +++ b/src/d/actor/d_a_spotbox.cpp @@ -3,31 +3,78 @@ // Translation Unit: d_a_spotbox.cpp // -#include "d_a_spotbox.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "f_op/f_op_actor_mng.h" +#include "d/d_com_inf_game.h" +#include "m_Do/m_Do_mtx.h" #include "dolphin/types.h" +struct daSpotbox_c : public fopAc_ac_c { +public: + inline int create(); + inline int draw(); + inline int execute(); + inline u32 getType(); +public: + Mtx mtx; +}; /* size = 0x2A0 */ + +int daSpotbox_c::create() { + /* Matching 96% */ + fopAcM_SetupActor(this, daSpotbox_c); + float baseScale = this->getType() != 0 ? 100.0f : 1000.0f; + this->mScale.x *= baseScale; + this->mScale.y *= baseScale; + this->mScale.z *= (baseScale * 1.2f); + this->current.pos.y += this->mScale.y * 0.5f; + this->mCullMtx = ((daSpotbox_c *)this)->mtx; + fopAcM_setCullSizeBox(this, -0.5, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f); + + return cPhs_COMPLEATE_e; +} + +int daSpotbox_c::draw() { + if(g_dComIfG_gameInfo.drawlist.getAlphaModel2()->mCount != 0) { + g_dComIfG_gameInfo.drawlist.setAlphaModel2(0x3, this->mtx, 0x20); + } + return TRUE; +} + +int daSpotbox_c::execute() { + PSMTXTrans(mDoMtx_stack_c::now, this->current.pos.x, this->current.pos.y, this->current.pos.z); + mDoMtx_YrotM(mDoMtx_stack_c::now, this->current.angle.y); + mDoMtx_stack_c::scaleM(this->mScale.x, this->mScale.y, this->mScale.z); + PSMTXCopy(mDoMtx_stack_c::now, this->mtx); + return TRUE; +} + +u32 daSpotbox_c::getType() { + return fopAcM_GetParam(this) & 1; +} + + /* 00000078-000000C4 .text daSpotbox_Draw__FP11daSpotbox_c */ -void daSpotbox_Draw(daSpotbox_c*) { - /* Nonmatching */ +static int daSpotbox_Draw(daSpotbox_c* i_this) { + return ((daSpotbox_c*)i_this)->draw(); } /* 000000C4-00000138 .text daSpotbox_Execute__FP11daSpotbox_c */ -void daSpotbox_Execute(daSpotbox_c*) { - /* Nonmatching */ +static int daSpotbox_Execute(daSpotbox_c* i_this) { + return ((daSpotbox_c*)i_this)->execute(); } /* 00000138-00000140 .text daSpotbox_IsDelete__FP11daSpotbox_c */ -void daSpotbox_IsDelete(daSpotbox_c*) { - /* Nonmatching */ +static int daSpotbox_IsDelete(daSpotbox_c* i_this) { + return TRUE; } /* 00000140-00000170 .text daSpotbox_Delete__FP11daSpotbox_c */ -void daSpotbox_Delete(daSpotbox_c*) { - /* Nonmatching */ +static int daSpotbox_Delete(daSpotbox_c* self) { + self->~daSpotbox_c(); + return true; } /* 00000170-00000250 .text daSpotbox_Create__FP10fopAc_ac_c */ -void daSpotbox_Create(fopAc_ac_c*) { - /* Nonmatching */ +static int daSpotbox_Create(fopAc_ac_c* i_this) { + return ((daSpotbox_c*)i_this)->create(); } -