diff --git a/include/d/actor/d_a_bk.h b/include/d/actor/d_a_bk.h index 59d298de3..0a941c6e0 100644 --- a/include/d/actor/d_a_bk.h +++ b/include/d/actor/d_a_bk.h @@ -22,12 +22,16 @@ public: /* 0x02BC */ mDoExt_McaMorf* mpMorf; /* 0x02C0 */ u8 m02C0[0x02CC - 0x02C0]; /* 0x02CC */ s16 m02CC; - /* 0x02CE */ u8 m02CE[0x02D4 - 0x02CE]; + /* 0x02CE */ u8 m02CE[0x02D0 - 0x02CE]; + /* 0x02D0 */ J3DModel* m02D0; /* 0x02D4 */ u8 m02D4; /* 0x02D5 */ u8 m02D5; - /* 0x02D6 */ u8 m02D6[0x02DC - 0x02D6]; + /* 0x02D6 */ u8 m02D6[0x02D8 - 0x02D6]; + /* 0x02D8 */ J3DModel* m02D8; /* 0x02DC */ u8 m02DC; - /* 0x02DD */ u8 m02DD[0x0302 - 0x02DD]; + /* 0x02DD */ u8 m02DD[0x02E0 - 0x02DD]; + /* 0x02E0 */ u32 mShadowId; + /* 0x02E4 */ u8 m02E4[0x0302 - 0x02E4]; /* 0x0302 */ s16 m0302; /* 0x0304 */ u8 m0304[0x030C - 0x0304]; /* 0x030C */ s16 m030C; diff --git a/include/d/d_kankyo.h b/include/d/d_kankyo.h index 6e21b4cf4..0adbcb533 100644 --- a/include/d/d_kankyo.h +++ b/include/d/d_kankyo.h @@ -409,6 +409,7 @@ void dKy_plight_set(LIGHT_INFLUENCE*); void dKy_plight_priority_set(LIGHT_INFLUENCE*); void dKy_efplight_set(LIGHT_INFLUENCE* param_0); void dKy_plight_cut(LIGHT_INFLUENCE* param_0); +cXyz dKy_plight_near_pos(); void dKy_efplight_cut(LIGHT_INFLUENCE* param_0); void dKy_fog_startendz_set(f32, f32, f32); BOOL dKy_daynight_check(); diff --git a/src/d/actor/d_a_bk.cpp b/src/d/actor/d_a_bk.cpp index ebe270d66..3847691a8 100644 --- a/src/d/actor/d_a_bk.cpp +++ b/src/d/actor/d_a_bk.cpp @@ -257,7 +257,36 @@ static void br_draw(bk_class* i_this) { /* 00001B88-00001CD0 .text daBk_shadowDraw__FP8bk_class */ static BOOL daBk_shadowDraw(bk_class* i_this) { - /* Nonmatching */ + /* Nonmatching - regalloc */ + J3DModel* model = i_this->mpMorf->getModel(); + if (!fopAcM_checkCarryNow(i_this)) { + cXyz shadowPos( + i_this->current.pos.x, + i_this->current.pos.y + 150.0f + g_regHIO.mChild[8].mFloatRegs[18], + i_this->current.pos.z + ); + f32 temp = 800.0f + g_regHIO.mChild[8].mFloatRegs[19]; + f32 shadowSize = 40.0f + g_regHIO.mChild[8].mFloatRegs[17]; + i_this->mShadowId = dComIfGd_setShadow( + i_this->mShadowId, 1, model, &shadowPos, temp, shadowSize, + i_this->current.pos.y, i_this->mDamageReaction.mAcch.GetGroundH(), + i_this->mDamageReaction.mAcch.m_gnd, &i_this->mTevStr, + 0, 1.0f, dDlst_shadowControl_c::getSimpleTex() + ); + } + + if (i_this->mShadowId) { + daBoko_c* boko = (daBoko_c*)fopAcM_SearchByID(i_this->m1200); + if (boko) { + dComIfGd_addRealShadow(i_this->mShadowId, boko->model); + } + if (i_this->m02D4) { + dComIfGd_addRealShadow(i_this->mShadowId, i_this->m02D0); + } + if (i_this->m02DC) { + dComIfGd_addRealShadow(i_this->mShadowId, i_this->m02D8); + } + } } /* 00001CD0-00001F60 .text daBk_Draw__FP8bk_class */ @@ -338,8 +367,9 @@ static BOOL daBk_wepon_view_check(bk_class* i_this) { } /* 00003438-00003478 .text daBk_bomb_view_check__FP8bk_class */ -static void daBk_bomb_view_check(bk_class* i_this) { - /* Nonmatching */ +static BOOL daBk_bomb_view_check(bk_class* i_this) { + i_this->m11F8 = search_bomb(i_this, 1); + return i_this->m11F8 != NULL ? TRUE : FALSE; } /* 00003478-000034B8 .text daBk_bomb_check__FP8bk_class */ @@ -613,7 +643,18 @@ static BOOL daBk_IsDelete(bk_class* i_this) { /* 0000DD24-0000DDD8 .text daBk_Delete__FP8bk_class */ static BOOL daBk_Delete(bk_class* i_this) { - /* Nonmatching */ + dComIfG_resDelete(&i_this->mPhs, "Bk"); + if (i_this->heap) { + i_this->mpMorf->stopZelAnime(); + } + if (i_this->m121D) { + hio_set = 0; + mDoHIO_root.mDoHIO_deleteChild(l_bkHIO.mChildID); + } + i_this->m0350.end(); + i_this->mDamageReaction.mParticleCallBack.end(); + enemy_fire_remove(&i_this->mEnemyFire); + return TRUE; } /* 0000DDD8-0000E2C8 .text useHeapInit__FP10fopAc_ac_c */ diff --git a/src/d/d_drawlist.cpp b/src/d/d_drawlist.cpp index f9e692173..344d2ba70 100644 --- a/src/d/d_drawlist.cpp +++ b/src/d/d_drawlist.cpp @@ -821,7 +821,7 @@ cBgS_ShdwDraw::~cBgS_ShdwDraw() { } /* 800841B0-8008450C .text setShadowRealMtx__FPA4_fPA4_fPA4_fP4cXyzP4cXyzffP18dDlst_shadowPoly_cf */ -void setShadowRealMtx(Mtx, Mtx, Mtx, cXyz*, cXyz*, f32, f32, dDlst_shadowPoly_c*, f32) { +u8 setShadowRealMtx(Mtx, Mtx, Mtx, cXyz*, cXyz*, f32, f32, dDlst_shadowPoly_c*, f32) { /* Nonmatching */ } @@ -831,8 +831,29 @@ u32 dDlst_shadowReal_c::set(u32, s8, J3DModel*, cXyz*, f32, f32, dKy_tevstr_c*) } /* 800846C8-80084844 .text set2__18dDlst_shadowReal_cFUlScP8J3DModelP4cXyzffP12dKy_tevstr_c */ -u32 dDlst_shadowReal_c::set2(u32, s8, J3DModel*, cXyz*, f32, f32, dKy_tevstr_c*) { - /* Nonmatching */ +u32 dDlst_shadowReal_c::set2(u32 r26, s8 r27, J3DModel* r31, cXyz* r28, f32 f30, f32 f31, dKy_tevstr_c* tevstr) { + if (mModelNum == 0) { + cXyz lightPos = dKy_plight_near_pos(); + if (tevstr) { + lightPos = tevstr->mLightPosWorld; + } + mAlpha = setShadowRealMtx( + mViewMtx, mRenderProjMtx, mReceiverProjMtx, &lightPos, r28, f30, f31, &mShadowRealPoly, + r27 == 0 ? 0.0f : f31 * 0.00025f + ); + if (mAlpha == 0) { + return 0; + } + mState = 1; + mKey = r26; + field_0x1 = r27; + mModelNum = 0; + } + + JUT_ASSERT(3999, mModelNum < MODEL_MAX); + + mpModels[mModelNum++] = r31; + return mKey; } /* 80084844-800848E8 .text add__18dDlst_shadowReal_cFP8J3DModel */ @@ -909,7 +930,8 @@ int dDlst_shadowControl_c::setReal(u32 key, s8 size, J3DModel* model, cXyz* pos, dDlst_shadowReal_c * real = &mReal[0]; for (s32 i = 0; i < (s32)ARRAY_SIZE(mReal); i++, real++) { if (real->isNoUse()) { - return real->set(i, size, model, pos, f0, f1, tevstr); + while (++mNextID == 0) {} + return real->set(mNextID, size, model, pos, f0, f1, tevstr); } } @@ -917,8 +939,25 @@ int dDlst_shadowControl_c::setReal(u32 key, s8 size, J3DModel* model, cXyz* pos, } /* 80085170-8008520C .text setReal2__21dDlst_shadowControl_cFUlScP8J3DModelP4cXyzffP12dKy_tevstr_c */ -int dDlst_shadowControl_c::setReal2(u32, s8, J3DModel*, cXyz*, f32, f32, dKy_tevstr_c*) { - /* Nonmatching */ +int dDlst_shadowControl_c::setReal2(u32 key, s8 size, J3DModel* model, cXyz* pos, f32 f0, f32 f1, dKy_tevstr_c* tevstr) { + if (key != 0) { + dDlst_shadowReal_c * real = &mReal[0]; + for (s32 i = 0; i < (s32)ARRAY_SIZE(mReal); i++, real++) { + if (real->isUse() && real->checkKey(key)) { + return real->set2(key, size, model, pos, f0, f1, tevstr); + } + } + } + + dDlst_shadowReal_c * real = &mReal[0]; + for (s32 i = 0; i < (s32)ARRAY_SIZE(mReal); i++, real++) { + if (real->isNoUse()) { + while (++mNextID == 0) {} + return real->set2(mNextID, size, model, pos, f0, f1, tevstr); + } + } + + return 0; } /* 8008520C-80085274 .text addReal__21dDlst_shadowControl_cFUlP8J3DModel */