diff --git a/configure.py b/configure.py index 0c639e00a..08cc6c235 100755 --- a/configure.py +++ b/configure.py @@ -1544,7 +1544,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_obj_swflat"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_swhammer"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_swheavy"), - ActorRel(NonMatching, "d_a_obj_swlight"), + ActorRel(MatchingFor("D44J01"), "d_a_obj_swlight"), ActorRel(NonMatching, "d_a_oq"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_pedestal"), ActorRel(NonMatching, "d_a_saku"), diff --git a/include/d/actor/d_a_obj_swlight.h b/include/d/actor/d_a_obj_swlight.h index d858cda05..e60b22ce0 100644 --- a/include/d/actor/d_a_obj_swlight.h +++ b/include/d/actor/d_a_obj_swlight.h @@ -2,27 +2,58 @@ #define D_A_OBJ_SWLIGHT_H #include "f_op/f_op_actor.h" +#include "m_Do/m_Do_ext.h" +#include "d/d_cc_d.h" +#include "d/d_a_obj.h" +#include "f_op/f_op_actor_mng.h" class J3DNode; class J3DMaterial; +class dBgW; namespace daObjSwlight { static void setMaterial(J3DMaterial*, unsigned char); static void setMaterial_Before_mirror(J3DMaterial*, unsigned char); class Act_c : public fopAc_ac_c { + typedef void (Act_c::*ModeFunc)(); + public: + + struct Attr_c { + /* 0x00 */ s16 m00; + /* 0x04 */ f32 m04; + /* 0x08 */ f32 m08; + /* 0x0C */ f32 m0C; + }; // size = 0x10 + void get_power() const {} - void is_switch() const {} - void off_switch() const {} - void on_switch() const {} - void prm_get_swSave() const {} - void prm_get_swSave2() const {} - void prm_get_type() const {} + bool is_switch() const { + return fopAcM_isSwitch(const_cast(this), prm_get_swSave()); + } + void off_switch() const { + fopAcM_offSwitch(const_cast(this), prm_get_swSave()); + } + void on_switch() const { + fopAcM_onSwitch(const_cast(this), prm_get_swSave()); + } + s32 prm_get_swSave() const { + return daObj::PrmAbstract(this, 8, 0); + } + s32 prm_get_swSave2() const { + return daObj::PrmAbstract(this, 8, 8); + } + s32 prm_get_type() const { + return daObj::PrmAbstract(this, 1, 0x10); + } - void is_switch2() const; - void solidHeapCB(fopAc_ac_c*); - void create_heap(); + bool is_switch2() const; + static BOOL solidHeapCB(fopAc_ac_c*); +#if VERSION == VERSION_DEMO + bool create_heap(); +#else + u8 create_heap(); +#endif cPhs_State _create(); bool _delete(); static BOOL jnodeCB_moon(J3DNode*, int); @@ -32,9 +63,9 @@ namespace daObjSwlight { void set_cc_pos(); void set_cc(); void init_eye_pos(); - void chk_light(); - void power_up(); - void power_down(); + bool chk_light(); + bool power_up(); + bool power_down(); void mode_norm_moon_init(); void mode_norm_moon(); void mode_norm_sun_init(); @@ -45,10 +76,26 @@ namespace daObjSwlight { void mode_active_sun(); bool _execute(); bool _draw(); + + static const char M_arcname[]; + static const dCcD_SrcTri M_tri_src; public: - /* Place member variables here */ - }; + /* 0x290 */ request_of_phase_process_class mPhase; + /* 0x298 */ J3DModel* m298; + /* 0x29C */ mDoExt_btkAnm m29C; + /* 0x2B0 */ mDoExt_bckAnm m2B0; + /* 0x2C0 */ dBgW* m2C0; + /* 0x2C4 */ dCcD_Tri m2C4[8]; + /* 0xD44 */ dCcD_Stts mD44[8]; + /* 0xF24 */ s32 mF24; + /* 0xF28 */ s32 mF28; + /* 0xF2C */ s16 mF2C; + /* 0xF2E */ u8 mF2E[0xF30 - 0xF2E]; + /* 0xF30 */ f32 mF30; + /* 0xF34 */ u8 mF34[0xF38 - 0xF34]; + /* 0xF38 */ Mtx mF38; + }; // Size: 0xF68 }; #endif /* D_A_OBJ_SWLIGHT_H */ diff --git a/src/d/actor/d_a_obj_swlight.cpp b/src/d/actor/d_a_obj_swlight.cpp index 2b85fdcac..9f5e599a0 100644 --- a/src/d/actor/d_a_obj_swlight.cpp +++ b/src/d/actor/d_a_obj_swlight.cpp @@ -7,162 +7,498 @@ #include "d/actor/d_a_obj_swlight.h" #include "d/d_procname.h" #include "d/d_priority.h" - -/* 000000EC-00000154 .text is_switch2__Q212daObjSwlight5Act_cCFv */ -void daObjSwlight::Act_c::is_switch2() const { - /* Nonmatching */ -} - -/* 00000154-00000178 .text solidHeapCB__Q212daObjSwlight5Act_cFP10fopAc_ac_c */ -void daObjSwlight::Act_c::solidHeapCB(fopAc_ac_c*) { - /* Nonmatching */ -} - -/* 00000178-0000045C .text create_heap__Q212daObjSwlight5Act_cFv */ -void daObjSwlight::Act_c::create_heap() { - /* Nonmatching */ -} - -/* 0000045C-00000704 .text _create__Q212daObjSwlight5Act_cFv */ -cPhs_State daObjSwlight::Act_c::_create() { - /* Nonmatching */ -} - -/* 00000C38-00000CB8 .text _delete__Q212daObjSwlight5Act_cFv */ -bool daObjSwlight::Act_c::_delete() { - /* Nonmatching */ -} - -/* 00000CB8-00000CC0 .text jnodeCB_moon__Q212daObjSwlight5Act_cFP7J3DNodei */ -BOOL daObjSwlight::Act_c::jnodeCB_moon(J3DNode*, int) { - /* Nonmatching */ -} - -/* 00000CC0-00000D2C .text set_mtx__Q212daObjSwlight5Act_cFv */ -void daObjSwlight::Act_c::set_mtx() { - /* Nonmatching */ -} - -/* 00000D2C-00000D68 .text init_mtx__Q212daObjSwlight5Act_cFv */ -void daObjSwlight::Act_c::init_mtx() { - /* Nonmatching */ -} - -/* 00000D68-00000E04 .text init_cc__Q212daObjSwlight5Act_cFv */ -void daObjSwlight::Act_c::init_cc() { - /* Nonmatching */ -} - -/* 00000E04-00000FC4 .text set_cc_pos__Q212daObjSwlight5Act_cFv */ -void daObjSwlight::Act_c::set_cc_pos() { - /* Nonmatching */ -} - -/* 00000FC4-00001028 .text set_cc__Q212daObjSwlight5Act_cFv */ -void daObjSwlight::Act_c::set_cc() { - /* Nonmatching */ -} - -/* 00001028-000010B8 .text init_eye_pos__Q212daObjSwlight5Act_cFv */ -void daObjSwlight::Act_c::init_eye_pos() { - /* Nonmatching */ -} - -/* 000010B8-0000115C .text chk_light__Q212daObjSwlight5Act_cFv */ -void daObjSwlight::Act_c::chk_light() { - /* Nonmatching */ -} - -/* 0000115C-0000119C .text power_up__Q212daObjSwlight5Act_cFv */ -void daObjSwlight::Act_c::power_up() { - /* Nonmatching */ -} - -/* 0000119C-000011DC .text power_down__Q212daObjSwlight5Act_cFv */ -void daObjSwlight::Act_c::power_down() { - /* Nonmatching */ -} - -/* 000011DC-000011F4 .text mode_norm_moon_init__Q212daObjSwlight5Act_cFv */ -void daObjSwlight::Act_c::mode_norm_moon_init() { - /* Nonmatching */ -} - -/* 000011F4-00001334 .text mode_norm_moon__Q212daObjSwlight5Act_cFv */ -void daObjSwlight::Act_c::mode_norm_moon() { - /* Nonmatching */ -} - -/* 00001334-00001340 .text mode_norm_sun_init__Q212daObjSwlight5Act_cFv */ -void daObjSwlight::Act_c::mode_norm_sun_init() { - /* Nonmatching */ -} - -/* 00001340-00001400 .text mode_norm_sun__Q212daObjSwlight5Act_cFv */ -void daObjSwlight::Act_c::mode_norm_sun() { - /* Nonmatching */ -} - -/* 00001400-00001418 .text mode_active_moon_init__Q212daObjSwlight5Act_cFv */ -void daObjSwlight::Act_c::mode_active_moon_init() { - /* Nonmatching */ -} - -/* 00001418-00001524 .text mode_active_moon__Q212daObjSwlight5Act_cFv */ -void daObjSwlight::Act_c::mode_active_moon() { - /* Nonmatching */ -} - -/* 00001524-00001530 .text mode_active_sun_init__Q212daObjSwlight5Act_cFv */ -void daObjSwlight::Act_c::mode_active_sun_init() { - /* Nonmatching */ -} - -/* 00001530-0000162C .text mode_active_sun__Q212daObjSwlight5Act_cFv */ -void daObjSwlight::Act_c::mode_active_sun() { - /* Nonmatching */ -} - -/* 0000162C-00001714 .text _execute__Q212daObjSwlight5Act_cFv */ -bool daObjSwlight::Act_c::_execute() { - /* Nonmatching */ -} - -/* 00001714-0000187C .text setMaterial__12daObjSwlightFP11J3DMaterialUc */ -void daObjSwlight::setMaterial(J3DMaterial*, unsigned char) { - /* Nonmatching */ -} - -/* 0000187C-00001970 .text setMaterial_Before_mirror__12daObjSwlightFP11J3DMaterialUc */ -void daObjSwlight::setMaterial_Before_mirror(J3DMaterial*, unsigned char) { - /* Nonmatching */ -} - -/* 00001970-00001AC4 .text _draw__Q212daObjSwlight5Act_cFv */ -bool daObjSwlight::Act_c::_draw() { - /* Nonmatching */ -} +#include "d/res/res_mmirror.h" namespace daObjSwlight { +namespace { +static const Act_c::Attr_c L_attr = {20, 100.0f, 40.0f, 0.0f}; +static inline const Act_c::Attr_c& attr() { + return L_attr; +} +} // namespace +const char Act_c::M_arcname[] = "Mmirror"; +const dCcD_SrcTri Act_c::M_tri_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, + }, + // cM3dGTriS + {{ + /* a */ {0.0f, 0.0f, 0.0f}, + /* b */ {0.0f, 0.0f, 0.0f}, + /* c */ {0.0f, 0.0f, 0.0f}, + }}, +}; + +/* 000000EC-00000154 .text is_switch2__Q212daObjSwlight5Act_cCFv */ +bool Act_c::is_switch2() const { + int switchIndex = prm_get_swSave2(); + if (switchIndex == 0xFF) { + return false; + } + return dComIfGs_isSwitch(switchIndex, fopAcM_GetHomeRoomNo(const_cast(this))); +} + +/* 00000154-00000178 .text solidHeapCB__Q212daObjSwlight5Act_cFP10fopAc_ac_c */ +BOOL Act_c::solidHeapCB(fopAc_ac_c* i_this) { + return ((Act_c*)i_this)->create_heap(); +} + +/* 00000178-0000045C .text create_heap__Q212daObjSwlight5Act_cFv */ +#if VERSION == VERSION_DEMO +bool Act_c::create_heap() { +#else +u8 Act_c::create_heap() { +#endif + J3DModelData* modelData = static_cast(dComIfG_getObjectRes(M_arcname, MMIRROR_BDL_MSUSW)); + JUT_ASSERT(317, modelData != NULL); + + m298 = mDoExt_J3DModel__create(modelData, 0x80000, 0x31000202); + if (m298 != NULL) { + modelData->getJointNodePointer(1)->setCallBack(jnodeCB_moon); + modelData->getJointNodePointer(2)->setCallBack(jnodeCB_moon); + modelData->getJointNodePointer(3)->setCallBack(jnodeCB_moon); + modelData->getJointNodePointer(4)->setCallBack(jnodeCB_moon); + modelData->getJointNodePointer(5)->setCallBack(jnodeCB_moon); + m298->setUserArea((u32)this); + } + + J3DAnmTextureSRTKey* btk = static_cast(dComIfG_getObjectRes(M_arcname, MMIRROR_BTK_MSUSW)); + JUT_ASSERT(344, btk != NULL); + + BOOL iVar4 = m29C.init(modelData, btk, true, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, false, 0); + + J3DAnmTransform* bck = static_cast(dComIfG_getObjectRes(M_arcname, MMIRROR_BCK_MSUSW)); + JUT_ASSERT(351, bck != NULL); + + BOOL iVar6 = m2B0.init(modelData, bck, true, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, false); + bool bVar1 = false; + + m2C0 = new dBgW(); + if (m2C0 != NULL) { + cBgD_t* bgw_data = static_cast(dComIfG_getObjectRes(M_arcname, MMIRROR_DZB_MSUSW)); + JUT_ASSERT(361, bgw_data != NULL); + if (!m2C0->Set(bgw_data, cBgW::MOVE_BG_e, &this->mF38)) { + bVar1 = true; + } + } + + bool iVar8 = false; + if (m298 != NULL && iVar4) { + if (iVar6 && bVar1) { + iVar8 = true; + } + } + +#if VERSION > VERSION_DEMO + if (!iVar8) { + m2C0 = NULL; + } +#endif + + return iVar8; +} + +/* 0000045C-00000704 .text _create__Q212daObjSwlight5Act_cFv */ +cPhs_State Act_c::_create() { +#if VERSION == VERSION_DEMO + mF24 = prm_get_type(); +#endif + + fopAcM_SetupActor(this, Act_c); + +#if VERSION > VERSION_DEMO + mF24 = prm_get_type(); +#endif + + cPhs_State PVar2 = dComIfG_resLoad(&mPhase, M_arcname); + if (PVar2 == cPhs_COMPLEATE_e) { + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::ZXYrotM(shape_angle); + mDoMtx_stack_c::scaleM(scale); + cMtx_copy(mDoMtx_stack_c::get(), mF38); + + if (fopAcM_entrySolidHeap(this, solidHeapCB, DEMO_SELECT(0x0, 0x1F40))) { + dComIfG_Bgsp()->Regist(m2C0, this); + m2C0->SetCrrFunc(NULL); + + fopAcM_SetMtx(this, m298->getBaseTRMtx()); + init_mtx(); + + fopAcM_setCullSizeSphere(this, 0.0f, 0.0f, 0.0f, 240.0f); + init_cc(); + init_eye_pos(); + + if (mF24 == 0) { + if (is_switch()) { + mF30 = 1.0f; + mode_norm_sun_init(); + } else { + mF30 = 0.0f; + mode_norm_moon_init(); + } + } else if (is_switch2() || is_switch()) { + mF30 = 1.0f; + mode_active_sun_init(); + } else { + mF30 = 0.0f; + mode_active_moon_init(); + } + } else { + PVar2 = cPhs_ERROR_e; + } + } + return PVar2; +} + +/* 00000C38-00000CB8 .text _delete__Q212daObjSwlight5Act_cFv */ +bool Act_c::_delete() { + if (m2C0 != NULL) { + if (m2C0->ChkUsed()) { + dComIfG_Bgsp()->Release(m2C0); + } + } + + dComIfG_resDeleteDemo(&mPhase, M_arcname); + return true; +} + +/* 00000CB8-00000CC0 .text jnodeCB_moon__Q212daObjSwlight5Act_cFP7J3DNodei */ +BOOL Act_c::jnodeCB_moon(J3DNode*, int) { + return TRUE; +} + +/* 00000CC0-00000D2C .text set_mtx__Q212daObjSwlight5Act_cFv */ +void Act_c::set_mtx() { + mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z); + mDoMtx_stack_c::ZXYrotM(shape_angle.x, shape_angle.y, shape_angle.z); + m298->setBaseTRMtx(mDoMtx_stack_c::get()); +} + +/* 00000D2C-00000D68 .text init_mtx__Q212daObjSwlight5Act_cFv */ +void Act_c::init_mtx() { + m298->setBaseScale(scale); + set_mtx(); +} + +/* 00000D68-00000E04 .text init_cc__Q212daObjSwlight5Act_cFv */ +void Act_c::init_cc() { + for (s32 i = 0; i < ARRAY_SSIZE(mD44); i++) { + mD44[i].Init(0xff, 0xff, this); + m2C4[i].Set(Act_c::M_tri_src); + m2C4[i].SetStts(&mD44[i]); + m2C4[i].OnTgNoHitMark(); + } + set_cc_pos(); +} + +/* 00000E04-00000FC4 .text set_cc_pos__Q212daObjSwlight5Act_cFv */ +void Act_c::set_cc_pos() { + f32 tmp0C; + f32 tmp04; + f32 tmp08; + f32 fVar1; + f32 fVar2; + Vec local_08; + Vec local_14; + Vec local_20; + + tmp04 = attr().m04; + tmp08 = attr().m08; + tmp0C = attr().m0C; + + fVar1 = tmp04 * cM_ssin(0x2000); + fVar2 = tmp04 * cM_scos(0x2000); + + Vec _4319[] = { + {0.0f, 0.0f, 0.0f}, + {0.0f, 0.0f, 0.0f}, + {0.0f, 0.0f, 0.0f}, + }; + + _4319[0].z = tmp08; + + _4319[1].y = tmp04; + _4319[1].z = tmp0C; + + _4319[2].x = fVar1; + _4319[2].y = fVar2; + _4319[2].z = tmp0C; + + for (s32 i = 0; i < ARRAY_SSIZE(m2C4); i++) { + s16 z = (i * 0x10000) / 8; + mDoMtx_stack_c::copy(m298->getBaseTRMtx()); + mDoMtx_stack_c::ZrotM(z); + + mDoMtx_stack_c::multVec(&_4319[0], &local_08); + mDoMtx_stack_c::multVec(&_4319[1], &local_14); + mDoMtx_stack_c::multVec(&_4319[2], &local_20); + + m2C4[i].setPos(&local_08, &local_14, &local_20); + } +} + +/* 00000FC4-00001028 .text set_cc__Q212daObjSwlight5Act_cFv */ +void Act_c::set_cc() { + for (s32 i = 0; i < ARRAY_SSIZE(m2C4); i++) { + dComIfG_Ccsp()->Set(&m2C4[i]); + } +} + +/* 00001028-000010B8 .text init_eye_pos__Q212daObjSwlight5Act_cFv */ +void Act_c::init_eye_pos() { + static cXyz local_eye(0.0f, 0.0f, 40.0f); + + mDoMtx_multVec(m298->getBaseTRMtx(), &local_eye, &eyePos); +} + +/* 000010B8-0000115C .text chk_light__Q212daObjSwlight5Act_cFv */ +bool Act_c::chk_light() { + bool bVar3 = false; + if (dComIfGp_getDetect().chk_light(&eyePos)) { + bVar3 = true; + } else { + for (s32 i = 0; i < ARRAY_SSIZE(m2C4); i++) { + if (m2C4[i].ChkTgHit()) { + m2C4[i].ClrTgHit(); + bVar3 = true; + } + } + } + return bVar3; +} + +/* 0000115C-0000119C .text power_up__Q212daObjSwlight5Act_cFv */ +bool Act_c::power_up() { + return cLib_chaseF(&mF30, 1.0f, 0.033333335f); +} + +/* 0000119C-000011DC .text power_down__Q212daObjSwlight5Act_cFv */ +bool Act_c::power_down() { + return cLib_chaseF(&mF30, 0.0f, 0.033333335f); +} + +/* 000011DC-000011F4 .text mode_norm_moon_init__Q212daObjSwlight5Act_cFv */ +void Act_c::mode_norm_moon_init() { + mF28 = 0; + mF2C = attr().m00; +} + +/* 000011F4-00001334 .text mode_norm_moon__Q212daObjSwlight5Act_cFv */ +void Act_c::mode_norm_moon() { + bool bVar3 = false; + + if (chk_light()) { + if (mF2C > 0) { + mF2C--; + } + } else { + mF2C = attr().m00; + } + + if (is_switch() || mF2C == 0) { + bVar3 = power_up(); + } else { + power_down(); + } + + if (bVar3) { + fopAcM_seStart(this, JA_SE_OBJ_LIGHT_SW_ON, 0); + on_switch(); + mode_norm_sun_init(); + } else { + set_cc(); + } +} + +/* 00001334-00001340 .text mode_norm_sun_init__Q212daObjSwlight5Act_cFv */ +void Act_c::mode_norm_sun_init() { + mF28 = 1; +} + +/* 00001340-00001400 .text mode_norm_sun__Q212daObjSwlight5Act_cFv */ +void Act_c::mode_norm_sun() { + if (is_switch()) { + power_up(); + fopAcM_seStart(this, JA_SE_OBJ_LIGHT_SW_SUNSHINE, 0); + } else if (power_down()) { + mode_norm_moon_init(); + } +} + +/* 00001400-00001418 .text mode_active_moon_init__Q212daObjSwlight5Act_cFv */ +void Act_c::mode_active_moon_init() { + mF28 = 2; + mF2C = attr().m00; +} + +/* 00001418-00001524 .text mode_active_moon__Q212daObjSwlight5Act_cFv */ +void Act_c::mode_active_moon() { + bool bVar2 = false; + + if (chk_light()) { + if (mF2C > 0) { + mF2C--; + } + } else { + mF2C = attr().m00; + } + + if (mF2C == 0) { + bVar2 = power_up(); + } else { + power_down(); + } + + if (bVar2 != false) { + fopAcM_seStart(this, JA_SE_OBJ_LIGHT_SW_ON, 0); + on_switch(); + mode_active_sun_init(); + } + + set_cc(); +} + +/* 00001524-00001530 .text mode_active_sun_init__Q212daObjSwlight5Act_cFv */ +void Act_c::mode_active_sun_init() { + mF28 = 3; +} + +/* 00001530-0000162C .text mode_active_sun__Q212daObjSwlight5Act_cFv */ +void Act_c::mode_active_sun() { + if (mF30 > 0.5f) { + fopAcM_seStart(this, JA_SE_OBJ_LIGHT_SW_SUNSHINE, 0); + } + + if (is_switch2() || chk_light()) { + power_up(); + } else if (power_down()) { + off_switch(); + mode_active_moon_init(); + } + set_cc(); +} + +/* 0000162C-00001714 .text _execute__Q212daObjSwlight5Act_cFv */ +bool Act_c::_execute() { + static ModeFunc mode_proc[] = { + &Act_c::mode_norm_moon, + &Act_c::mode_norm_sun, + &Act_c::mode_active_moon, + &Act_c::mode_active_sun, + }; + + (this->*mode_proc[mF28])(); + + m29C.play(); + m2B0.play(); + set_mtx(); + return true; +} + +/* 00001714-0000187C .text setMaterial__12daObjSwlightFP11J3DMaterialUc */ +void setMaterial(J3DMaterial* material, unsigned char arg2) { + while (material != NULL) { + if (arg2 == 0) { + material->getShape()->hide(); + } else { + material->getShape()->show(); + if (arg2 == 0xFF) { + material->setMaterialMode(1); + material->mPEBlock->getZMode()->setUpdateEnable(1); + material->mPEBlock->getBlend()->setType(GX_BM_NONE); + } else { + material->setMaterialMode(4); + material->mPEBlock->getZMode()->setUpdateEnable(0); + material->mPEBlock->getBlend()->setType(GX_BM_BLEND); + } + material->getTevKColor(3)->mColor.a = arg2; + } + + material = material->getNext(); + } +} + +/* 0000187C-00001970 .text setMaterial_Before_mirror__12daObjSwlightFP11J3DMaterialUc */ +void setMaterial_Before_mirror(J3DMaterial* material, unsigned char arg2) { + while (material != NULL) { + if (arg2 == 0) { + material->getShape()->hide(); + } else { + material->getShape()->show(); + material->setMaterialMode(4); + material->mPEBlock->getZMode()->setUpdateEnable(0); + material->mPEBlock->getBlend()->setType(GX_BM_BLEND); + material->getTevKColor(3)->mColor.a = arg2; + } + + material = material->getNext(); + } +} + +/* 00001970-00001AC4 .text _draw__Q212daObjSwlight5Act_cFv */ +bool Act_c::_draw() { + g_env_light.settingTevStruct(TEV_TYPE_ACTOR, ¤t.pos, &tevStr); + g_env_light.setLightTevColorType(m298, &tevStr); + + m29C.entry(m298->getModelData()); + m2B0.entry(m298->getModelData()); + + dComIfGd_setListBG(); + + J3DModelData* pJVar5 = m298->getModelData(); + u8 pJVar1 = mF30 * 255.0f; + + for (u16 i = 1; i <= 3; i++) { + setMaterial(pJVar5->getJointNodePointer(i)->getMesh(), pJVar1); + } + + pJVar1 = 0xff - pJVar1; + + setMaterial(pJVar5->getJointNodePointer(4)->getMesh(), pJVar1); + setMaterial_Before_mirror(pJVar5->getJointTree().getJointNodePointer(5)->getMesh(), pJVar1); + mDoExt_modelUpdateDL(m298); + + dComIfGd_setList(); + return true; +} + namespace { /* 00001AC4-00001AE4 .text Mthd_Create__Q212daObjSwlight29@unnamed@d_a_obj_swlight_cpp@FPv */ cPhs_State Mthd_Create(void* i_this) { - return ((daObjSwlight::Act_c*)i_this)->_create(); + return ((Act_c*)i_this)->_create(); } /* 00001AE4-00001B08 .text Mthd_Delete__Q212daObjSwlight29@unnamed@d_a_obj_swlight_cpp@FPv */ BOOL Mthd_Delete(void* i_this) { - return ((daObjSwlight::Act_c*)i_this)->_delete(); + return ((Act_c*)i_this)->_delete(); } /* 00001B08-00001B2C .text Mthd_Execute__Q212daObjSwlight29@unnamed@d_a_obj_swlight_cpp@FPv */ BOOL Mthd_Execute(void* i_this) { - return ((daObjSwlight::Act_c*)i_this)->_execute(); + return ((Act_c*)i_this)->_execute(); } /* 00001B2C-00001B50 .text Mthd_Draw__Q212daObjSwlight29@unnamed@d_a_obj_swlight_cpp@FPv */ BOOL Mthd_Draw(void* i_this) { - return ((daObjSwlight::Act_c*)i_this)->_draw(); + return ((Act_c*)i_this)->_draw(); } /* 00001B50-00001B58 .text Mthd_IsDelete__Q212daObjSwlight29@unnamed@d_a_obj_swlight_cpp@FPv */