diff --git a/include/JSystem/J3DGraphBase/J3DPacket.h b/include/JSystem/J3DGraphBase/J3DPacket.h index 8423b29f4..20d828948 100644 --- a/include/JSystem/J3DGraphBase/J3DPacket.h +++ b/include/JSystem/J3DGraphBase/J3DPacket.h @@ -109,6 +109,7 @@ public: } void setUserArea(u32 area) { mpUserData = (void*)area; } + u32 getUserArea() const { return (u32)mpUserData; } virtual bool isSame(J3DMatPacket*) const; virtual int entry(J3DDrawBuffer*); diff --git a/include/SSystem/SComponent/c_bg_s_lin_chk.h b/include/SSystem/SComponent/c_bg_s_lin_chk.h index a71dd3357..8efa83a5c 100644 --- a/include/SSystem/SComponent/c_bg_s_lin_chk.h +++ b/include/SSystem/SComponent/c_bg_s_lin_chk.h @@ -26,9 +26,10 @@ public: virtual ~cBgS_LinChk() {} - void ClrHit() { field_0x4c &= ~16; } - void SetHit() { field_0x4c |= 16; } - u32 ChkHit() const { return field_0x4c & 16; } + void ClrHit() { field_0x4c &= ~0x10; } + void SetHit() { field_0x4c |= 0x10; } + u32 ChkHit() const { return field_0x4c & 0x10; } + void ClrSttsRoofOff() { field_0x4c &= ~0x20000000; } void SetCross(const cXyz& pos) { mLin.SetEnd(pos); } cXyz& i_GetCross() { return mLin.GetEnd(); } cM3dGLin* GetLinP() { return &mLin; } diff --git a/include/SSystem/SComponent/c_cc_d.h b/include/SSystem/SComponent/c_cc_d.h index 2a5214568..13caa88eb 100644 --- a/include/SSystem/SComponent/c_cc_d.h +++ b/include/SSystem/SComponent/c_cc_d.h @@ -34,7 +34,7 @@ enum cCcD_ObjAtType { /* 0x00001000 */ AT_TYPE_UNK1000 = (1 << 12), /* 0x00002000 */ AT_TYPE_UNK2000 = (1 << 13), /* 0x00004000 */ AT_TYPE_NORMAL_ARROW = (1 << 14), - /* 0x00008000 */ AT_TYPE_UNK8000 = (1 << 15), + /* 0x00008000 */ AT_TYPE_HOOKSHOT = (1 << 15), /* 0x00010000 */ AT_TYPE_SKULL_HAMMER = (1 << 16), /* 0x00020000 */ AT_TYPE_UNK20000 = (1 << 17), /* 0x00040000 */ AT_TYPE_FIRE_ARROW = (1 << 18), diff --git a/include/SSystem/SComponent/c_counter.h b/include/SSystem/SComponent/c_counter.h index 19cd6bd3a..975824eb9 100644 --- a/include/SSystem/SComponent/c_counter.h +++ b/include/SSystem/SComponent/c_counter.h @@ -6,7 +6,7 @@ struct counter_class { u32 mCounter0; s32 mCounter1; - s32 mTimer; + u32 mTimer; }; extern counter_class g_Counter; diff --git a/include/d/actor/d_a_hookshot.h b/include/d/actor/d_a_hookshot.h new file mode 100644 index 000000000..0f01e0ad2 --- /dev/null +++ b/include/d/actor/d_a_hookshot.h @@ -0,0 +1,67 @@ +#ifndef D_A_HOOKSHOT_H +#define D_A_HOOKSHOT_H + +#include "f_op/f_op_actor_mng.h" +#include "JSystem/J3DGraphBase/J3DPacket.h" +#include "d/d_cc_d.h" +#include "d/d_bg_s_lin_chk.h" +#include "d/d_bg_s_gnd_chk.h" + +class daHookshot_shape : public J3DPacket { +public: + void draw(); + daHookshot_shape() {} + ~daHookshot_shape() {} +}; + +class daHookshot_c : public fopAc_ac_c { +public: + typedef BOOL (daHookshot_c::*ProcFunc)(); + + int getChainCnt() { return mChainCnt; } + void onObjHookFlg() {} + void offObjHookFlg() {} + void setObjSightCrossPos(const cXyz*) {} + void getObjSightCrossPos() {} + + daHookshot_c() {} + BOOL draw(); + BOOL procWait_init(int); + BOOL procWait(); + BOOL procShot(); + BOOL procPlayerPull(); + BOOL procReturn(); + BOOL execute(); + BOOL hookshot_delete(); + s32 create(); + +public: + /* 0x290 */ daHookshot_shape mShape; + /* 0x2A0 */ bool m2A0; + /* 0x2A1 */ u8 m2A1; + /* 0x2A2 */ u8 m2A2; + /* 0x2A3 */ u8 m2A3; + /* 0x2A4 */ s16 m2A4; + /* 0x2A6 */ u16 m2A6; + /* 0x2A8 */ int mChainCnt; + /* 0x2AC */ u32 mMtrlSndId; + /* 0x2B0 */ int m2B0; + /* 0x2B4 */ s16 m2B4; + /* 0x2B6 */ s16 m2B6; + /* 0x2B8 */ s16 m2B8; + /* 0x2BA */ csXyz m2BA; + /* 0x2C0 */ cXyz m2C0; + /* 0x2CC */ cXyz m2CC; + /* 0x2D8 */ dBgS_RopeLinChk mLinChk; + /* 0x344 */ dBgS_ObjGndChk mGndChk; + /* 0x398 */ dCcD_Stts mStts; + /* 0x3D4 */ dCcD_Cps mCps; + /* 0x50C */ cXyz m50C; + /* 0x518 */ u32 m518; + /* 0x51C */ Mtx m51C; + /* 0x54C */ ProcFunc mCurrProcFunc; +}; + +// dBgS_RopeLinChk + +#endif /* D_A_HOOKSHOT_H */ diff --git a/include/d/actor/d_a_player_main.h b/include/d/actor/d_a_player_main.h index ba4e8cdc8..b5a028fbc 100644 --- a/include/d/actor/d_a_player_main.h +++ b/include/d/actor/d_a_player_main.h @@ -1222,7 +1222,7 @@ public: void getBoomerangCatchPos() const; void getLineTopPos(); - void getHookshotRootPos() const; + cXyz getHookshotRootPos() const { return mHookshotRootPos; } void seStartOnlyReverb(u32); void seStartMapInfo(u32); void seStartSwordCut(u32); @@ -2087,7 +2087,7 @@ public: virtual void voiceStart(u32); virtual void setOutPower(f32, s16, int); virtual void onFrollCrashFlg(u32); - virtual MtxP getModelJointMtx(u16); + virtual MtxP getModelJointMtx(u16 idx) { return mpCLModel->getAnmMtx(idx); } virtual f32 getOldSpeedY(); virtual BOOL setHookshotCarryOffset(unsigned int, const cXyz*); virtual void setPlayerPosAndAngle(cXyz*, s16); @@ -2404,7 +2404,7 @@ public: /* 0x36C4 */ cXyz m36C4; /* 0x36D0 */ cXyz m36D0; /* 0x36DC */ cXyz m36DC; - /* 0x36E8 */ cXyz m36E8; + /* 0x36E8 */ cXyz mHookshotRootPos; /* 0x36F4 */ u8 m36F4[0x3700 - 0x36F4]; /* 0x3700 */ cXyz m3700; /* 0x370C */ cXyz m370C; diff --git a/include/d/d_bg_s_lin_chk.h b/include/d/d_bg_s_lin_chk.h index 740087eba..cf5d49458 100644 --- a/include/d/d_bg_s_lin_chk.h +++ b/include/d/d_bg_s_lin_chk.h @@ -31,7 +31,7 @@ class dBgS_RopeLinChk : public dBgS_LinChk { public: dBgS_RopeLinChk() { SetRope(); } - virtual ~dBgS_RopeLinChk(); + virtual ~dBgS_RopeLinChk() {} }; class dBgS_BoomerangLinChk : public dBgS_LinChk { diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 2c650ac10..ab145354d 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -2122,10 +2122,18 @@ inline s32 dComIfGd_getLightModelNum() { return g_dComIfG_gameInfo.drawlist.getLightModelNum(); } +inline J3DDrawBuffer* dComIfGd_getOpaListP1() { + return g_dComIfG_gameInfo.drawlist.getOpaListP1(); +} + inline J3DDrawBuffer* dComIfGd_getListFilter() { return g_dComIfG_gameInfo.drawlist.getOpaListFilter(); } +inline J3DDrawBuffer* dComIfGd_getList2D() { + return g_dComIfG_gameInfo.drawlist.getOpaList2D(); +} + inline void dComIfGd_setList() { g_dComIfG_gameInfo.drawlist.setOpaList(); g_dComIfG_gameInfo.drawlist.setXluList(); diff --git a/include/d/d_drawlist.h b/include/d/d_drawlist.h index 8c46b5b4a..47f18f704 100644 --- a/include/d/d_drawlist.h +++ b/include/d/d_drawlist.h @@ -343,7 +343,9 @@ public: static void wipeIn(f32); void calcWipe(); + J3DDrawBuffer* getOpaListP1() { return mpOpaListP1; } J3DDrawBuffer* getOpaListFilter() { return mpOpaListFilter; } + J3DDrawBuffer* getOpaList2D() { return mpOpaList2D; } void setXluDrawList(J3DDrawBuffer* buffer) { j3dSys.setDrawBuffer(buffer, XLU_BUFFER); } void setOpaDrawList(J3DDrawBuffer* buffer) { j3dSys.setDrawBuffer(buffer, OPA_BUFFER); } diff --git a/include/d/d_kankyo.h b/include/d/d_kankyo.h index 1f89a06bb..6efac2488 100644 --- a/include/d/d_kankyo.h +++ b/include/d/d_kankyo.h @@ -418,6 +418,7 @@ void dKy_Itemgetcol_chg_move(); void dKy_arrowcol_chg_on(cXyz*, int); void dKy_arrowcol_chg_move(); void dKy_setLight_init(); +void dKy_GxFog_set(); void GxXFog_set(); void dKy_set_actcol_ratio(f32 ratio); void dKy_set_bgcol_ratio(f32 ratio); diff --git a/include/f_op/f_op_actor.h b/include/f_op/f_op_actor.h index 5e217681b..e2c01ad5f 100644 --- a/include/f_op/f_op_actor.h +++ b/include/f_op/f_op_actor.h @@ -31,6 +31,7 @@ enum fopAc_Status_e { fopAcStts_UNK2000000_e = 0x02000000, fopAcStts_BOSS_e = 0x04000000, fopAcStts_UNK8000000_e = 0x08000000, + fopAcStts_UNK10000000_e = 0x10000000, }; enum fopAc_Condition_e { diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index 6f8f64616..fe27b4709 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -95,15 +95,6 @@ inline u32 fopAcM_checkCarryNow(fopAc_ac_c* pActor) { return pActor->mStatus & fopAcStts_CARRY_e; } -enum fopAcM_CARRY { - /* 0x01 */ fopAcM_CARRY_TYPE_1 = 1, - /* 0x02 */ fopAcM_CARRY_HEAVY = 2, - /* 0x04 */ fopAcM_CARRY_SIDE = 4, - /* 0x08 */ fopAcM_CARRY_TYPE_8 = 8, - /* 0x10 */ fopAcM_CARRY_LIGHT = 16, // guess based on context - /* 0x30 */ fopAcM_CARRY_UNK_30 = 0x30, -}; - inline u32 fopAcM_checkHookCarryNow(fopAc_ac_c* pActor) { return fopAcM_checkStatus(pActor, fopAcStts_HOOK_CARRY_e); } diff --git a/src/SSystem/SComponent/c_bg_s_lin_chk.cpp b/src/SSystem/SComponent/c_bg_s_lin_chk.cpp index cdd092f08..02e8d6825 100644 --- a/src/SSystem/SComponent/c_bg_s_lin_chk.cpp +++ b/src/SSystem/SComponent/c_bg_s_lin_chk.cpp @@ -24,6 +24,6 @@ void cBgS_LinChk::Set2(cXyz* pStart, cXyz* pEnd, unsigned int actorPid) { mLin.mEnd.set(*pEnd); field_0x40 = *pEnd; SetActorPid(actorPid); - field_0x4c &= ~0x10; + ClrHit(); ClearPi(); } diff --git a/src/d/actor/d_a_agb.cpp b/src/d/actor/d_a_agb.cpp index 0665f212d..fa4ebb4ae 100644 --- a/src/d/actor/d_a_agb.cpp +++ b/src/d/actor/d_a_agb.cpp @@ -1088,11 +1088,6 @@ int daAgb_Draw(daAgb_c* i_this) { return 1; } -/* 800D38EC-800D38F0 .text setTevColor__11J3DTevBlockFUlPC13J3DGXColorS10 */ -void J3DTevBlock::setTevColor(u32, const J3DGXColorS10*) { - /* Nonmatching */ -} - /* 800D38F0-800D38F8 .text daAgb_IsDelete__FP7daAgb_c */ int daAgb_IsDelete(daAgb_c* i_this) { return 1; diff --git a/src/d/actor/d_a_hookshot.cpp b/src/d/actor/d_a_hookshot.cpp index 2fa00613e..8fe9e8e9b 100644 --- a/src/d/actor/d_a_hookshot.cpp +++ b/src/d/actor/d_a_hookshot.cpp @@ -3,126 +3,351 @@ // Translation Unit: d_a_hookshot.cpp // -#include "d_a_hookshot.h" -#include "dolphin/types.h" +#include "d/actor/d_a_hookshot.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "d/d_com_inf_game.h" +#include "m_Do/m_Do_mtx.h" +#include "SSystem/SComponent/c_counter.h" +#include "d/actor/d_a_player_main.h" +#include "d/d_procname.h" + +// Needed for the .data section to match. +static Vec dummy_2100 = {1.0f, 1.0f, 1.0f}; +static Vec dummy_2080 = {1.0f, 1.0f, 1.0f}; + +static u8 l_chainS3TCTEX[] __attribute__((aligned(32))) = { + 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xDE, 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xDE, 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xDE, 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xDE, 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xDE, 0xDB, 0xB5, 0xB6, 0x00, 0x55, 0x55, 0x55, 0xDE, 0xDB, 0xB5, 0xB6, 0x00, 0x55, 0x55, 0x55, + 0xB5, 0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB5, 0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xDE, 0xDB, 0xB5, 0xB6, 0x00, 0x55, 0x55, 0x55, 0xDE, 0xDB, 0xB5, 0xB6, 0x00, 0x55, 0x55, 0x55, + 0xB5, 0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB5, 0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xDE, 0xDB, 0xB5, 0xB6, 0x00, 0x55, 0x55, 0x55, 0xDE, 0xDB, 0xB5, 0xB6, 0x00, 0x55, 0x55, 0x55, + 0xB5, 0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB5, 0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xDE, 0xDB, 0xB5, 0xB6, 0x00, 0x55, 0x55, 0x55, 0xDE, 0xDB, 0xB5, 0xB6, 0x00, 0x55, 0x55, 0x55, + 0xB5, 0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB5, 0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xB5, 0xB6, 0x94, 0x92, 0x00, 0x55, 0x55, 0x55, 0xB5, 0xB6, 0x94, 0x92, 0x00, 0x55, 0x55, 0x55, + 0x8C, 0x31, 0x6B, 0x2D, 0x00, 0x55, 0x55, 0x55, 0x8C, 0x31, 0x6B, 0x2D, 0x00, 0x55, 0x55, 0x55, + 0xB5, 0xB6, 0x94, 0x92, 0x00, 0x55, 0x55, 0x55, 0xB5, 0xB6, 0x94, 0x92, 0x00, 0x55, 0x55, 0x55, + 0x8C, 0x31, 0x6B, 0x2D, 0x00, 0x55, 0x55, 0x55, 0x8C, 0x31, 0x6B, 0x2D, 0x00, 0x55, 0x55, 0x55, + 0xB5, 0xB6, 0x94, 0x92, 0x00, 0x55, 0x55, 0x55, 0xB5, 0xB6, 0x94, 0x92, 0x00, 0x55, 0x55, 0x55, + 0x8C, 0x31, 0x6B, 0x2D, 0x00, 0x55, 0x55, 0x55, 0x8C, 0x31, 0x6B, 0x2D, 0x00, 0x55, 0x55, 0x55, + 0xB5, 0xB6, 0x94, 0x92, 0x00, 0x55, 0x55, 0x55, 0xB5, 0xB6, 0x94, 0x92, 0x00, 0x55, 0x55, 0x55, + 0x8C, 0x31, 0x6B, 0x2D, 0x00, 0x55, 0x55, 0x55, 0x8C, 0x31, 0x6B, 0x2D, 0x00, 0x55, 0x55, 0x55, + 0x94, 0x92, 0x6B, 0x2D, 0x55, 0x55, 0xAA, 0x00, 0x94, 0x92, 0x6B, 0x2D, 0x55, 0x55, 0xAA, 0x00, + 0xB5, 0xB6, 0x94, 0x92, 0x55, 0x55, 0x00, 0x00, 0xB5, 0xB6, 0x94, 0x92, 0x55, 0x55, 0x00, 0x00, + 0x94, 0x92, 0x6B, 0x2D, 0x55, 0x55, 0xAA, 0x00, 0x94, 0x92, 0x6B, 0x2D, 0x55, 0x55, 0xAA, 0x00, + 0xB5, 0xB6, 0x94, 0x92, 0x55, 0x55, 0x00, 0x00, 0xB5, 0xB6, 0x94, 0x92, 0x55, 0x55, 0x00, 0x00, + 0x94, 0x92, 0x6B, 0x2D, 0x55, 0x55, 0xAA, 0x00, 0x94, 0x92, 0x6B, 0x2D, 0x55, 0x55, 0xAA, 0x00, + 0xB5, 0xB6, 0x94, 0x92, 0x55, 0x55, 0x00, 0x00, 0xB5, 0xB6, 0x94, 0x92, 0x55, 0x55, 0x00, 0x00, + 0x94, 0x92, 0x6B, 0x2D, 0x55, 0x55, 0xAA, 0x00, 0x94, 0x92, 0x6B, 0x2D, 0x55, 0x55, 0xAA, 0x00, + 0xB5, 0xB6, 0x94, 0x92, 0x55, 0x55, 0x00, 0x00, 0xB5, 0xB6, 0x94, 0x92, 0x55, 0x55, 0x00, 0x00, +}; +const u16 l_chainS3TCTEX__width = 32; +const u16 l_chainS3TCTEX__height = 32; + +static Vec l_pos[0xC] = { + {-2.0f, 1.522254f, -0.0f}, + {-2.0f, 1.522254f, 7.0f}, + {2.0f, 1.522254f, -0.0f}, + {-3.5f, 0.0f, -1.5f}, + {-3.5f, 0.0f, 8.5f}, + {3.5f, 0.0f, -1.5f}, + {-2.0f, -1.522254f, -0.0f}, + {-2.0f, -1.522254f, 7.0f}, + {2.0f, -1.522254f, -0.0f}, + {2.0f, 1.522254f, 7.0f}, + {3.5f, 0.0f, 8.5f}, + {2.0f, -1.522254f, 7.0f}, +}; + +static cXy l_texCoord[0xC] = { + {0.02736, 0.041406}, + {0.97264, 0.041406}, + {0.830848, 0.40324}, + {0.169152, 0.40324}, + {0.03125, 0.0}, + {0.96875, 0.0}, + {0.767857, 0.494086}, + {0.232143, 0.494086}, + {0.038462, 0.48226}, + {0.038462, 0.983522}, + {0.961538, 0.48226}, + {0.961538, 0.983522}, +}; + +static u8 l_chainDL[] __attribute__((aligned(32))) = { + 0x98, 0x00, 0x06, 0x01, 0x0A, 0x07, 0x0B, 0x09, 0x08, 0x0B, 0x09, 0x02, 0x08, 0x08, 0x09, + 0x98, 0x00, 0x06, 0x0B, 0x07, 0x07, 0x06, 0x0A, 0x04, 0x04, 0x05, 0x09, 0x07, 0x01, 0x06, + 0x98, 0x00, 0x06, 0x08, 0x03, 0x0B, 0x02, 0x05, 0x00, 0x0A, 0x01, 0x02, 0x03, 0x09, 0x02, + 0x98, 0x00, 0x06, 0x02, 0x0A, 0x08, 0x0B, 0x00, 0x08, 0x06, 0x09, 0x01, 0x08, 0x07, 0x09, + 0x98, 0x00, 0x06, 0x06, 0x07, 0x08, 0x06, 0x03, 0x04, 0x05, 0x05, 0x00, 0x07, 0x02, 0x06, + 0x98, 0x00, 0x06, 0x07, 0x03, 0x06, 0x02, 0x04, 0x00, 0x03, 0x01, 0x01, 0x03, 0x00, 0x02, + + 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, +}; + +static u8 l_matDL[] __attribute__((aligned(32))) = { + 0x61, 0x80, 0x00, 0x01, 0x3A, + 0x61, 0x84, 0x00, 0x00, 0x00, + 0x61, 0x88, 0xE0, 0x7C, 0x1F, + // TX_SETIMAGE3_I0 BP command. Statically insert the pointer to the chain texture into the display list array by extracting each byte. + 0x61, 0x94, ((u32)&l_chainS3TCTEX >> 0x05 >> 0x10), ((u32)&l_chainS3TCTEX >> 0x05 >> 0x08), ((u32)&l_chainS3TCTEX >> 0x05 >> 0x00), + 0x61, 0x30, 0x00, (l_chainS3TCTEX__width >> 0x08), (l_chainS3TCTEX__width >> 0x00), + 0x61, 0x31, 0x00, (l_chainS3TCTEX__height >> 0x08), (l_chainS3TCTEX__height >> 0x00), + 0x10, 0x00, 0x00, 0x10, 0x40, 0xFF, 0xFF, 0x42, 0x80, 0x08, 0x30, 0x3C, 0xF3, 0xCF, 0x00, + 0x10, 0x00, 0x00, 0x10, 0x18, 0x3C, 0xF3, 0xCF, 0x00, + 0x10, 0x00, 0x00, 0x10, 0x0E, 0x00, 0x00, 0x05, 0x43, 0x61, 0x28, 0x3C, 0x00, 0x00, + 0x61, 0xC0, 0x08, 0x24, 0xAF, + 0x61, 0xC1, 0x08, 0xFF, 0xF0, + 0x61, 0x28, 0x3C, 0x00, 0x00, + 0x61, 0xC2, 0x08, 0xF0, 0x8F, + 0x61, 0xC3, 0x08, 0xFF, 0xC0, + 0x61, 0x43, 0x00, 0x00, 0x01, + 0x61, 0x40, 0x00, 0x00, 0x17, + 0x61, 0x41, 0x00, 0x01, 0x0C, + 0x61, 0xF3, 0x64, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x10, 0x3F, 0x00, 0x00, 0x00, 0x01, + 0x10, 0x00, 0x00, 0x10, 0x09, 0x00, 0x00, 0x00, 0x01, + 0x61, 0x00, 0x00, 0x04, 0x11, + + 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, +}; /* 800F104C-800F12C8 .text draw__16daHookshot_shapeFv */ void daHookshot_shape::draw() { - /* Nonmatching */ + daHookshot_c* hookshot = reinterpret_cast(mpUserData); + int chain_count = hookshot->getChainCnt(); + if (chain_count < 1) { + return; + } + + j3dSys.reinitGX(); + GXSetNumIndStages(0); + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_INDEX8); + GXSetVtxDesc(GX_VA_TEX0, GX_INDEX8); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_F32, 0); + GXSetArray(GX_VA_POS, &l_pos, sizeof(l_pos[0])); + GXSetArray(GX_VA_TEX0, &l_texCoord, sizeof(l_texCoord[0])); + dKy_GxFog_set(); + // Not sure why the size passed here is smaller than l_matDL's size in the symbol maps. + GXCallDisplayList(&l_matDL, sizeof(l_matDL) - 0x08); + GXSetTevColorS10(GX_TEVREG0, hookshot->mTevStr.mColorC0); + GXSetTevColor(GX_TEVREG1, hookshot->mTevStr.mColorK0); + GXSetCurrentMtx(0); + + cXyz chain_pos = daPy_getPlayerLinkActorClass()->getHookshotRootPos(); + cXyz chain_offset( + 7.0f * cM_scos(hookshot->shape_angle.x) * cM_ssin(hookshot->shape_angle.y), + -7.0f * cM_ssin(hookshot->shape_angle.x), + 7.0f * cM_scos(hookshot->shape_angle.x) * cM_scos(hookshot->shape_angle.y) + ); + s16 z = (g_Counter.mTimer << 0x0C) + ((g_Counter.mTimer >> 0x04) & 0xFFF); + for (int i = 0; i <= chain_count; i++) { + // Draw each individual link of the Hookshot's chain. + mDoMtx_stack_c::transS(chain_pos); + mDoMtx_stack_c::ZXYrotM(hookshot->shape_angle.x, hookshot->shape_angle.y, z); + z += (((((g_Counter.mTimer + i) << 0x0C) + (g_Counter.mTimer >> ((i&0xF)+1) & 0xFFF))) & 0x1FFF) + 0x3000; + mDoMtx_stack_c::revConcat(j3dSys.getViewMtx()); + GXLoadPosMtxImm(mDoMtx_stack_c::get(), 0); + // Not sure why the size passed here is smaller than l_chainDL's size in the symbol maps. + GXCallDisplayList(&l_chainDL, sizeof(l_chainDL) - 0x1A); + chain_pos += chain_offset; + } + + J3DShape::sOldVcdVatCmd = NULL; } /* 800F12C8-800F1324 .text draw__12daHookshot_cFv */ -void daHookshot_c::draw() { - /* Nonmatching */ +BOOL daHookshot_c::draw() { + g_env_light.settingTevStruct(TEV_TYPE_ACTOR, ¤t.pos, &mTevStr); + dComIfGd_getOpaListP1()->entryImm(&mShape, 0); + return TRUE; } /* 800F1324-800F1344 .text daHookshot_Draw__FP12daHookshot_c */ -void daHookshot_Draw(daHookshot_c*) { - /* Nonmatching */ +BOOL daHookshot_Draw(daHookshot_c* i_this) { + return i_this->draw(); } /* 800F1344-800F13E8 .text daHookshot_rockLineCallback__FP10fopAc_ac_cP12dCcD_GObjInfP10fopAc_ac_cP12dCcD_GObjInf */ -void daHookshot_rockLineCallback(fopAc_ac_c*, dCcD_GObjInf*, fopAc_ac_c*, dCcD_GObjInf*) { - /* Nonmatching */ +void daHookshot_rockLineCallback(fopAc_ac_c* hookshot_actor, dCcD_GObjInf* objInf, fopAc_ac_c* collided_actor, dCcD_GObjInf*) { + daHookshot_c* i_this = (daHookshot_c*)hookshot_actor; + f32 f31 = objInf->GetAtHitPosP()->abs2(i_this->current.pos); + f32 f1 = i_this->m2CC.abs2(i_this->current.pos); + if (f1 > f31) { + i_this->m2CC = *objInf->GetAtHitPosP(); + if (fopAcM_checkStatus(collided_actor, fopAcStts_UNK80000_e | fopAcStts_UNK200000_e | fopAcStts_UNK10000000_e)) { + i_this->m2B0 = 1; + } else { + i_this->m2B0 = 0; + } + } } /* 800F13E8-800F14CC .text procWait_init__12daHookshot_cFi */ -void daHookshot_c::procWait_init(int) { - /* Nonmatching */ +BOOL daHookshot_c::procWait_init(int param_1) { + daPy_lk_c* link = daPy_getPlayerLinkActorClass(); + fopAcM_SetParam(this, 0); + mCurrProcFunc = &procWait; + mChainCnt = 0; + current.pos = link->getHookshotRootPos(); + m518 = -1; + m2B0 = 0; + if (param_1 != 0) { + mDoAud_seStart(JA_SE_LK_HS_WIND_UP_FIN, &link->current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(this))); + } + return TRUE; } /* 800F14CC-800F1990 .text procWait__12daHookshot_cFv */ -void daHookshot_c::procWait() { +BOOL daHookshot_c::procWait() { /* Nonmatching */ + daPy_lk_c* link = daPy_getPlayerLinkActorClass(); + current.pos = link->getHookshotRootPos(); + MtxP leftHandtx = link->getModelJointMtx(0x08); // cl_LhandA joint + cMtx_copy(leftHandtx, m51C); } /* 800F1990-800F2144 .text procShot__12daHookshot_cFv */ -void daHookshot_c::procShot() { +BOOL daHookshot_c::procShot() { /* Nonmatching */ } /* 800F2144-800F247C .text procPlayerPull__12daHookshot_cFv */ -void daHookshot_c::procPlayerPull() { +BOOL daHookshot_c::procPlayerPull() { /* Nonmatching */ } /* 800F247C-800F26EC .text procReturn__12daHookshot_cFv */ -void daHookshot_c::procReturn() { +BOOL daHookshot_c::procReturn() { /* Nonmatching */ } /* 800F26EC-800F2B54 .text execute__12daHookshot_cFv */ -void daHookshot_c::execute() { +BOOL daHookshot_c::execute() { /* Nonmatching */ } /* 800F2B54-800F2B74 .text daHookshot_Execute__FP12daHookshot_c */ -void daHookshot_Execute(daHookshot_c*) { - /* Nonmatching */ +BOOL daHookshot_Execute(daHookshot_c* i_this) { + return i_this->execute(); } /* 800F2B74-800F2B7C .text daHookshot_IsDelete__FP12daHookshot_c */ -void daHookshot_IsDelete(daHookshot_c*) { - /* Nonmatching */ +BOOL daHookshot_IsDelete(daHookshot_c* i_this) { + return TRUE; } /* 800F2B7C-800F2BF0 .text hookshot_delete__12daHookshot_cFv */ -void daHookshot_c::hookshot_delete() { - /* Nonmatching */ +BOOL daHookshot_c::hookshot_delete() { + if (m518 != -1) { + fopAc_ac_c* hooked_actor = fopAcM_SearchByID(m518); + if (hooked_actor && fopAcM_checkStatus(hooked_actor, fopAcStts_HOOK_CARRY_e)) { + fopAcM_cancelHookCarryNow(hooked_actor); + m518 = -1; + } + } + return TRUE; } /* 800F2BF0-800F2C14 .text daHookshot_Delete__FP12daHookshot_c */ -void daHookshot_Delete(daHookshot_c*) { - /* Nonmatching */ +BOOL daHookshot_Delete(daHookshot_c* i_this) { + i_this->hookshot_delete(); + return TRUE; } +static dCcD_SrcCps l_at_cps_src = { + // dCcD_SrcGObjInf + { + /* Flags */ 0, + /* SrcObjAt Type */ AT_TYPE_HOOKSHOT, + /* SrcObjAt Atp */ 0x01, + /* SrcObjAt SPrm */ 0x0B, + /* SrcObjTg Type */ 0, + /* SrcObjTg SPrm */ 0, + /* SrcObjCo SPrm */ 0, + /* SrcGObjAt Se */ 0x08, + /* SrcGObjAt HitMark */ 0, + /* SrcGObjAt Spl */ 0, + /* SrcGObjAt Mtrl */ 0, + /* SrcGObjAt GFlag */ 0, + /* SrcGObjTg Se */ 0, + /* SrcGObjTg HitMark */ 0, + /* SrcGObjTg Spl */ 0, + /* SrcGObjTg Mtrl */ 0, + /* SrcGObjTg GFlag */ 0, + /* SrcGObjCo GFlag */ 0, + }, + // cM3dGCpsS + { + /* Start */ 0.0f, 0.0f, 0.0f, + /* End */ 0.0f, 0.0f, 0.0f, + /* Radius */ 5.0f, + }, +}; + /* 800F2C14-800F2CC8 .text create__12daHookshot_cFv */ -void daHookshot_c::create() { - /* Nonmatching */ -} - -/* 800F2CC8-800F2FE0 .text __ct__12daHookshot_cFv */ -daHookshot_c::daHookshot_c() { - /* Nonmatching */ -} - -/* 800F2FE0-800F3134 .text __dt__15dBgS_RopeLinChkFv */ -dBgS_RopeLinChk::~dBgS_RopeLinChk() { - /* Nonmatching */ +s32 daHookshot_c::create() { + fopAcM_SetupActor(this, daHookshot_c); + + mShape.setUserArea(reinterpret_cast(this)); + mLinChk.ClrSttsRoofOff(); + procWait_init(0); + mGravity = -5.0f; + + mStts.Init(0xA, 0xFF, this); + mCps.Set(l_at_cps_src); + mCps.SetStts(&mStts); + + int roomNo = dComIfGp_roomControl_getStayNo(); + mTevStr.mRoomNo = roomNo; + mStts.SetRoomId(roomNo); + current.roomNo = roomNo; + + return cPhs_COMPLEATE_e; } /* 800F3134-800F3154 .text daHookshot_Create__FP10fopAc_ac_c */ -void daHookshot_Create(fopAc_ac_c*) { - /* Nonmatching */ +s32 daHookshot_Create(fopAc_ac_c* i_actor) { + return reinterpret_cast(i_actor)->create(); } -/* 800F3180-800F3188 .text @20@__dt__15dBgS_RopeLinChkFv */ -void @20@__dt__15dBgS_RopeLinChkFv { - /* Nonmatching */ -} - -/* 800F3188-800F3190 .text @100@__dt__15dBgS_RopeLinChkFv */ -void @100@__dt__15dBgS_RopeLinChkFv { - /* Nonmatching */ -} - -/* 800F3190-800F3198 .text @88@__dt__15dBgS_RopeLinChkFv */ -void @88@__dt__15dBgS_RopeLinChkFv { - /* Nonmatching */ -} - -/* 800F3198-800F31B4 .text getHookshotRootPos__9daPy_lk_cCFv */ -void daPy_lk_c::getHookshotRootPos() const { - /* Nonmatching */ -} - -/* 800F31B4-800F31CC .text getModelJointMtx__9daPy_lk_cFUs */ -void daPy_lk_c::getModelJointMtx(unsigned short) { - /* Nonmatching */ -} - -/* 800F31CC-800F3228 .text __dt__16daHookshot_shapeFv */ -daHookshot_shape::~daHookshot_shape() { - /* Nonmatching */ -} +actor_method_class l_daHookshot_Method = { + (process_method_func)daHookshot_Create, + (process_method_func)daHookshot_Delete, + (process_method_func)daHookshot_Execute, + (process_method_func)daHookshot_IsDelete, + (process_method_func)daHookshot_Draw, +}; +actor_process_profile_definition g_profile_HOOKSHOT = { + /* LayerID */ fpcLy_CURRENT_e, + /* ListID */ 6, + /* ListPrio */ fpcLy_CURRENT_e, + /* ProcName */ PROC_HOOKSHOT, + /* Proc SubMtd */ &g_fpcLf_Method.mBase, + /* Size */ sizeof(daHookshot_c), + /* SizeOther */ 0, + /* Parameters */ 0, + /* Leaf SubMtd */ &g_fopAc_Method.base, + /* Priority */ 0x019E, + /* Actor SubMtd */ &l_daHookshot_Method, + /* Status */ fopAcStts_UNK4000_e | fopAcStts_UNK40000_e, + /* Group */ fopAc_ACTOR_e, + /* CullType */ fopAc_CULLBOX_CUSTOM_e, +}; diff --git a/src/d/actor/d_a_ib.cpp b/src/d/actor/d_a_ib.cpp index 9abbd2434..6e1ac1c66 100644 --- a/src/d/actor/d_a_ib.cpp +++ b/src/d/actor/d_a_ib.cpp @@ -313,7 +313,7 @@ void daIball_c::damage() { if (atType & AT_TYPE_SWORD || atType & AT_TYPE_BOKO_STICK || atType & AT_TYPE_MACHETE || atType & AT_TYPE_SKULL_HAMMER || atType & AT_TYPE_UNK2000000 || atType & AT_TYPE_STALFOS_MACE || - atType & AT_TYPE_DARKNUT_SWORD || atType & AT_TYPE_UNK8000 || + atType & AT_TYPE_DARKNUT_SWORD || atType & AT_TYPE_HOOKSHOT || atType & AT_TYPE_BOOMERANG || atType & AT_TYPE_NORMAL_ARROW || atType & AT_TYPE_FIRE_ARROW || atType & AT_TYPE_ICE_ARROW || atType & AT_TYPE_LIGHT_ARROW || atType & AT_TYPE_MOBLIN_SPEAR)