From 023c06c5736af85b8ea50dba8ac6025875e8d844 Mon Sep 17 00:00:00 2001 From: Huitzi <73550465+marwernerh@users.noreply.github.com> Date: Sun, 24 Mar 2024 13:21:22 -0400 Subject: [PATCH] d_a_tag_statue_evt OK (#2107) * d_a_tag_statue_evt OK * Modification according to review --- .../d_a_tag_statue_evt/d_a_tag_statue_evt.h | 79 +- rel/d/a/tag/d_a_tag_statue_evt/Makefile | 2 - .../d_a_tag_statue_evt/d_a_tag_statue_evt.cpp | 1108 ++++++----------- .../unknown_translation_unit_bss.cpp | 26 - 4 files changed, 492 insertions(+), 723 deletions(-) delete mode 100644 rel/d/a/tag/d_a_tag_statue_evt/unknown_translation_unit_bss.cpp diff --git a/include/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt.h b/include/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt.h index f9592dce148..732375d5a51 100644 --- a/include/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt.h +++ b/include/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt.h @@ -1,6 +1,81 @@ #ifndef D_A_TAG_STATUE_EVT_H #define D_A_TAG_STATUE_EVT_H -#include "dolphin/types.h" +#include "f_op/f_op_actor_mng.h" -#endif /* D_A_TAG_STATUE_EVT_H */ +class daTagStatue_c : public fopAc_ac_c { +public: + /* 805A6FC4 */ void initBaseMtx(); + /* 805A7000 */ void setBaseMtx(); + /* 805A7068 */ cPhs__Step Create(); + /* 805A7230 */ int CreateHeap(); + /* 805A7424 */ cPhs__Step create(); + /* 805A7514 */ int execute(); + /* 805A759C */ void event_proc_call(); + /* 805A76AC */ void actionWait(); + /* 805A7714 */ void actionOrderEvent(); + /* 805A77A0 */ void actionEvent(); + /* 805A7848 */ void actionDead(); + /* 805A784C */ int demoProc(); + /* 805A7A68 */ void setParticle(); + /* 805A7B24 */ void endParticle(); + /* 805A7B78 */ BOOL checkStartDemo(); + /* 805A7CD0 */ BOOL checkOnEffect(); + /* 805A7E94 */ s32 getLetterCount(); + /* 805A7F0C */ int draw(); + /* 805A7FF8 */ int _delete(); + +private: + /* 0x568 */ request_of_phase_process_class mArcPhase; + /* 0x570 */ request_of_phase_process_class mEvArcPhase; + /* 0x578 */ J3DModel* mpModel; + /* 0x57C */ mDoExt_btkAnm* mpPlatformCircleBtk; + /* 0x580 */ mDoExt_brkAnm* mpGlowingSkyCharacterBrk; + /* 0x584 */ JPABaseEmitter* mpLightRingEmitters[3]; + /* 0x590 */ s32 mStaffId; + /* 0x594 */ u8 mCurrentAction; + /* 0x595 */ u8 mTimer; + /* 0x596 */ u8 mMapToolId; + /* 0x597 */ u8 mSkyCharacterEventBitIdIndex; + /* 0x598 */ s16 mEventId; + /* 0x59C */ u32 mTreasureDemoItemId; + /* 0x5A0 */ s32 mOwlStatueId; + + enum Action_e { + ACTION_WAIT_e, + ACTION_ORDER_EVENT_e, + ACTION_EVENT_e, + ACTION_DEAD_e + }; + + enum Demo_Action_e { + DEMO_ACTION_WAIT, + DEMO_ACTION_MOVE_OWL_STATUE, + DEMO_ACTION_AWARD_ITEM + }; + + enum Tag_Location_e { + TAG_LOCATION_FARON_WOODS, + TAG_LOCATION_GERUDO_DESERT, + TAG_LOCATION_KAKARIKO_GORGE, + TAG_LOCATION_GREAT_ELDIN_BRIDGE, + TAG_LOCATION_LAKE_HYLIA, + TAG_LOCATION_RUINED_THEATRE + }; + + void setAction(Action_e action) { + mCurrentAction = action; + } + + + u32 getSwbit() { + return fopAcM_GetParamBit(this, 0, 8); + } + + // Returns whether player has obtained a Sky Character from the tag + u32 getSwbit2() { + return fopAcM_GetParamBit(this, 12, 8); + } +}; + +#endif /* D_A_TAG_STATUE_EVT_H */ \ No newline at end of file diff --git a/rel/d/a/tag/d_a_tag_statue_evt/Makefile b/rel/d/a/tag/d_a_tag_statue_evt/Makefile index a491f8db1f1..f1f548c3bef 100644 --- a/rel/d/a/tag/d_a_tag_statue_evt/Makefile +++ b/rel/d/a/tag/d_a_tag_statue_evt/Makefile @@ -8,12 +8,10 @@ M133_MAP := $(BUILD_DIR)/rel/d/a/tag/d_a_tag_statue_evt.map M133_CPP_FILES := \ rel/executor.cpp \ - rel/d/a/tag/d_a_tag_statue_evt/unknown_translation_unit_bss.cpp \ rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt.cpp \ M133_O_FILES := \ $(BUILD_DIR)/rel/executor.o \ - $(BUILD_DIR)/rel/d/a/tag/d_a_tag_statue_evt/unknown_translation_unit_bss.o \ $(BUILD_DIR)/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt.o \ M133_LIBS := \ diff --git a/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt.cpp b/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt.cpp index ad77475246c..9c2f2be0ddd 100644 --- a/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt.cpp +++ b/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt.cpp @@ -1,343 +1,55 @@ -// -// Generated By: dol2asm -// Translation Unit: d_a_tag_statue_evt -// +/* +/* Translation Unit: d_a_tag_statue_evt +/* Owl Statue Event Tag -- Awarding Sky Characters + */ #include "rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt.h" -#include "dol2asm.h" - -// -// Types: -// - -struct request_of_phase_process_class {}; - -struct csXyz {}; - -struct mDoMtx_stack_c { - /* 8000CF44 */ void ZXYrotM(csXyz const&); - - static u8 now[48]; -}; - -struct J3DMaterialTable {}; - -struct J3DAnmTextureSRTKey {}; - -struct mDoExt_btkAnm { - /* 8000D63C */ void init(J3DMaterialTable*, J3DAnmTextureSRTKey*, int, int, f32, s16, s16); - /* 8000D6D8 */ void entry(J3DMaterialTable*, f32); -}; - -struct J3DAnmTevRegKey {}; - -struct mDoExt_brkAnm { - /* 8000D70C */ void init(J3DMaterialTable*, J3DAnmTevRegKey*, int, int, f32, s16, s16); - /* 8000D7A8 */ void entry(J3DMaterialTable*, f32); -}; - -struct mDoExt_baseAnm { - /* 8000D428 */ void play(); -}; - -struct fopAc_ac_c { - /* 80018B64 */ fopAc_ac_c(); -}; - -struct daTagStatue_c { - /* 805A6FC4 */ void initBaseMtx(); - /* 805A7000 */ void setBaseMtx(); - /* 805A7068 */ void Create(); - /* 805A7230 */ void CreateHeap(); - /* 805A7424 */ void create(); - /* 805A7514 */ void execute(); - /* 805A759C */ void event_proc_call(); - /* 805A76AC */ void actionWait(); - /* 805A7714 */ void actionOrderEvent(); - /* 805A77A0 */ void actionEvent(); - /* 805A7848 */ void actionDead(); - /* 805A784C */ void demoProc(); - /* 805A7A68 */ void setParticle(); - /* 805A7B24 */ void endParticle(); - /* 805A7B78 */ void checkStartDemo(); - /* 805A7CD0 */ void checkOnEffect(); - /* 805A7E94 */ void getLetterCount(); - /* 805A7F0C */ void draw(); - /* 805A7FF8 */ void _delete(); -}; - -struct dSv_info_c { - /* 80035200 */ void onSwitch(int, int); - /* 80035360 */ void isSwitch(int, int) const; -}; - -struct dSv_event_c { - /* 8003498C */ void onEventBit(u16); - /* 800349BC */ void isEventBit(u16) const; -}; - -struct dKy_tevstr_c {}; - -struct J3DModelData {}; - -struct cXyz {}; - -struct dScnKy_env_light_c { - /* 801A37C4 */ void settingTevStruct(int, cXyz*, dKy_tevstr_c*); - /* 801A4DA0 */ void setLightTevColorType_MAJI(J3DModelData*, dKy_tevstr_c*); -}; - -struct dRes_info_c {}; - -struct dRes_control_c { - /* 8003C2EC */ void getRes(char const*, s32, dRes_info_c*, int); -}; - -struct dPa_levelEcallBack {}; - -struct _GXColor {}; - -struct dPa_control_c { - /* 8004CA90 */ void set(u8, u16, cXyz const*, dKy_tevstr_c const*, csXyz const*, cXyz const*, - u8, dPa_levelEcallBack*, s8, _GXColor const*, _GXColor const*, - cXyz const*, f32); -}; - -struct dEvt_control_c { - /* 80042468 */ void reset(); -}; - -struct dEvent_manager_c { - /* 80047758 */ void getEventIdx(fopAc_ac_c*, char const*, u8); - /* 80047A78 */ void endCheck(s16); - /* 80047D4C */ void getIsAddvance(int); - /* 80047E10 */ void getMyActIdx(int, char const* const*, int, int, int); - /* 800480EC */ void getMySubstanceP(int, char const*, int); - /* 8004817C */ void cutEnd(int); -}; - -struct Z2SeqMgr { - /* 802AF49C */ void subBgmStart(u32); -}; - -struct Z2AudioMgr { - static u8 mAudioMgrPtr[4 + 4 /* padding */]; -}; - -struct J3DModel {}; - -struct J3DFrameCtrl { - /* 803283FC */ void init(s16); - /* 805A73DC */ ~J3DFrameCtrl(); -}; - -// -// Forward References: -// - -extern "C" static void CheckCreateHeap__FP10fopAc_ac_c(); -extern "C" static void s_s_sub__FPvPv(); -extern "C" void initBaseMtx__13daTagStatue_cFv(); -extern "C" void setBaseMtx__13daTagStatue_cFv(); -extern "C" void Create__13daTagStatue_cFv(); -extern "C" void CreateHeap__13daTagStatue_cFv(); -extern "C" void __dt__12J3DFrameCtrlFv(); -extern "C" void create__13daTagStatue_cFv(); -extern "C" void execute__13daTagStatue_cFv(); -extern "C" void event_proc_call__13daTagStatue_cFv(); -extern "C" void actionWait__13daTagStatue_cFv(); -extern "C" void actionOrderEvent__13daTagStatue_cFv(); -extern "C" void actionEvent__13daTagStatue_cFv(); -extern "C" void actionDead__13daTagStatue_cFv(); -extern "C" void demoProc__13daTagStatue_cFv(); -extern "C" void setParticle__13daTagStatue_cFv(); -extern "C" void endParticle__13daTagStatue_cFv(); -extern "C" void checkStartDemo__13daTagStatue_cFv(); -extern "C" void checkOnEffect__13daTagStatue_cFv(); -extern "C" void getLetterCount__13daTagStatue_cFv(); -extern "C" void draw__13daTagStatue_cFv(); -extern "C" void _delete__13daTagStatue_cFv(); -extern "C" static void daTagStatue_Draw__FP13daTagStatue_c(); -extern "C" static void daTagStatue_Execute__FP13daTagStatue_c(); -extern "C" static void daTagStatue_Delete__FP13daTagStatue_c(); -extern "C" static void daTagStatue_Create__FP13daTagStatue_c(); -extern "C" void func_805A80E0(void* _this, u8*); -extern "C" extern char const* const d_a_tag_statue_evt__stringBase0; - -// -// External References: -// - -extern "C" void ZXYrotM__14mDoMtx_stack_cFRC5csXyz(); -extern "C" void play__14mDoExt_baseAnmFv(); -extern "C" void init__13mDoExt_btkAnmFP16J3DMaterialTableP19J3DAnmTextureSRTKeyiifss(); -extern "C" void entry__13mDoExt_btkAnmFP16J3DMaterialTablef(); -extern "C" void init__13mDoExt_brkAnmFP16J3DMaterialTableP15J3DAnmTevRegKeyiifss(); -extern "C" void entry__13mDoExt_brkAnmFP16J3DMaterialTablef(); -extern "C" void mDoExt_modelUpdateDL__FP8J3DModel(); -extern "C" void mDoExt_btkAnmRemove__FP12J3DModelData(); -extern "C" void mDoExt_brkAnmRemove__FP12J3DModelData(); -extern "C" void mDoExt_J3DModel__create__FP12J3DModelDataUlUl(); -extern "C" void __ct__10fopAc_ac_cFv(); -extern "C" void fopAc_IsActor__FPv(); -extern "C" void fopAcIt_Judge__FPFPvPv_PvPv(); -extern "C" void fopAcM_entrySolidHeap__FP10fopAc_ac_cPFP10fopAc_ac_c_iUl(); -extern "C" void fopAcM_setCullSizeBox__FP10fopAc_ac_cffffff(); -extern "C" void fopAcM_orderOtherEventId__FP10fopAc_ac_csUcUsUsUs(); -extern "C" void fopAcM_createItemForTrBoxDemo__FPC4cXyziiiPC5csXyzPC4cXyz(); -extern "C" void fpcEx_Search__FPFPvPv_PvPv(); -extern "C" void fpcSch_JudgeByID__FPvPv(); -extern "C" void dComIfG_resLoad__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfG_resDelete__FP30request_of_phase_process_classPCc(); -extern "C" void onEventBit__11dSv_event_cFUs(); -extern "C" void isEventBit__11dSv_event_cCFUs(); -extern "C" void onSwitch__10dSv_info_cFii(); -extern "C" void isSwitch__10dSv_info_cCFii(); -extern "C" void getRes__14dRes_control_cFPCclP11dRes_info_ci(); -extern "C" void reset__14dEvt_control_cFv(); -extern "C" void setPtI_Id__14dEvt_control_cFUi(); -extern "C" void getEventIdx__16dEvent_manager_cFP10fopAc_ac_cPCcUc(); -extern "C" void endCheck__16dEvent_manager_cFs(); -extern "C" void getIsAddvance__16dEvent_manager_cFi(); -extern "C" void getMyActIdx__16dEvent_manager_cFiPCPCciii(); -extern "C" void getMySubstanceP__16dEvent_manager_cFiPCci(); -extern "C" void cutEnd__16dEvent_manager_cFi(); -extern "C" void -set__13dPa_control_cFUcUsPC4cXyzPC12dKy_tevstr_cPC5csXyzPC4cXyzUcP18dPa_levelEcallBackScPC8_GXColorPC8_GXColorPC4cXyzf(); -extern "C" void settingTevStruct__18dScnKy_env_light_cFiP4cXyzP12dKy_tevstr_c(); -extern "C" void setLightTevColorType_MAJI__18dScnKy_env_light_cFP12J3DModelDataP12dKy_tevstr_c(); -extern "C" void subBgmStart__8Z2SeqMgrFUl(); -extern "C" void* __nw__FUl(); -extern "C" void __dl__FPv(); -extern "C" void init__12J3DFrameCtrlFs(); -extern "C" void PSMTXCopy(); -extern "C" void PSMTXTrans(); -extern "C" void PSVECSquareDistance(); -extern "C" void __ptmf_scall(); -extern "C" void _savegpr_26(); -extern "C" void _savegpr_27(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_26(); -extern "C" void _restgpr_27(); -extern "C" void _restgpr_29(); -extern "C" extern void* g_fopAc_Method[8]; -extern "C" extern void* g_fpcLf_Method[5 + 1 /* padding */]; -extern "C" u8 now__14mDoMtx_stack_c[48]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; -extern "C" extern u8 g_env_light[4880]; -extern "C" extern u8 j3dSys[284]; -extern "C" extern u32 __float_nan; -extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */]; -extern "C" extern u8 data_805A8390[4]; - -// -// Declarations: -// +#include "d/com/d_com_inf_game.h" /* 805A6F58-805A6F78 000078 0020+00 1/1 0/0 0/0 .text CheckCreateHeap__FP10fopAc_ac_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void CheckCreateHeap(fopAc_ac_c* param_0) { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/CheckCreateHeap__FP10fopAc_ac_c.s" +static int CheckCreateHeap(fopAc_ac_c* i_this) { + daTagStatue_c* tag_statue = static_cast(i_this); + return tag_statue->CreateHeap(); } -#pragma pop /* 805A6F78-805A6FC4 000098 004C+00 2/2 0/0 0/0 .text s_s_sub__FPvPv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void s_s_sub(void* param_0, void* param_1) { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/s_s_sub__FPvPv.s" +// Returns ID of Owl Statue corresponding to tag +static void* s_s_sub(void* i_proc, void* unused) { + if (fopAc_IsActor(i_proc) && fopAcM_GetName(i_proc) == PROC_CSTAF) { + return i_proc; + } + + return NULL; } -#pragma pop /* 805A6FC4-805A7000 0000E4 003C+00 1/1 0/0 0/0 .text initBaseMtx__13daTagStatue_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daTagStatue_c::initBaseMtx() { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/initBaseMtx__13daTagStatue_cFv.s" +void daTagStatue_c::initBaseMtx() { + mpModel->setBaseScale(scale); + setBaseMtx(); } -#pragma pop /* ############################################################################################## */ /* 805A8104-805A8110 000000 000C+00 4/4 0/0 0/0 .rodata l_event_bit */ -SECTION_RODATA static u8 const l_event_bit[12] = { - 0x60, 0x80, 0x60, 0x40, 0x60, 0x20, 0x60, 0x10, 0x60, 0x08, 0x62, 0x04, +static const u16 l_event_bit[6] = { + dSv_event_flag_c::F_0791, dSv_event_flag_c::F_0792, dSv_event_flag_c::F_0793, + dSv_event_flag_c::F_0794, dSv_event_flag_c::F_0795, dSv_event_flag_c::F_0812 }; -COMPILER_STRIP_GATE(0x805A8104, &l_event_bit); - -/* 805A8110-805A8114 00000C 0004+00 4/4 0/0 0/0 .rodata @3690 */ -SECTION_RODATA static f32 const lit_3690 = 1.0f; -COMPILER_STRIP_GATE(0x805A8110, &lit_3690); /* 805A7000-805A7068 000120 0068+00 2/2 0/0 0/0 .text setBaseMtx__13daTagStatue_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daTagStatue_c::setBaseMtx() { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/setBaseMtx__13daTagStatue_cFv.s" -} -#pragma pop +void daTagStatue_c::setBaseMtx() { + const cXyz& current_pos = fopAcM_GetPosition(this); + mDoMtx_stack_c::transS(current_pos.x, 1.0f + current_pos.y, current_pos.z); + const csXyz& shape_angle = *fopAcM_GetShapeAngle_p(this); + mDoMtx_stack_c::ZXYrotM(shape_angle); -/* ############################################################################################## */ -/* 805A8114-805A811C 000010 0004+04 1/3 0/0 0/0 .rodata @3756 */ -SECTION_RODATA static u8 const lit_3756[4 + 4 /* padding */] = { - 0x00, - 0x00, - 0x00, - 0x00, - /* padding */ - 0x00, - 0x00, - 0x00, - 0x00, -}; -COMPILER_STRIP_GATE(0x805A8114, &lit_3756); - -/* 805A811C-805A8124 000018 0008+00 1/1 0/0 0/0 .rodata @3758 */ -SECTION_RODATA static u8 const lit_3758[8] = { - 0x43, 0x30, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x805A811C, &lit_3758); - -/* 805A8124-805A812C 000020 0008+00 1/1 0/0 0/0 .rodata @3759 */ -SECTION_RODATA static u8 const lit_3759[8] = { - 0x43, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x805A8124, &lit_3759); - -/* 805A8154-805A8154 000050 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_805A8154 = "Obj_cs_f"; -SECTION_DEAD static char const* const stringBase_805A815D = "SKY_LETTERS_00"; -SECTION_DEAD static char const* const stringBase_805A816C = "SKY_LETTERS_01"; -SECTION_DEAD static char const* const stringBase_805A817B = "SKY_LETTERS_02"; -SECTION_DEAD static char const* const stringBase_805A818A = "SKY_LETTERS_03"; -SECTION_DEAD static char const* const stringBase_805A8199 = "SKY_LETTERS_04"; -SECTION_DEAD static char const* const stringBase_805A81A8 = "SKY_LETTERS_05"; -SECTION_DEAD static char const* const stringBase_805A81B7 = "cs_ev_01"; -SECTION_DEAD static char const* const stringBase_805A81C0 = "cs_ev_02"; -SECTION_DEAD static char const* const stringBase_805A81C9 = "cs_ev_03"; -SECTION_DEAD static char const* const stringBase_805A81D2 = "cs_ev_04"; -SECTION_DEAD static char const* const stringBase_805A81DB = "cs_ev_05"; -#pragma pop + mpModel->setBaseTRMtx(mDoMtx_stack_c::now); +} /* 805A81FC-805A8208 000000 000C+00 3/3 0/0 0/0 .data cNullVec__6Z2Calc */ -SECTION_DATA static u8 cNullVec__6Z2Calc[12] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; +static Vec cNullVec__6Z2Calc = {0.0f, 0.0f, 0.0f}; /* 805A8208-805A821C 00000C 0004+10 0/0 0/0 0/0 .data @1787 */ -#pragma push -#pragma force_active on -SECTION_DATA static u32 lit_1787[1 + 4 /* padding */] = { +static u32 lit_1787[1 + 4 /* padding */] = { 0x02000201, /* padding */ 0x40080000, @@ -345,461 +57,471 @@ SECTION_DATA static u32 lit_1787[1 + 4 /* padding */] = { 0x3FE00000, 0x00000000, }; -#pragma pop /* 805A821C-805A8220 -00001 0004+00 3/4 0/0 0/0 .data l_arcName */ -SECTION_DATA static void* l_arcName = (void*)&d_a_tag_statue_evt__stringBase0; +static char* l_arcName = "Obj_cs_f"; /* 805A8220-805A8228 000024 0006+02 1/1 0/0 0/0 .data l_eff_id */ -SECTION_DATA static u8 l_eff_id[6 + 2 /* padding */] = { - 0x8C, - 0x7E, - 0x8C, - 0x7F, - 0x8C, - 0x84, - /* padding */ - 0x00, - 0x00, +static u16 l_eff_id[3] = { + 0x8C7E, 0x8C7F, 0x8C84 }; /* 805A8228-805A8240 -00001 0018+00 0/1 0/0 0/0 .data l_eventName */ -#pragma push -#pragma force_active on -SECTION_DATA static void* l_eventName[6] = { - (void*)(((char*)&d_a_tag_statue_evt__stringBase0) + 0x9), - (void*)(((char*)&d_a_tag_statue_evt__stringBase0) + 0x18), - (void*)(((char*)&d_a_tag_statue_evt__stringBase0) + 0x27), - (void*)(((char*)&d_a_tag_statue_evt__stringBase0) + 0x36), - (void*)(((char*)&d_a_tag_statue_evt__stringBase0) + 0x45), - (void*)(((char*)&d_a_tag_statue_evt__stringBase0) + 0x54), +static char* l_eventName[6] = { + "SKY_LETTERS_00", // Faron Woods + "SKY_LETTERS_01", // Gerudo Desert + "SKY_LETTERS_02", // Kakariko Gorge + "SKY_LETTERS_03", // Great Eldin Bridge + "SKY_LETTERS_04", // Lake Hylia + "SKY_LETTERS_05" // Ruined Theatre }; -#pragma pop /* 805A8240-805A8258 -00001 0018+00 2/3 0/0 0/0 .data l_evArcName */ -SECTION_DATA static void* l_evArcName[6] = { - (void*)NULL, - (void*)(((char*)&d_a_tag_statue_evt__stringBase0) + 0x63), - (void*)(((char*)&d_a_tag_statue_evt__stringBase0) + 0x6C), - (void*)(((char*)&d_a_tag_statue_evt__stringBase0) + 0x75), - (void*)(((char*)&d_a_tag_statue_evt__stringBase0) + 0x7E), - (void*)(((char*)&d_a_tag_statue_evt__stringBase0) + 0x87), +static char* l_evArcName[6] = { + NULL, // Faron Woods + "cs_ev_01", // Gerudo Desert + "cs_ev_02", // Kakariko Gorge + "cs_ev_03", // Great Eldin Bridge + "cs_ev_04", // Lake Hylia + "cs_ev_05" // Ruined Theatre }; /* 805A8258-805A8270 00005C 0018+00 0/1 0/0 0/0 .data l_cull_box */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_cull_box[24] = { - 0xC3, 0x96, 0x00, 0x00, 0xC2, 0xC8, 0x00, 0x00, 0xC3, 0x96, 0x00, 0x00, - 0x43, 0x96, 0x00, 0x00, 0x43, 0xC8, 0x00, 0x00, 0x43, 0x96, 0x00, 0x00, +static Vec l_cull_box[2] = { + {-300.0f, -100.0f, -300.0f}, // Min + {300.0f, 400.0f, 300.0f} // Max }; -#pragma pop /* 805A7068-805A7230 000188 01C8+00 1/1 0/0 0/0 .text Create__13daTagStatue_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daTagStatue_c::Create() { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/Create__13daTagStatue_cFv.s" +cPhs__Step daTagStatue_c::Create() { + if(fopAcM_isSwitch(this, getSwbit2())) { + // Player already obtained Sky Character from this tag + setAction(ACTION_DEAD_e); + mpGlowingSkyCharacterBrk->setFrame(0.0f); + mpGlowingSkyCharacterBrk->setPlaySpeed(0.0f); + } + else { + if(fopAcM_isSwitch(this, getSwbit())) { + setParticle(); + mpGlowingSkyCharacterBrk->setFrame(mpGlowingSkyCharacterBrk->getEndFrame()); + } + else { + mpGlowingSkyCharacterBrk->setFrame(0.0f); + mpGlowingSkyCharacterBrk->setPlaySpeed(0.0f); + } + + setAction(ACTION_WAIT_e); + } + + mpPlatformCircleBtk->setFrame(static_cast(mSkyCharacterEventBitIdIndex)); + + initBaseMtx(); + fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); + fopAcM_setCullSizeBox(this, l_cull_box[0].x, l_cull_box[0].y, l_cull_box[0].z, l_cull_box[1].x, l_cull_box[1].y, l_cull_box[1].z); + + char* ev_arc_name = l_evArcName[mSkyCharacterEventBitIdIndex]; + + if(!ev_arc_name) { + eventInfo.setArchiveName(l_arcName); + } + else { + eventInfo.setArchiveName(ev_arc_name); + } + + mMapToolId = 255; + + mEventId = dComIfGp_getPEvtManager()->getEventIdx(this, l_eventName[mSkyCharacterEventBitIdIndex], 0xFF); + + mTreasureDemoItemId = -1; + mOwlStatueId = -1; + + return cPhs_LOADING_e; } -#pragma pop -/* ############################################################################################## */ -/* 805A8154-805A8154 000050 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_805A81E4 = "WAIT"; -SECTION_DEAD static char const* const stringBase_805A81E9 = "ST_MOVE"; -SECTION_DEAD static char const* const stringBase_805A81F1 = "ITEM"; -#pragma pop - -/* 805A8270-805A827C -00001 000C+00 0/1 0/0 0/0 .data @3878 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_3878[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)actionWait__13daTagStatue_cFv, -}; -#pragma pop - -/* 805A827C-805A8288 -00001 000C+00 0/1 0/0 0/0 .data @3879 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_3879[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)actionOrderEvent__13daTagStatue_cFv, -}; -#pragma pop - -/* 805A8288-805A8294 -00001 000C+00 0/1 0/0 0/0 .data @3880 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_3880[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)actionEvent__13daTagStatue_cFv, -}; -#pragma pop - -/* 805A8294-805A82A0 -00001 000C+00 0/1 0/0 0/0 .data @3881 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_3881[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)actionDead__13daTagStatue_cFv, -}; -#pragma pop - -/* 805A82A0-805A82D0 0000A4 0030+00 0/1 0/0 0/0 .data l_func$3877 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_func[48] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -#pragma pop - -/* 805A82D0-805A82DC -00001 000C+00 0/1 0/0 0/0 .data action_table$3942 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* action_table[3] = { - (void*)(((char*)&d_a_tag_statue_evt__stringBase0) + 0x90), - (void*)(((char*)&d_a_tag_statue_evt__stringBase0) + 0x95), - (void*)(((char*)&d_a_tag_statue_evt__stringBase0) + 0x9D), -}; -#pragma pop +/* 805A7230-805A73DC 000350 01AC+00 1/1 0/0 0/0 .text CreateHeap__13daTagStatue_cFv */ +int daTagStatue_c::CreateHeap() { + J3DModelData* model_data = static_cast(dComIfG_getObjectRes(l_arcName, 6)); + mpModel = mDoExt_J3DModel__create(model_data, 0x00080000, 0x11000284); -/* 805A82DC-805A8324 0000E0 0048+00 0/1 0/0 0/0 .data l_statue_pos$3943 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_statue_pos[72] = { - 0xC6, 0x87, 0x40, 0x9A, 0xC3, 0xAE, 0x8C, 0xCD, 0xC6, 0xA0, 0x56, 0x66, 0xC6, 0x87, 0x40, - 0x9A, 0xC3, 0xAE, 0x8C, 0xCD, 0xC6, 0xA0, 0x56, 0x66, 0xC6, 0x17, 0x2E, 0x66, 0xC5, 0x96, - 0x00, 0x00, 0x47, 0x1B, 0x0D, 0xE6, 0x47, 0x02, 0x41, 0x9A, 0xC2, 0x97, 0x33, 0x33, 0xC7, - 0x0D, 0xEB, 0x1A, 0xC7, 0xB7, 0x9C, 0xC0, 0xC5, 0xAA, 0x00, 0xCD, 0x46, 0x90, 0xCD, 0xCD, - 0xC7, 0x9F, 0x15, 0xA6, 0xC4, 0xCE, 0xC3, 0x33, 0x46, 0xA2, 0xC0, 0x66, -}; -#pragma pop + if(!mpModel) return 0; -/* 805A8324-805A8330 000128 000C+00 0/1 0/0 0/0 .data l_statue_ang$3944 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_statue_ang[12] = { - 0x40, 0x00, 0x40, 0x00, 0x21, 0x25, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, -}; -#pragma pop + J3DAnmTextureSRTKey* btk = reinterpret_cast(dComIfG_getObjectRes(l_arcName, 12)); + mpPlatformCircleBtk = new mDoExt_btkAnm(); -/* 805A8330-805A8350 -00001 0020+00 1/0 0/0 0/0 .data l_daTagStatue_Method */ -SECTION_DATA static void* l_daTagStatue_Method[8] = { - (void*)daTagStatue_Create__FP13daTagStatue_c, - (void*)daTagStatue_Delete__FP13daTagStatue_c, - (void*)daTagStatue_Execute__FP13daTagStatue_c, - (void*)NULL, - (void*)daTagStatue_Draw__FP13daTagStatue_c, - (void*)NULL, - (void*)NULL, - (void*)NULL, -}; -/* 805A8350-805A8380 -00001 0030+00 0/0 0/0 1/0 .data g_profile_Tag_Statue */ -SECTION_DATA extern void* g_profile_Tag_Statue[12] = { - (void*)0xFFFFFFFD, (void*)0x0007FFFD, - (void*)0x01AE0000, (void*)&g_fpcLf_Method, - (void*)0x000005A4, (void*)NULL, - (void*)NULL, (void*)&g_fopAc_Method, - (void*)0x024C0000, (void*)&l_daTagStatue_Method, - (void*)0x00040100, (void*)0x000E0000, -}; + if(!mpPlatformCircleBtk || !mpPlatformCircleBtk->init(model_data, btk, 1, 0, 1.0f, 0, -1)) + return 0; -/* 805A8380-805A838C 000184 000C+00 2/2 0/0 0/0 .data __vt__12J3DFrameCtrl */ -SECTION_DATA extern void* __vt__12J3DFrameCtrl[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12J3DFrameCtrlFv, -}; + J3DAnmTevRegKey* brk = reinterpret_cast(dComIfG_getObjectRes(l_arcName, 9)); + mpGlowingSkyCharacterBrk = new mDoExt_brkAnm(); -/* 805A7230-805A73DC 000350 01AC+00 1/1 0/0 0/0 .text CreateHeap__13daTagStatue_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daTagStatue_c::CreateHeap() { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/CreateHeap__13daTagStatue_cFv.s" -} -#pragma pop - -/* 805A73DC-805A7424 0004FC 0048+00 1/1 0/0 0/0 .text __dt__12J3DFrameCtrlFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm J3DFrameCtrl::~J3DFrameCtrl() { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/__dt__12J3DFrameCtrlFv.s" + if(!mpGlowingSkyCharacterBrk || !mpGlowingSkyCharacterBrk->init(model_data, brk, 1, 0, 1.0f, 0, -1)) + return 0; + + return 1; } -#pragma pop /* 805A7424-805A7514 000544 00F0+00 1/2 0/0 0/0 .text create__13daTagStatue_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daTagStatue_c::create() { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/func_805A7424.s" +cPhs__Step daTagStatue_c::create() { + fopAcM_SetupActor(this, daTagStatue_c); + + mSkyCharacterEventBitIdIndex = fopAcM_GetParamBit(this, 8, 4); + + int phase; + if(l_evArcName[mSkyCharacterEventBitIdIndex]) { + phase = dComIfG_resLoad(&mEvArcPhase, l_evArcName[mSkyCharacterEventBitIdIndex]); + + if(phase != cPhs_COMPLEATE_e) + return static_cast(phase); + } + + phase = dComIfG_resLoad(&mArcPhase, l_arcName); + if(phase == cPhs_COMPLEATE_e) { + if(!fopAcM_entrySolidHeap(this, CheckCreateHeap, 0x1100)) + return cPhs_ERROR_e; + + if(Create() == cPhs_INIT_e) + return cPhs_ERROR_e; + } + + return static_cast(phase); } -#pragma pop /* 805A7514-805A759C 000634 0088+00 1/1 0/0 0/0 .text execute__13daTagStatue_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daTagStatue_c::execute() { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/execute__13daTagStatue_cFv.s" +int daTagStatue_c::execute() { + if(static_cast(mOwlStatueId + (1 << 16)) == 0xFFFF) { + base_process_class* found_owl_statue = fpcEx_Search(s_s_sub, this); + if(found_owl_statue) { + mOwlStatueId = fopAcM_GetID(found_owl_statue); + } + } + + event_proc_call(); + setBaseMtx(); + + if(mpGlowingSkyCharacterBrk) { + mpGlowingSkyCharacterBrk->play(); + } + + return 1; } -#pragma pop -/* ############################################################################################## */ -/* 805A812C-805A8134 000028 0004+04 1/1 0/0 0/0 .rodata @3894 */ -SECTION_RODATA static f32 const lit_3894[1 + 1 /* padding */] = { - -1.0f, - /* padding */ - 0.0f, -}; -COMPILER_STRIP_GATE(0x805A812C, &lit_3894); - -/* 805A759C-805A76AC 0006BC 0110+00 1/1 0/0 0/0 .text event_proc_call__13daTagStatue_cFv - */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daTagStatue_c::event_proc_call() { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/event_proc_call__13daTagStatue_cFv.s" +/* 805A759C-805A76AC 0006BC 0110+00 1/1 0/0 0/0 .text event_proc_call__13daTagStatue_cFv */ +void daTagStatue_c::event_proc_call() { + typedef void (daTagStatue_c::*actionFunc)(void); + static actionFunc l_func[4] = {&daTagStatue_c::actionWait, &daTagStatue_c::actionOrderEvent, + &daTagStatue_c::actionEvent, &daTagStatue_c::actionDead}; + + (this->*l_func[mCurrentAction])(); + + // Form ring of light around platform and glowing Sky Character if Owl Statue has been moved far enough away + if(checkOnEffect()) { + setParticle(); + mpGlowingSkyCharacterBrk->setPlaySpeed(1.0f); + } + else { + endParticle(); + mpGlowingSkyCharacterBrk->setPlaySpeed(-1.0f); + } } -#pragma pop /* 805A76AC-805A7714 0007CC 0068+00 1/0 0/0 0/0 .text actionWait__13daTagStatue_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daTagStatue_c::actionWait() { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/actionWait__13daTagStatue_cFv.s" +void daTagStatue_c::actionWait() { + if(checkStartDemo()) { + // Statue is far enough away and player is close enough to the tag for the cutscene to be ordered + setAction(ACTION_ORDER_EVENT_e); + fopAcM_orderOtherEventId(this, mEventId, mMapToolId, 0xFFFF, 0, 1); + eventInfo.i_onCondition(0x0002); + } } -#pragma pop -/* 805A7714-805A77A0 000834 008C+00 1/0 0/0 0/0 .text actionOrderEvent__13daTagStatue_cFv - */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daTagStatue_c::actionOrderEvent() { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/actionOrderEvent__13daTagStatue_cFv.s" +/* 805A7714-805A77A0 000834 008C+00 1/0 0/0 0/0 .text actionOrderEvent__13daTagStatue_cFv */ +void daTagStatue_c::actionOrderEvent() { + if(eventInfo.i_checkCommandDemoAccrpt()) { + // Cutscene order accepted + setAction(ACTION_EVENT_e); + mDoAud_subBgmStart(Z2BGM_KOMONJO_GET_INTRO); + demoProc(); + } + else { + // Cutscene order has not been accepted yet, attempt again + fopAcM_orderOtherEventId(this, mEventId, mMapToolId, 0xFFFF, 0, 1); + eventInfo.i_onCondition(0x0002); + } } -#pragma pop /* 805A77A0-805A7848 0008C0 00A8+00 1/0 0/0 0/0 .text actionEvent__13daTagStatue_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daTagStatue_c::actionEvent() { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/actionEvent__13daTagStatue_cFv.s" +void daTagStatue_c::actionEvent() { + if(dComIfGp_evmng_endCheck(mEventId)) { + setAction(ACTION_DEAD_e); + dComIfGp_event_reset(); + fopAcM_onSwitch(this, getSwbit2()); + dComIfGs_onEventBit(l_event_bit[mSkyCharacterEventBitIdIndex]); + } + else { + demoProc(); + } } -#pragma pop /* 805A7848-805A784C 000968 0004+00 1/0 0/0 0/0 .text actionDead__13daTagStatue_cFv */ void daTagStatue_c::actionDead() { /* empty function */ } -/* ############################################################################################## */ -/* 805A8154-805A8154 000050 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_805A81F6 = "Timer"; -#pragma pop +static char* action_table[3] = { + "WAIT", + "ST_MOVE", + "ITEM" +}; + +/* 805A82DC-805A8324 0000E0 0048+00 0/1 0/0 0/0 .data l_statue_pos$3943 */ +// Saved positions of Owl Statues for cutscenes +static Vec l_statue_pos[6] = { + {-17312.3007812f, -349.100006104f, -20523.1992188f}, // Faron Woods + {-17312.3007812f, -349.100006104f, -20523.1992188f}, // Gerudo Desert + {-9675.59960938f, -4800.0f, 39693.8984375f}, // Kakariko Gorge + {33345.6015625f, -75.5999984741f, -36331.1015625f}, // Great Eldin Bridge + {-94009.5f, -5440.10009766f, 18534.9003906f}, // Lake Hylia + {-81451.296875f, -1654.09997559f, 20832.1992188} // Ruined Theatre +}; + +/* 805A8324-805A8330 000128 000C+00 0/1 0/0 0/0 .data l_statue_ang$3944 */ +// Saved y orientations of Owl Statues for cutscenes +static s16 l_statue_ang[6] = { + 16384, // Faron Woods + 16384, // Gerudo Desert + 8485, // Kakariko Gorge + 16384, // Great Eldin Bridge + 16384, // Lake Hylia + 16384 // Ruined Theatre +}; /* 805A784C-805A7A68 00096C 021C+00 2/2 0/0 0/0 .text demoProc__13daTagStatue_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daTagStatue_c::demoProc() { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/demoProc__13daTagStatue_cFv.s" +int daTagStatue_c::demoProc() { + int act_id = dComIfGp_evmng_getMyActIdx(mStaffId, action_table, ARRAY_SIZE(action_table), 0, 0); + + if(dComIfGp_evmng_getIsAddvance(mStaffId)) { + switch(act_id) { + case DEMO_ACTION_WAIT: + // Delay fading to black + int* timer_p = dComIfGp_evmng_getMyIntegerP(mStaffId, "Timer"); + + if(!timer_p) { + mTimer = 1; + } + else { + mTimer = *timer_p; + } + + break; + case DEMO_ACTION_MOVE_OWL_STATUE: + // Position and orient Owl Statue behind player + if(mSkyCharacterEventBitIdIndex != TAG_LOCATION_GERUDO_DESERT && mSkyCharacterEventBitIdIndex != TAG_LOCATION_LAKE_HYLIA && mSkyCharacterEventBitIdIndex != TAG_LOCATION_RUINED_THEATRE) { + fopAc_ac_c* found_owl_statue = reinterpret_cast(fpcEx_Search(s_s_sub, this)); + if(found_owl_statue) { + found_owl_statue->current.pos = l_statue_pos[mSkyCharacterEventBitIdIndex]; + found_owl_statue->shape_angle.y = l_statue_ang[mSkyCharacterEventBitIdIndex]; + fopAcM_OnStatus(found_owl_statue, 0x800); + } + } + break; + case DEMO_ACTION_AWARD_ITEM: + // If the player already has 5 Sky Characters, reward them with the completed Ancient Sky Book, + // otherwise, reward another character + enum ItemTable item; + if(getLetterCount() == 5) { + item = ANCIENT_DOCUMENT2; + dComIfGs_onEventBit(dSv_event_flag_c::F_0796); + } + else { + item = AIR_LETTER; + } + + mTreasureDemoItemId = fopAcM_createItemForTrBoxDemo(&fopAcM_GetPosition(this), item, -1, fopAcM_GetRoomNo(this), 0, 0); + + if(static_cast(mTreasureDemoItemId + (1 << 16)) != 0xFFFF) { + dComIfGp_event_setItemPartnerId(mTreasureDemoItemId); + } + + break; + } + } + + switch(act_id) { + case DEMO_ACTION_WAIT: + if(!cLib_calcTimer(&mTimer)) { + dComIfGp_evmng_cutEnd(mStaffId); + } + break; + case DEMO_ACTION_MOVE_OWL_STATUE: + dComIfGp_evmng_cutEnd(mStaffId); + break; + default: + dComIfGp_evmng_cutEnd(mStaffId); + break; + } + + return 0; } -#pragma pop /* 805A7A68-805A7B24 000B88 00BC+00 2/2 0/0 0/0 .text setParticle__13daTagStatue_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daTagStatue_c::setParticle() { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/setParticle__13daTagStatue_cFv.s" +void daTagStatue_c::setParticle() { + for(int i = 0; i < 3; i++) { + if(!mpLightRingEmitters[i]) { + mpLightRingEmitters[i] = dComIfGp_particle_set(l_eff_id[i], ¤t.pos, &home.angle, &scale); + } + } } -#pragma pop /* 805A7B24-805A7B78 000C44 0054+00 2/2 0/0 0/0 .text endParticle__13daTagStatue_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daTagStatue_c::endParticle() { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/endParticle__13daTagStatue_cFv.s" +void daTagStatue_c::endParticle() { + for(int i = 0; i < 3; i++) { + if(mpLightRingEmitters[i]) { + mpLightRingEmitters[i]->becomeInvalidEmitter(); + mpLightRingEmitters[i]->quitImmortalEmitter(); + mpLightRingEmitters[i] = NULL; + } + } } -#pragma pop -/* ############################################################################################## */ -/* 805A8134-805A813C 000030 0008+00 0/2 0/0 0/0 .rodata @4079 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_4079[8] = { - 0x3F, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x805A8134, &lit_4079); -#pragma pop - -/* 805A813C-805A8144 000038 0008+00 0/2 0/0 0/0 .rodata @4080 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_4080[8] = { - 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x805A813C, &lit_4080); -#pragma pop - -/* 805A8144-805A814C 000040 0008+00 0/2 0/0 0/0 .rodata @4081 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_4081[8] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x805A8144, &lit_4081); -#pragma pop +/* 805A7B78-805A7CD0 000C98 0158+00 1/1 0/0 0/0 .text checkStartDemo__13daTagStatue_cFv */ +// Check if statue is far enough away from the Sky Character platform and if player is close enough to the tag for the cutscene +// of obtaining a Sky Character to be ordered +BOOL daTagStatue_c::checkStartDemo() { + const fopAc_ac_c* const player = dComIfGp_getPlayer(0); -/* 805A814C-805A8150 000048 0004+00 0/1 0/0 0/0 .rodata @4082 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4082 = 100.0f; -COMPILER_STRIP_GATE(0x805A814C, &lit_4082); -#pragma pop + if(!checkOnEffect()) { + // Owl Statue is not far enough away from tag + return 0; + } -/* 805A7B78-805A7CD0 000C98 0158+00 1/1 0/0 0/0 .text checkStartDemo__13daTagStatue_cFv - */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daTagStatue_c::checkStartDemo() { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/checkStartDemo__13daTagStatue_cFv.s" -} -#pragma pop + const f32 tag_distance_to_player = sqrtf(PSVECSquareDistance(&player->current.pos, ¤t.pos)); -/* ############################################################################################## */ -/* 805A8150-805A8154 00004C 0004+00 0/1 0/0 0/0 .rodata @4143 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4143 = 120.0f; -COMPILER_STRIP_GATE(0x805A8150, &lit_4143); -#pragma pop + return (tag_distance_to_player < 100.0f); +} /* 805A7CD0-805A7E94 000DF0 01C4+00 2/2 0/0 0/0 .text checkOnEffect__13daTagStatue_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daTagStatue_c::checkOnEffect() { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/checkOnEffect__13daTagStatue_cFv.s" +// Return whether the owl statue has moved far enough away (in the horizontal plane) from the platform where the Sky Character is obtained +// in order for its glowing effects to occur and the cutscene to be ordered +BOOL daTagStatue_c::checkOnEffect() { + BOOL is_switch = fopAcM_isSwitch(this, getSwbit2()); + if(!is_switch && static_cast(mOwlStatueId + (1 << 16)) != 0xFFFF) { + fopAc_ac_c* found_owl_statue = fopAcM_SearchByID(mOwlStatueId); + if(found_owl_statue) { + Vec statue_tag_xy_pos; + Vec found_owl_statue_xy_pos; + + const f32 found_owl_statue_z = fopAcM_GetPosition(found_owl_statue).z; + const f32 found_owl_statue_x = fopAcM_GetPosition(found_owl_statue).x; + found_owl_statue_xy_pos.x = found_owl_statue_x; + found_owl_statue_xy_pos.y = 0.0f; + found_owl_statue_xy_pos.z = found_owl_statue_z; + + const f32 statue_tag_z = fopAcM_GetPosition(this).z; + const f32 statue_tag_x = fopAcM_GetPosition(this).x; + statue_tag_xy_pos.x = statue_tag_x; + statue_tag_xy_pos.y = 0.0f; + statue_tag_xy_pos.z = statue_tag_z; + + const f32 distance_between_statue_and_tag = sqrtf(PSVECSquareDistance(&found_owl_statue_xy_pos, &statue_tag_xy_pos)); + + if(distance_between_statue_and_tag > 120.0f) return TRUE; + } + else { + // No Owl Statue found, platform cannot be covered + return TRUE; + } + } + + return FALSE; } -#pragma pop /* 805A7E94-805A7F0C 000FB4 0078+00 1/1 0/0 0/0 .text getLetterCount__13daTagStatue_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daTagStatue_c::getLetterCount() { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/getLetterCount__13daTagStatue_cFv.s" -} -#pragma pop + s32 daTagStatue_c::getLetterCount() { + s32 numLetters = 0; + for(int i = 0; i < 6; i++) { + if(dComIfGs_isEventBit(l_event_bit[i])) { + numLetters++; + } + } + + return numLetters; + } /* 805A7F0C-805A7FF8 00102C 00EC+00 1/1 0/0 0/0 .text draw__13daTagStatue_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daTagStatue_c::draw() { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/draw__13daTagStatue_cFv.s" +int daTagStatue_c::draw() { + dScnKy_env_light_c* env_light = dKy_getEnvlight(); + env_light->settingTevStruct(0, ¤t.pos, &tevStr); + env_light->setLightTevColorType_MAJI(mpModel, &tevStr); + + dComIfGd_setListBG(); + + mpGlowingSkyCharacterBrk->entry(mpModel->getModelData()); + mpPlatformCircleBtk->entry(mpModel->getModelData()); + mDoExt_modelUpdateDL(mpModel); + mDoExt_brkAnmRemove(mpModel->getModelData()); + mDoExt_btkAnmRemove(mpModel->getModelData()); + + dComIfGd_setList(); + + return 1; } -#pragma pop /* 805A7FF8-805A8060 001118 0068+00 1/1 0/0 0/0 .text _delete__13daTagStatue_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daTagStatue_c::_delete() { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/_delete__13daTagStatue_cFv.s" +int daTagStatue_c::_delete() { + endParticle(); + dComIfG_resDelete(&mArcPhase, l_arcName); + if(l_evArcName[mSkyCharacterEventBitIdIndex]) { + dComIfG_resDelete(&mEvArcPhase, l_evArcName[mSkyCharacterEventBitIdIndex]); + } + + return 1; } -#pragma pop -/* 805A8060-805A8080 001180 0020+00 1/0 0/0 0/0 .text daTagStatue_Draw__FP13daTagStatue_c - */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daTagStatue_Draw(daTagStatue_c* param_0) { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/daTagStatue_Draw__FP13daTagStatue_c.s" -} -#pragma pop +/* 805A8060-805A8080 001180 0020+00 1/0 0/0 0/0 .text daTagStatue_Draw__FP13daTagStatue_c */ + static int daTagStatue_Draw(daTagStatue_c* i_this) { + return i_this->draw(); + } /* 805A8080-805A80A0 0011A0 0020+00 1/0 0/0 0/0 .text daTagStatue_Execute__FP13daTagStatue_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daTagStatue_Execute(daTagStatue_c* param_0) { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/daTagStatue_Execute__FP13daTagStatue_c.s" +static int daTagStatue_Execute(daTagStatue_c* i_this) { + return i_this->execute(); } -#pragma pop /* 805A80A0-805A80C0 0011C0 0020+00 1/0 0/0 0/0 .text daTagStatue_Delete__FP13daTagStatue_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daTagStatue_Delete(daTagStatue_c* param_0) { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/daTagStatue_Delete__FP13daTagStatue_c.s" +static int daTagStatue_Delete(daTagStatue_c* i_this) { + return i_this->_delete(); } -#pragma pop /* 805A80C0-805A80E0 0011E0 0020+00 1/0 0/0 0/0 .text daTagStatue_Create__FP13daTagStatue_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daTagStatue_Create(daTagStatue_c* param_0) { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/daTagStatue_Create__FP13daTagStatue_c.s" +static int daTagStatue_Create(daTagStatue_c* i_this) { + return i_this->create(); } -#pragma pop - -/* 805A80E0-805A80FC 001200 001C+00 1/1 0/0 0/0 .text cLib_calcTimer__FPUc */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -extern "C" asm void func_805A80E0(void* _this, u8* param_0) { - nofralloc -#include "asm/rel/d/a/tag/d_a_tag_statue_evt/d_a_tag_statue_evt/func_805A80E0.s" -} -#pragma pop -/* 805A8154-805A8154 000050 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ +/* 805A8330-805A8350 -00001 0020+00 1/0 0/0 0/0 .data l_daTagStatue_Method */ +static actor_method_class l_daTagStatue_Method = { +reinterpret_cast(daTagStatue_Create), +reinterpret_cast(daTagStatue_Delete), +reinterpret_cast(daTagStatue_Execute), +NULL, +reinterpret_cast(daTagStatue_Draw), +}; + +/* 805A8350-805A8380 -00001 0030+00 0/0 0/0 1/0 .data g_profile_Tag_Statue */ +extern actor_process_profile_definition g_profile_Tag_Statue = { + fpcLy_CURRENT_e, + 7, + fpcPi_CURRENT_e, + PROC_Tag_Statue, + &g_fpcLf_Method.mBase, + sizeof(daTagStatue_c), + 0, + 0, + &g_fopAc_Method.base, + 588, + &l_daTagStatue_Method, + 0x40100, + fopAc_ACTOR_e, + fopAc_CULLBOX_CUSTOM_e +}; \ No newline at end of file diff --git a/rel/d/a/tag/d_a_tag_statue_evt/unknown_translation_unit_bss.cpp b/rel/d/a/tag/d_a_tag_statue_evt/unknown_translation_unit_bss.cpp deleted file mode 100644 index e602dc803ef..00000000000 --- a/rel/d/a/tag/d_a_tag_statue_evt/unknown_translation_unit_bss.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// -// Generated By: dol2asm -// Translation Unit: unknown_translation_unit_bss -// - -#include "rel/d/a/tag/d_a_tag_statue_evt/unknown_translation_unit_bss.h" -#include "dolphin/types.h" - -// -// Forward References: -// - -extern "C" extern u8 data_805A8390[4]; - -// -// External References: -// - -// -// Declarations: -// - -/* ############################################################################################## */ -/* 805A8390-805A8394 000000 0004+00 0/0 1/1 0/0 .bss None */ -extern u8 data_805A8390[4]; -u8 data_805A8390[4];