diff --git a/configure.py b/configure.py index 69c0a200d..b293944d4 100755 --- a/configure.py +++ b/configure.py @@ -1458,7 +1458,7 @@ config.libs = [ ActorRel(Equivalent, "d_a_tag_hint", extra_cflags=['-pragma "nosyminline on"']), ActorRel(Matching, "d_a_tag_kb_item"), ActorRel(Equivalent, "d_a_tag_kk1", extra_cflags=['-pragma "nosyminline on"']), # weak func order - ActorRel(NonMatching, "d_a_tag_light"), + ActorRel(Equivalent, "d_a_tag_light", extra_cflags=['-pragma "nosyminline on"']), ActorRel(Matching, "d_a_tag_msg"), ActorRel(Matching, "d_a_tag_photo"), ActorRel(Matching, "d_a_tag_waterlevel"), diff --git a/include/d/actor/d_a_tag_light.h b/include/d/actor/d_a_tag_light.h index 1d1cdd45d..333bee9da 100644 --- a/include/d/actor/d_a_tag_light.h +++ b/include/d/actor/d_a_tag_light.h @@ -3,48 +3,83 @@ #include "f_op/f_op_actor.h" #include "d/d_a_obj.h" +#include "m_Do/m_Do_mtx.h" class J3DMaterial; +class mDoExt_btkAnm; namespace daTagLight { - static void get_cross_plane_line(cXyz*, float, float, float, float, float, float, float, float, float, float); + static bool get_cross_plane_line(cXyz*, float, float, float, float, float, float, float, float, float, float); class Act_c : public fopAc_ac_c { public: enum Prm_e { - PRM_CONERATIO_W = 0x04, - PRM_CONERATIO_S = 0x0A, + PRM_TYPE_W = 2, + PRM_TYPE_S = 0, + + PRM_SWSAVE2_W = 8, + PRM_SWSAVE2_S = 2, + + PRM_CCR_W = 2, + PRM_CCR_S = 8, + + PRM_CONERATIO_W = 4, + PRM_CONERATIO_S = 10, + + PRM_FADETYPE_W = 2, + PRM_FADETYPE_S = 14, + + PRM_SWSAVE_W = 8, + PRM_SWSAVE_S = 16, + + PRM_SCH_W = 8, + PRM_SCH_S = 24, }; - void chk_inside(const cXyz* pos) const { - /* Nonmatching */ - // M_box_x_min - // M_box_x_max - // M_box_y_min - // M_box_y_max - // M_box_z_min - // M_box_z_max - // M_cone_lower - // M_cone_upper - prm_get_coneRatio(); - // M_cone_r + bool chk_inside(const cXyz* pos) const { + if (m304) { + cXyz sp18; + mDoMtx_multVec(m2D4, pos, &sp18); + + if (m2A0 == 0) { + bool bVar2 = false; + if (sp18.x >= M_box_x_min && sp18.x <= M_box_x_max && + sp18.y >= M_box_y_min && sp18.y <= M_box_y_max && + sp18.z >= M_box_z_min && sp18.z <= M_box_z_max) { + bVar2 = true; + } + return bVar2; + } + + if (m2A0 == 1 && sp18.y >= M_cone_lower&& sp18.y <= M_cone_upper) { + f32 abs = sp18.absXZ(); + f32 fVar5 = (sp18.y - M_cone_lower) * (1.0f / (M_cone_upper - M_cone_lower)); + f32 ratio = prm_get_coneRatio(); + ratio = ratio * 0.06666667f; + + return abs <= ((1.0f - fVar5) + fVar5 * ratio) * M_cone_r; + } + } + + return false; } - void prm_get_ccR() const {} - int prm_get_coneRatio() const { return daObj::PrmAbstract(this, PRM_CONERATIO_W, PRM_CONERATIO_S); } - void prm_get_fadeType() const {} - void prm_get_sch() const {} - void prm_get_swSave() const {} - void prm_get_swSave2() const {} - void prm_get_type() const {} + + s32 prm_get_ccR() const { return daObj::PrmAbstract(this, PRM_CCR_W, PRM_CCR_S); } + s32 prm_get_coneRatio() const { return daObj::PrmAbstract(this, PRM_CONERATIO_W, PRM_CONERATIO_S); } + s32 prm_get_fadeType() const { return daObj::PrmAbstract(this, PRM_FADETYPE_W, PRM_FADETYPE_S); } + u8 prm_get_sch() const { return daObj::PrmAbstract(this, PRM_SCH_W, PRM_SCH_S); } + s32 prm_get_swSave() const { return daObj::PrmAbstract(this, PRM_SWSAVE_W, PRM_SWSAVE_S); } + s32 prm_get_swSave2() const { return daObj::PrmAbstract(this, PRM_SWSAVE2_W, PRM_SWSAVE2_S); } + s32 prm_get_type() const { return daObj::PrmAbstract(this, PRM_TYPE_W, PRM_TYPE_S); } - void get_cc_r() const; - void solidHeapCB(fopAc_ac_c*); - void create_heap(); + f32 get_cc_r() const; + static BOOL solidHeapCB(fopAc_ac_c*); + bool create_heap(); cPhs_State _create(); bool _delete(); - void chk_sw() const; - void chk_sch() const; - void chk_light() const; + bool chk_sw() const; + bool chk_sch() const; + bool chk_light() const; void get_base_model_light_start_offset(cXyz*); void get_projection_info(cXyz*, cXyz*, cXyz*, const cXyz*, const cXyz*); void make_projection_mtx(const cXyz*, const cXyz*, const cXyz*, const cXyz*); @@ -52,7 +87,7 @@ namespace daTagLight { void set_spot(); void init_spot(); bool _execute(); - void set_material(J3DMaterial*, unsigned char); + static void set_material(J3DMaterial*, unsigned char); bool _draw(); static const f32 M_box_x_min; @@ -64,10 +99,29 @@ namespace daTagLight { static const f32 M_cone_lower; static const f32 M_cone_upper; static const f32 M_cone_r; + + static const char M_arcname[]; + static const dCcD_SrcSph M_sph_src; + static const f32 M_alpha_spd[]; + static const s16 M_cc_r[]; public: - /* Place member variables here */ - }; + /* 0x290 */ request_of_phase_process_class mPhase; + /* 0x298 */ J3DModel* mpModel; + /* 0x29C */ mDoExt_btkAnm* mpBtk; + /* 0x2A0 */ s32 m2A0; + /* 0x2A4 */ Mtx m2A4; + /* 0x2D4 */ Mtx m2D4; + /* 0x304 */ bool m304; + /* 0x305 */ bool m305; + /* 0x306 */ s16 m306; + /* 0x308 */ f32 m308; + /* 0x30C */ dCcD_Stts mStts; + /* 0x348 */ dCcD_Sph mSph; + /* 0x474 */ Mtx m474; + /* 0x4A4 */ cXyz m4A4; + + }; // size = 0x4B0 }; #endif /* D_A_TAG_LIGHT_H */ diff --git a/include/m_Do/m_Do_mtx.h b/include/m_Do/m_Do_mtx.h index a4dd4028b..fac9bf3bf 100644 --- a/include/m_Do/m_Do_mtx.h +++ b/include/m_Do/m_Do_mtx.h @@ -91,7 +91,7 @@ inline void cMtx_lookAt(Mtx param_0, const Vec* param_1, const Vec* param_2, con mDoMtx_lookAt(param_0,param_1,param_2,param_3,param_4); } -inline void cMtx_copy(const Mtx src, Mtx dst) { +inline void cMtx_copy(CMtxP src, MtxP dst) { mDoMtx_copy(src, dst); } diff --git a/src/d/actor/d_a_obj_tide.cpp b/src/d/actor/d_a_obj_tide.cpp index fbe10fa7e..40185d37a 100644 --- a/src/d/actor/d_a_obj_tide.cpp +++ b/src/d/actor/d_a_obj_tide.cpp @@ -277,8 +277,8 @@ void Act_c::mode_norm_init() { /* 00000DD8-00000FAC .text mode_norm__Q29daObjTide5Act_cFv */ void Act_c::mode_norm() { bool uVar1; - f32 fVar2; daTagWaterlevel::State_e uVar3; + f32 fVar2; fVar2 = daTagWaterlevel::Act_c::get_now(); uVar3 = daTagWaterlevel::Act_c::get_state(); diff --git a/src/d/actor/d_a_tag_light.cpp b/src/d/actor/d_a_tag_light.cpp index a481377f4..f033c8051 100644 --- a/src/d/actor/d_a_tag_light.cpp +++ b/src/d/actor/d_a_tag_light.cpp @@ -4,100 +4,541 @@ // #include "d/actor/d_a_tag_light.h" +#include "d/res/res_mspot.h" +#include "d/d_s_play.h" #include "d/d_procname.h" #include "d/d_priority.h" +#include "d/d_kankyo.h" +#include "d/d_bg_s_lin_chk.h" +#include "d/d_com_inf_game.h" +#include "f_op/f_op_actor_mng.h" + +namespace daTagLight { +namespace { +struct Attr_c { + /* 0x00 */ u8 m00; + /* 0x01 */ u8 m01; + /* 0x02 */ u8 m02; + /* 0x03 */ u8 m03; + /* 0x04 */ u8 m04; + /* 0x08 */ f32 m08; + /* 0x0C */ u8 m0C; + /* 0x0D */ u8 m0D[0x20 - 0x0D]; + /* 0x20 */ f32 m20; +}; // size = 0x24 + +static const Attr_c L_attr = { + 0xFF, + 0xFF, + 0xFF, + 0x04, + 0x04, + 1.05f, + 0x08, +}; + +inline const Attr_c& attr() { + return L_attr; +} +} // namespace + +const char Act_c::M_arcname[] = "Mspot"; + +const dCcD_SrcSph Act_c::M_sph_src = { + // dCcD_SrcGObjInf + { + /* Flags */ 0, + /* SrcObjAt Type */ 0, + /* SrcObjAt Atp */ 0, + /* SrcObjAt SPrm */ 0, + /* SrcObjTg Type */ AT_TYPE_LIGHT, + /* SrcObjTg SPrm */ cCcD_TgSPrm_Set_e | cCcD_TgSPrm_IsOther_e, + /* SrcObjCo SPrm */ 0, + /* SrcGObjAt Se */ 0, + /* SrcGObjAt HitMark */ dCcG_AtHitMark_None_e, + /* SrcGObjAt Spl */ dCcG_At_Spl_UNK0, + /* SrcGObjAt Mtrl */ 0, + /* SrcGObjAt SPrm */ 0, + /* SrcGObjTg Se */ 0, + /* SrcGObjTg HitMark */ 0, + /* SrcGObjTg Spl */ dCcG_Tg_Spl_UNK0, + /* SrcGObjTg Mtrl */ 0, + /* SrcGObjTg SPrm */ 0, + /* SrcGObjCo SPrm */ 0, + }, + // cM3dGSphS + {{ + /* Center */ {0.0f, 0.0f, 0.0f}, + /* Radius */ 4.0f, + }}, +}; + +const f32 Act_c::M_alpha_spd[] = {0.06666667f, 0.033333335f, 0.016666668f, 1.0f}; +const s16 Act_c::M_cc_r[] = {20, 40, 60, 4}; /* 00000078-000000D0 .text get_cc_r__Q210daTagLight5Act_cCFv */ -void daTagLight::Act_c::get_cc_r() const { - /* Nonmatching */ +f32 Act_c::get_cc_r() const { + return M_cc_r[prm_get_ccR()]; } /* 000000D0-000000F4 .text solidHeapCB__Q210daTagLight5Act_cFP10fopAc_ac_c */ -void daTagLight::Act_c::solidHeapCB(fopAc_ac_c*) { - /* Nonmatching */ +BOOL Act_c::solidHeapCB(fopAc_ac_c* a_this) { + return ((Act_c*)a_this)->create_heap(); } /* 000000F4-00000314 .text create_heap__Q210daTagLight5Act_cFv */ -void daTagLight::Act_c::create_heap() { - /* Nonmatching */ +bool Act_c::create_heap() { + f32 tmp = (attr().m0C + 0.5f) * 0.06666667f; + f32 ratio = prm_get_coneRatio(); + ratio = ratio * 0.06666667f; + s16 sVar2; + s16 sVar8; + + if (ratio < tmp) { + sVar2 = MSPOT_BDL_MSPOCN; + sVar8 = MSPOT_BTK_MSPOCN; + } else { + sVar2 = MSPOT_BDL_MSPOT; + sVar8 = MSPOT_BTK_MSPOT; + } + + J3DModelData* modelData = static_cast(dComIfG_getObjectRes(M_arcname, sVar2)); + JUT_ASSERT(463, modelData != NULL); + + mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000222); + + BOOL bVar1 = FALSE; + J3DAnmTextureSRTKey* btk_data = static_cast(dComIfG_getObjectRes(M_arcname, sVar8)); + JUT_ASSERT(475, btk_data != NULL); + + mpBtk = new mDoExt_btkAnm(); + if (mpBtk != NULL && mpBtk->init(modelData, btk_data, true, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, false, FALSE)) { + bVar1 = TRUE; + } + + bool ret = false; + if (mpModel != NULL && bVar1) { + ret = true; + } + return ret; } /* 0000035C-000006F0 .text _create__Q210daTagLight5Act_cFv */ -cPhs_State daTagLight::Act_c::_create() { - /* Nonmatching */ +cPhs_State Act_c::_create() { +#if VERSION > VERSION_DEMO + fopAcM_SetupActor(this, Act_c); +#endif + + m2A0 = prm_get_type(); + cXyz sp08; + if (m2A0 == 1) { + sp08.set(scale.x, scale.y * 2.0f, scale.z); + } else if (m2A0 == 0) { + sp08.set(scale.x * 2.0f, scale.y * 2.0f, scale.z * 2.0f); + } else { + sp08.set(scale); + } + m4A4.x = sp08.x; + m4A4.y = sp08.y; + m4A4.z = sp08.z; + +#if VERSION == VERSION_DEMO + fopAcM_SetupActor(this, Act_c); +#endif + + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::ZXYrotM(shape_angle); + mDoMtx_stack_c::scaleM(sp08); + cMtx_copy(mDoMtx_stack_c::get(), m2A4); + MTXInverse(m2A4, m2D4); + + cPhs_State PVar2; + if (m2A0 == 1) { + PVar2 = dComIfG_resLoad(&mPhase, M_arcname); + if (PVar2 == cPhs_COMPLEATE_e) { +#if VERSION == VERSION_DEMO + u32 heapSize = 0x0; +#else + u32 heapSize = 0xAC0; +#endif + if (fopAcM_entrySolidHeap(this, solidHeapCB, heapSize)) { + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::ZXYrotM(shape_angle); + mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); + mpModel->setBaseScale(sp08); + init_spot(); + } else { + PVar2 = cPhs_ERROR_e; + } + } + } else { + PVar2 = cPhs_COMPLEATE_e; + } + + if (PVar2 == cPhs_COMPLEATE_e) { + fopAcM_SetMtx(this, m2A4); + fopAcM_setCullSizeBox(this, -51.0f, -1.0f, -51.0f, 51.0f, 101.0f, 51.0f); + if (m2A0 == 2) { + m304 = false; + } else { + m304 = chk_sw() && chk_sch(); + } + + if (m304) { + m308 = 1.0f; + } else { + m308 = 0.0f; + } + m306 = 0; + + if (m2A0 == 2) { + mStts.Init(0xff, 0xff, this); + mSph.Set(M_sph_src); + mSph.SetStts(&mStts); + mSph.SetC(current.pos); + mSph.SetR(get_cc_r()); + } + } + return PVar2; } /* 000008A8-000008E4 .text _delete__Q210daTagLight5Act_cFv */ -bool daTagLight::Act_c::_delete() { - /* Nonmatching */ +bool Act_c::_delete() { + if (m2A0 == 1) { + dComIfG_resDelete(&mPhase, M_arcname); + } + return true; } /* 000008E4-000009B8 .text chk_sw__Q210daTagLight5Act_cCFv */ -void daTagLight::Act_c::chk_sw() const { - /* Nonmatching */ +bool Act_c::chk_sw() const { + s32 switchIndex = prm_get_swSave(); + s32 switchIndex_00 = prm_get_swSave2(); + bool cVar2; + if (switchIndex == 0xff) { + cVar2 = true; + } else { + cVar2 = fopAcM_isSwitch((fopAc_ac_c*)this, switchIndex); + } + + bool bVar1; + if (switchIndex_00 == 0xff) { + bVar1 = false; + } else { + bVar1 = fopAcM_isSwitch((fopAc_ac_c*)this, switchIndex_00); + } + + if (bVar1) { + return false; + } + return cVar2; } /* 000009B8-00000A10 .text chk_sch__Q210daTagLight5Act_cCFv */ -void daTagLight::Act_c::chk_sch() const { - /* Nonmatching */ +bool Act_c::chk_sch() const { + u8 bVar1 = prm_get_sch(); + u8 bVar2 = dKy_get_schbit(); + bool ret; + + if (bVar1) { + ret = (bVar1 & bVar2) != 0; + } else { + ret = true; + } + return ret; } /* 00000A10-00000A88 .text chk_light__Q210daTagLight5Act_cCFv */ -void daTagLight::Act_c::chk_light() const { - /* Nonmatching */ +bool Act_c::chk_light() const { + if (const_cast(&mSph)->ChkTgHit()) { + const_cast(&mSph)->ClrTgHit(); + return true; + } + + if (dComIfGp_getDetect().chk_light(¤t.pos)) { + return true; + } + return false; } /* 00000A88-00000B08 .text get_cross_plane_line__10daTagLightFP4cXyzffffffffff */ -void daTagLight::get_cross_plane_line(cXyz*, float, float, float, float, float, float, float, float, float, float) { - /* Nonmatching */ +bool get_cross_plane_line( + cXyz* outPos, float arg1, float arg2, float arg3, float arg4, float arg5, float arg6, float arg7, float arg8, float arg9, float arg10 +) { + f32 fVar1 = arg1 * arg5 + arg2 * arg6 + arg3 * arg7; + if (fVar1 != 0.0f) { + f32 tmp2 = arg1 * arg8 + arg2 * arg9 + arg3 * arg10 + arg4; + fVar1 = -tmp2 / fVar1; + outPos->x = arg8 + arg5 * fVar1; + outPos->y = arg9 + arg6 * fVar1; + outPos->z = arg10 + arg7 * fVar1; + return true; + } + return false; } /* 00000B08-00000BCC .text get_base_model_light_start_offset__Q210daTagLight5Act_cFP4cXyz */ -void daTagLight::Act_c::get_base_model_light_start_offset(cXyz*) { - /* Nonmatching */ +void Act_c::get_base_model_light_start_offset(cXyz* outPos) { + f32 ratio = prm_get_coneRatio(); + ratio = ratio * 0.06666667f; + + BOOL tmp = ratio < 0.5f ? true : false; + if (tmp == TRUE) { + outPos->set(0.0f, attr().m20 + 135.0f, 0.0f); + } else { + outPos->set(0.0f, 100.0f, 0.0f); + } } /* 00000BCC-0000111C .text get_projection_info__Q210daTagLight5Act_cFP4cXyzP4cXyzP4cXyzPC4cXyzPC4cXyz */ -void daTagLight::Act_c::get_projection_info(cXyz*, cXyz*, cXyz*, const cXyz*, const cXyz*) { - /* Nonmatching */ +void Act_c::get_projection_info(cXyz* outArg1, cXyz* outArg2, cXyz* outArg3, const cXyz* arg4, const cXyz* arg5) { + *outArg3 = current.pos; + + f32 ratio = prm_get_coneRatio(); + ratio = ratio * 0.06666667f; + BOOL tmp = ratio < 0.5f ? true : false; + dBgS_ObjLinChk linChk; + + *outArg1 = current.pos; + *outArg2 = cXyz::BaseY; + linChk.Set((cXyz*)arg4, (cXyz*)arg5, this); + + if (dComIfG_Bgsp()->LineCrossNonMoveBG(&linChk)) { + *outArg1 = linChk.GetCross(); + + cM3dGPla* pcVar4 = dComIfG_Bgsp()->GetTriPla(linChk); + if (pcVar4 != NULL) { + *outArg2 = pcVar4->mNormal; + + if (tmp == TRUE) { + f32 fVar1 = m4A4.x * 12.0f; + f32 fVar2 = m4A4.z * 12.0f; + + cXyz sp7C[4]; + cXyz sp4C[4]; + cXyz sp40; + + for (s32 i = 0; i < 4; i++) { + /* + Mtx sp10; + sp10[2][0] = fVar1; + sp10[2][1] = 0.0f; + sp10[2][2] = 0.0f; + sp10[2][3] = -fVar1; + sp10[1][0] = 0.0f; + sp10[1][1] = 0.0f; + sp10[1][2] = 0.0f; + sp10[1][3] = 0.0f; + sp10[2][0] = fVar2; + sp10[2][1] = 0.0f; + sp10[2][2] = 0.0f; + sp10[2][3] = -fVar2; + sp4C[0].set(sp10[2][0], sp10[2][1], sp10[2][2]); + sp4C[1].set(sp10[2][3], sp10[1][0], sp10[1][1]); + sp4C[2].set(sp10[1][2], sp10[1][3], sp10[2][0]); + sp4C[3].set(sp10[2][1], sp10[2][2], sp10[2][3]); + */ + cXyz sp10[4]; + sp10[3].set(fVar1, 0.0f, 0.0f); + sp4C[0].set(sp10[3]); + + sp10[2].set(-fVar1, 0.0f, 0.0f); + sp4C[1].set(sp10[2]); + + sp10[1].set(0.0f, 0.0f, fVar2); + sp4C[2].set(sp10[1]); + + sp10[0].set(0.0f, 0.0f, -fVar2); + sp4C[3].set(sp10[0]); + + sp7C[i] = *outArg1; + mDoMtx_multVec(m2A4, &sp4C[i], &sp40); + get_cross_plane_line( + &sp7C[i], + pcVar4->mNormal.x, + pcVar4->mNormal.y, + pcVar4->mNormal.z, + pcVar4->mD, + sp40.x - arg4->x, + sp40.y - arg4->y, + sp40.z - arg4->z, + arg4->x, + arg4->y, + arg4->z + ); + } + + outArg3->x = (sp7C[0].x + sp7C[1].x + sp7C[2].x + sp7C[3].x) * 0.25f; + outArg3->y = (sp7C[0].y + sp7C[1].y + sp7C[2].y + sp7C[3].y) * 0.25f; + outArg3->z = (sp7C[0].z + sp7C[1].z + sp7C[2].z + sp7C[3].z) * 0.25f; + } + } + } } /* 000016A8-00001A30 .text make_projection_mtx__Q210daTagLight5Act_cFPC4cXyzPC4cXyzPC4cXyzPC4cXyz */ -void daTagLight::Act_c::make_projection_mtx(const cXyz*, const cXyz*, const cXyz*, const cXyz*) { - /* Nonmatching */ +void Act_c::make_projection_mtx(const cXyz* arg1, const cXyz* arg2, const cXyz* arg3, const cXyz* arg4) { + f32 ratio = prm_get_coneRatio(); + ratio = ratio * 0.06666667f; + BOOL tmp = ratio < 0.5f ? true : false; + Mtx sp3C; + cXyz sp30 = *arg2; + cXyz sp24; + cXyz sp18; + cXyz sp0C; + + mDoMtx_stack_c::ZXYrotS(shape_angle); + cMtx_copy(mDoMtx_stack_c::get(), sp3C); + mDoMtx_multVec(sp3C, &sp30, &sp24); + + s16 iVar5 = cM_atan2s(sp24.z, sp24.x); + f32 sqrt = std::sqrtf(sp24.x * sp24.x + sp24.z * sp24.z); + s16 uVar6 = cM_atan2s(sqrt, std::fabsf(sp24.y)); + +#if VERSION >= VERSION_USA + if (std::fabsf(cM_scos(uVar6)) < 0.001f) { + m305 = false; + } else { + m305 = true; +#endif + if (!tmp) { + f32 fVar1 = (m4A4.x / cM_scos(uVar6)) * 0.5f; + f32 fVar2 = m4A4.z * 0.5f; + f32 y = (fVar1 + fVar2) * 0.5f; + +#if VERSION == VERSION_DEMO + sp18.set(fVar1 * (REG20_F(0) + 1.035f), y * (REG20_F(0) + 1.035f), fVar2 * (REG20_F(0) + 1.035f)); +#else + sp18.set(fVar1 * 1.035f, y * 1.035f, fVar2 * 1.035f); +#endif + mDoMtx_stack_c::transS(*arg1); + mDoMtx_stack_c::YrotM(shape_angle.y - iVar5); + mDoMtx_stack_c::YrotM(-shape_angle.y); + mDoMtx_stack_c::scaleM(sp18); + mDoMtx_stack_c::YrotM(shape_angle.y); + } else { + f32 fVar1 = (arg1->y - arg4->y) / (current.pos.y - arg4->y); + f32 fVar2 = fVar1 * (m4A4.x / cM_scos(uVar6) * 0.5f); + fVar1 = (m4A4.z * 0.5f) * fVar1; + f32 y = (fVar2 + fVar1) * 0.5f; + + sp0C.set(fVar2 * (REG20_F(0) + 0.97f), y * (REG20_F(0) + 0.97f), fVar1 * (REG20_F(0) + 0.97f)); + + mDoMtx_stack_c::transS(*arg3); + mDoMtx_stack_c::YrotM(shape_angle.y - iVar5); + mDoMtx_stack_c::YrotM(-shape_angle.y); + mDoMtx_stack_c::scaleM(sp0C); + mDoMtx_stack_c::YrotM(shape_angle.y); + } + cMtx_copy(mDoMtx_stack_c::get(), m474); +#if VERSION >= VERSION_USA + } +#endif } /* 00001A30-00001AE0 .text set_spot_mtx__Q210daTagLight5Act_cFv */ -void daTagLight::Act_c::set_spot_mtx() { - /* Nonmatching */ +void Act_c::set_spot_mtx() { + cXyz sp50; + + prm_get_coneRatio(); + cXyz sp44; + get_base_model_light_start_offset(&sp44); + cXyz sp38(0.0f, -50.0f, 0.0f); + cXyz sp2C; + mDoMtx_multVec(m2A4, &sp44, &sp2C); + cXyz sp20; + mDoMtx_multVec(m2A4, &sp38, &sp20); + cXyz sp14; + cXyz sp08; + get_projection_info(&sp14, &sp08, &sp50, &sp2C, &sp20); + make_projection_mtx(&sp14, &sp08, &sp50, &sp2C); } /* 00001AE0-00001B00 .text set_spot__Q210daTagLight5Act_cFv */ -void daTagLight::Act_c::set_spot() { - /* Nonmatching */ +void Act_c::set_spot() { + set_spot_mtx(); } /* 00001B00-00001B20 .text init_spot__Q210daTagLight5Act_cFv */ -void daTagLight::Act_c::init_spot() { - /* Nonmatching */ +void Act_c::init_spot() { + set_spot(); } /* 00001B20-00001C90 .text _execute__Q210daTagLight5Act_cFv */ -bool daTagLight::Act_c::_execute() { - /* Nonmatching */ +bool Act_c::_execute() { + if (m2A0 == 2) { + if (chk_light()) { + m306++; + } else { + m306--; + } + + m306 = cLib_minMaxLimit(m306, 0, 20); + if (m306 > 10) { + fopAcM_onSwitch(this, prm_get_swSave()); + } + dComIfG_Ccsp()->Set(&mSph); + } else { + m304 = chk_sw() && chk_sch(); + f32 target; + if (m304) { + target = 1.0f; + } else { + target = 0.0f; + } + f32 alpha = M_alpha_spd[prm_get_fadeType()]; + cLib_chaseF(&m308, target, alpha); + if (mpBtk != NULL) { + mpBtk->play(); + } + } + return true; } /* 00001C90-00001D20 .text set_material__Q210daTagLight5Act_cFP11J3DMaterialUc */ -void daTagLight::Act_c::set_material(J3DMaterial*, unsigned char) { - /* Nonmatching */ +void Act_c::set_material(J3DMaterial* material, unsigned char alpha) { + while (material != NULL) { + if (alpha == 0) { + material->getShape()->hide(); + } else { + material->getShape()->show(); + material->getTevKColor(3)->mColor.a = alpha; + } + material = material->getNext(); + } } /* 00001D20-00001EAC .text _draw__Q210daTagLight5Act_cFv */ -bool daTagLight::Act_c::_draw() { - /* Nonmatching */ +bool Act_c::_draw() { + if (m2A0 == 1 && m308 > 0.0f) { + g_env_light.settingTevStruct(TEV_TYPE_BG0, ¤t.pos, &tevStr); + g_env_light.setLightTevColorType(mpModel, &tevStr); +#if VERSION >= VERSION_USA + if (m305) +#endif + { + GXColor color = {}; + color.r = attr().m00; + color.g = attr().m01; + color.b = attr().m02; + color.a = attr().m03; + dComIfGd_setLightModelColor(color); + dComIfGd_setLightModel(attr().m04, m474, (s8)(m308 * attr().m03)); + } + + if (mpBtk != NULL) { + mpBtk->entry(mpModel->getModelData()); + } + + J3DModelData* modelData = mpModel->getModelData(); + u8 tmp = (s8)(m308 * 255.5f); + set_material(modelData->getJointNodePointer(1)->getMesh(), tmp); + set_material(modelData->getJointNodePointer(2)->getMesh(), tmp); + mDoExt_modelUpdateDL(mpModel); + } + return true; } -namespace daTagLight { namespace { /* 00001EAC-00001ECC .text Mthd_Create__Q210daTagLight27@unnamed@d_a_tag_light_cpp@FPv */ cPhs_State Mthd_Create(void* i_this) { diff --git a/src/d/d_detect.cpp b/src/d/d_detect.cpp index 333d4406b..af605c484 100644 --- a/src/d/d_detect.cpp +++ b/src/d/d_detect.cpp @@ -45,6 +45,7 @@ void dDetect_c::proc() { } else if (mPlace[0].mTimer < 0) { mPlace[0].mTimer = 1; } + if (mTimer > 0) { mTimer--; } else if (mTimer < 0) { @@ -103,12 +104,12 @@ bool dDetect_c::chk_quake_area(const cXyz* pos) const { /* 8009C32C-8009C588 .text search_tag_light__9dDetect_cFPvPv */ void* dDetect_c::search_tag_light(void* i_proc, void* i_pos) { - /* Nonmatching - chk_inside */ - if (fopAc_IsActor(i_proc) && fopAcM_GetProfName(i_proc) == PROC_Tag_Light) { + if (fopAc_IsActor(i_proc) && fopAcM_GetName(i_proc) == PROC_Tag_Light) { daTagLight::Act_c* light = (daTagLight::Act_c*)i_proc; const cXyz* pos = (const cXyz*)i_pos; - light->chk_inside(pos); // TODO - return light; + if (light->chk_inside(pos)) { + return light; + } } return NULL; }