From ca1ece683b3eae1a9dcf4fe9ba971d2eb82b64ae Mon Sep 17 00:00:00 2001 From: TakaRikka <38417346+TakaRikka@users.noreply.github.com> Date: Fri, 12 Jul 2024 23:24:50 -0700 Subject: Lv5key / Iceblock done (#2177) * obj_lv5key * obj_iceblock done * remove asm --- include/SSystem/SComponent/c_bg_s_chk.h | 7 +- include/SSystem/SComponent/c_lib.h | 6 +- include/d/a/d_a_alink.h | 4 +- include/d/bg/d_bg_s.h | 2 +- include/d/bg/d_bg_w_base.h | 10 ++- .../rel/d/a/obj/d_a_obj_Lv5Key/d_a_obj_Lv5Key.h | 77 +++++++++++++----- .../d/a/obj/d_a_obj_iceblock/d_a_obj_iceblock.h | 92 ++++++++++++++++++---- 7 files changed, 153 insertions(+), 45 deletions(-) (limited to 'include') diff --git a/include/SSystem/SComponent/c_bg_s_chk.h b/include/SSystem/SComponent/c_bg_s_chk.h index d56dd19c67..98d22fe790 100644 --- a/include/SSystem/SComponent/c_bg_s_chk.h +++ b/include/SSystem/SComponent/c_bg_s_chk.h @@ -2,6 +2,7 @@ #define C_BG_S_CHK_H #include "dolphin/mtx/vec.h" +#include "f_pc/f_pc_base.h" struct cBgD_Vtx_t : public Vec {}; @@ -16,7 +17,7 @@ class cBgS_Chk { public: /* 0x0 */ cBgS_PolyPassChk* mPolyPassChk; /* 0x4 */ cBgS_GrpPassChk* mGrpPassChk; - /* 0x8 */ u32 mActorPid; + /* 0x8 */ fpc_ProcID mActorPid; /* 0xC */ u8 unk_0x0C; /* 0x10 */ // __vtable__ @@ -25,8 +26,8 @@ public: void SetExtChk(cBgS_Chk&); bool ChkSameActorPid(unsigned int) const; - void SetActorPid(u32 pid) { mActorPid = pid; } - u32 GetActorPid() const { return mActorPid; } + void SetActorPid(fpc_ProcID pid) { mActorPid = pid; } + fpc_ProcID GetActorPid() const { return mActorPid; } void SetPolyPassChk(cBgS_PolyPassChk* p_chk) { mPolyPassChk = p_chk; } void SetGrpPassChk(cBgS_GrpPassChk* p_chk) { mGrpPassChk = p_chk; } cBgS_PolyPassChk* GetPolyPassChk() const { return mPolyPassChk; } diff --git a/include/SSystem/SComponent/c_lib.h b/include/SSystem/SComponent/c_lib.h index ae65e692fe..3d15cd8280 100644 --- a/include/SSystem/SComponent/c_lib.h +++ b/include/SSystem/SComponent/c_lib.h @@ -37,16 +37,16 @@ s32 cLib_distanceAngleS(s16 x, s16 y); template inline void cLib_offBit(T& value, T bit) { - value &= ~bit; + value = (T)(value & ~bit); } template inline void cLib_onBit(T& value, T bit) { - value |= bit; + value = (T)(value | bit); } template -inline T cLib_checkBit(T& value, T bit) { +inline T cLib_checkBit(T value, T bit) { return (T)(value & bit); } diff --git a/include/d/a/d_a_alink.h b/include/d/a/d_a_alink.h index 5087638ad4..a409cb4df3 100644 --- a/include/d/a/d_a_alink.h +++ b/include/d/a/d_a_alink.h @@ -1994,7 +1994,7 @@ public: /* 800E7EE4 */ int getWallGrabStatus(); /* 800E7EF4 */ BOOL wallGrabTrigger(); /* 800E7F18 */ BOOL wallGrabButton(); - /* 800E7F3C */ void setPushPullKeepData(dBgW_Base::PushPullLabel, int); + /* 800E7F3C */ int setPushPullKeepData(dBgW_Base::PushPullLabel, int); /* 800E80A4 */ void checkPushPullTurnBlock(); /* 800E8148 */ void checkPullBehindWall(); /* 800E8298 */ void offGoatStopGame(); @@ -3288,6 +3288,8 @@ public: bool checkWolfDashMode() const { return checkNoResetFlg1(FLG1_DASH_MODE); } bool checkWolfLieWaterIn() const { return mWaterY > current.pos.y + 20.5f; } + BOOL checkPowerGloveGet() { return false; } + J3DModel* initModel(J3DModelData* p_modelData, u32 param_1) { return initModel(p_modelData, 0x80000, param_1); } diff --git a/include/d/bg/d_bg_s.h b/include/d/bg/d_bg_s.h index e20cc4ad60..510a452406 100644 --- a/include/d/bg/d_bg_s.h +++ b/include/d/bg/d_bg_s.h @@ -105,7 +105,7 @@ public: void MoveBgMatrixCrrPos(cBgS_PolyInfo const&, bool, cXyz*, csXyz*, csXyz*); void RideCallBack(cBgS_PolyInfo const&, fopAc_ac_c*); void ArrowStickCallBack(cBgS_PolyInfo const&, fopAc_ac_c*, cXyz&); - bool PushPullCallBack(cBgS_PolyInfo const&, fopAc_ac_c*, s16, dBgW_Base::PushPullLabel); + fopAc_ac_c* PushPullCallBack(cBgS_PolyInfo const&, fopAc_ac_c*, s16, dBgW_Base::PushPullLabel); bool WaterChk(dBgS_SplGrpChk* chk) { return SplGrpChk(chk); } u32 GetMtrlSndId(cBgS_PolyInfo* param_0) { return dKy_pol_sound_get(param_0); } diff --git a/include/d/bg/d_bg_w_base.h b/include/d/bg/d_bg_w_base.h index 12f5ddddc9..3d7174c8a1 100644 --- a/include/d/bg/d_bg_w_base.h +++ b/include/d/bg/d_bg_w_base.h @@ -18,14 +18,18 @@ class fopAc_ac_c; class dBgW_Base : public cBgW_BgId { public: enum PushPullLabel { - PUSHPULL_LABEL1 = 1, + PPLABEL_NONE = 0, + PPLABEL_PUSH = 1, + PPLABEL_PULL = 2, + PPLABEL_4 = 4, + PPLABEL_HEAVY = 8, }; enum PRIORITY { PRIORITY_0, }; - typedef bool (*PushPull_CallBack)(fopAc_ac_c*, fopAc_ac_c*, s16, + typedef fopAc_ac_c* (*PushPull_CallBack)(fopAc_ac_c*, fopAc_ac_c*, s16, dBgW_Base::PushPullLabel); /* 8007E5A8 */ dBgW_Base(); @@ -103,6 +107,8 @@ public: void SetPriority(PRIORITY priority) { m_priority = priority; } void onStickWall() { field_0xb |= 1; } void onStickRoof() { field_0xb |= 2; } + void OnPushPullOk() { m_pushPull_Ok = true; } + void OffPushPullOk() { m_pushPull_Ok = false; } private: /* 0x08 */ u8 m_priority; diff --git a/include/rel/d/a/obj/d_a_obj_Lv5Key/d_a_obj_Lv5Key.h b/include/rel/d/a/obj/d_a_obj_Lv5Key/d_a_obj_Lv5Key.h index 8e8d7ddccc..60c5210364 100644 --- a/include/rel/d/a/obj/d_a_obj_Lv5Key/d_a_obj_Lv5Key.h +++ b/include/rel/d/a/obj/d_a_obj_Lv5Key/d_a_obj_Lv5Key.h @@ -1,27 +1,35 @@ #ifndef D_A_OBJ_LV5KEY_H #define D_A_OBJ_LV5KEY_H +#include "d/bg/d_bg_s_acch.h" +#include "d/cc/d_cc_d.h" #include "f_op/f_op_actor_mng.h" - - - /** * @ingroup actors-objects * @class daObjLv5Key_c - * @brief Snowpeak Ruins Key + * @brief Snowpeak Ruins Key Lock * * @details * */ class daObjLv5Key_c : public fopAc_ac_c { public: - /* 80B9B9B8 */ void CreateHeap(); - /* 80B9BA94 */ void Init(); + typedef void (daObjLv5Key_c::*actionFunc)(int); + + enum daObjLv5Key_STATUS { + STATUS_WAIT, + STATUS_SHAKE_START, + STATUS_OPEN_START, + STATUS_OPEN, + }; + + /* 80B9B9B8 */ int CreateHeap(); + /* 80B9BA94 */ int Init(); /* 80B9BB5C */ void setBgc(); /* 80B9BBCC */ void initCcSph(); /* 80B9BC2C */ void setCcSph(); - /* 80B9BD30 */ void setAction(void (daObjLv5Key_c::*)(int), int); + /* 80B9BD30 */ void setAction(actionFunc, int); /* 80B9BDD8 */ void Action(); /* 80B9BE24 */ void Wait(int); /* 80B9BF08 */ void Open(int); @@ -29,24 +37,57 @@ public: /* 80B9C17C */ void Land(int); /* 80B9C268 */ void Shake(int); /* 80B9C3B0 */ void TranslateByNowDirect(f32, f32, f32); - /* 80B9C410 */ void Execute(); - /* 80B9C450 */ void Draw(); - /* 80B9C500 */ void Delete(); + /* 80B9C410 */ int Execute(); + /* 80B9C450 */ int Draw(); + /* 80B9C500 */ int Delete(); /* 80B9C534 */ void setBaseMtx(); - /* 80B9C5EC */ void create_1st(); + /* 80B9C5EC */ int create_1st(); - void setStatus(u8 status) { mStatus = status; } - void keylock_open_start() { setStatus(2); } - void keylock_shake_start() { setStatus(1); } - bool is_open() { return mStatus == 3; } + void setLocalOffset(f32 x, f32 y, f32 z) { mLocalOffset.set(x, y, z); } + void setRotateSpd(s16 x, s16 y, s16 z) { mRotateSpd.set(x, y, z); } + void setRotateAccel(s16 x, s16 y, s16 z) { mRotateAccel.set(x, y, z); } + void RotateAngle() { shape_angle += mRotateSpd; } + void calcRotateSpd() { mRotateSpd += mRotateAccel; } + + void setTimer(s16 timer) { mTimer = timer; } + void setShakeNum(s8 num) { mShakeNum = num; } + void decShakeNum() { mShakeNum--; } + + bool countdown() { return --mTimer <= 0; } + + void setStatus(s8 status) { mStatus = status; } + void keylock_open_start() { setStatus(STATUS_OPEN_START); } + void keylock_shake_start() { setStatus(STATUS_SHAKE_START); } + bool is_open() { return mStatus == STATUS_OPEN; } + bool is_open_start() { return mStatus == STATUS_OPEN_START; } + bool is_shake_start() { return mStatus == STATUS_SHAKE_START; } + bool is_shake_end() { return mShakeNum <= 0; } + + cXyz& getLocalOffset() { return mLocalOffset; } private: - /* 0x568 */ u8 field_0x568[0x945 - 0x568]; + /* 0x568 */ u8 field_0x568[0x56C - 0x568]; + /* 0x56C */ Z2SoundObjSimple mSound; + /* 0x58C */ u8 field_0x58C[0x590 - 0x58C]; + /* 0x590 */ J3DModel* mpModel; + /* 0x594 */ mDoExt_bckAnm mBck; + /* 0x5B0 */ request_of_phase_process_class mPhase; + /* 0x5B8 */ dBgS_AcchCir mAcchCir; + /* 0x5F8 */ dBgS_ObjAcch mAcch; + /* 0x7D0 */ dCcD_Stts mCcStts; + /* 0x80C */ dCcD_Sph mCcSph; + /* 0x944 */ u8 field_0x944; /* 0x945 */ s8 mStatus; - /* 0x946 */ u8 field_0x946[0x97c - 0x946]; + /* 0x948 */ actionFunc mAction; + /* 0x954 */ s16 mMode; + /* 0x956 */ s16 mTimer; + /* 0x958 */ cXyz mLocalOffset; + /* 0x964 */ csXyz mRotateSpd; + /* 0x96A */ csXyz mRotateAccel; + /* 0x970 */ s8 mShakeNum; + /* 0x971 */ u8 field_0x971[0x97c - 0x971]; }; STATIC_ASSERT(sizeof(daObjLv5Key_c) == 0x97c); - #endif /* D_A_OBJ_LV5KEY_H */ diff --git a/include/rel/d/a/obj/d_a_obj_iceblock/d_a_obj_iceblock.h b/include/rel/d/a/obj/d_a_obj_iceblock/d_a_obj_iceblock.h index 78ef4f779d..d73efc9e16 100644 --- a/include/rel/d/a/obj/d_a_obj_iceblock/d_a_obj_iceblock.h +++ b/include/rel/d/a/obj/d_a_obj_iceblock/d_a_obj_iceblock.h @@ -1,7 +1,12 @@ #ifndef D_A_OBJ_ICEBLOCK_H #define D_A_OBJ_ICEBLOCK_H +#include "d/bg/d_bg_s_acch.h" +#include "d/bg/d_bg_s_movebg_actor.h" +#include "d/cc/d_cc_d.h" #include "f_op/f_op_actor_mng.h" +#include "d/d_path.h" +#include "d/bg/d_bg_w.h" /** * @ingroup actors-objects @@ -11,21 +16,37 @@ * @details * */ -class daObjIceBlk_c : public fopAc_ac_c { +class daObjIceBlk_c : public dBgS_MoveBgActor { public: - /* 80C21CD8 */ void PPCallBack(fopAc_ac_c*, fopAc_ac_c*, s16, dBgW_Base::PushPullLabel); + enum State_e { + STATE_0_e = 0, + STATE_LAND_e = 1, + STATE_2_e = 2, + STATE_4_e = 4, + }; + + enum Mode_e { + MODE_PROC_WAIT_e, + MODE_PROC_WALK_e, + }; + + enum Action_e { + ACTION_WAIT_e, + ACTION_ORDER_EVENT_e, + ACTION_EVENT_e, + ACTION_DEAD_e, + }; + + /* 80C21CD8 */ static void PPCallBack(fopAc_ac_c*, fopAc_ac_c*, s16, dBgW_Base::PushPullLabel); /* 80C21DC4 */ void initBaseMtx(); /* 80C21E24 */ void setBaseMtx(); - /* 80C21EA4 */ void getPointNo(); + /* 80C21EA4 */ u16 getPointNo(); /* 80C21F2C */ void loadCurrentPos(); - /* 80C21FC8 */ void saveCurrentPos(); + /* 80C21FC8 */ int saveCurrentPos(); /* 80C22200 */ void enablePushPull(); /* 80C2224C */ void disablePushPull(); - /* 80C22298 */ void Create(); - /* 80C22618 */ void CreateHeap(); - /* 80C227F4 */ void create1st(); - /* 80C228B4 */ void Execute(f32 (**)[3][4]); - /* 80C2294C */ void checkWalk(); + /* 80C227F4 */ int create1st(); + /* 80C2294C */ int checkWalk(); /* 80C22B04 */ void clrCounter(); /* 80C22B28 */ void mode_proc_call(); /* 80C22EF8 */ void mode_init_wait(); @@ -33,23 +54,60 @@ public: /* 80C23058 */ void mode_init_walk(); /* 80C23088 */ void mode_proc_walk(); /* 80C23388 */ void setEffect(); - /* 80C2350C */ void checkWallPre(s16); - /* 80C236C8 */ void checkBgHit(); + /* 80C2350C */ int checkWallPre(s16); + /* 80C236C8 */ int checkBgHit(); /* 80C237B0 */ void bgCheck(); /* 80C23860 */ void init_bgCheck(); - /* 80C238B0 */ void checkFall(); + /* 80C238B0 */ BOOL checkFall(); /* 80C23A50 */ void event_proc_call(); /* 80C23B0C */ void actionWait(); /* 80C23B70 */ void actionOrderEvent(); /* 80C23C1C */ void actionEvent(); /* 80C23CA0 */ void actionDead(); - /* 80C23CA4 */ void Draw(); - /* 80C23DA8 */ void Delete(); -private: - /* 0x568 */ u8 field_0x568[0x9ec - 0x568]; + + /* 80C22618 */ virtual int CreateHeap(); + /* 80C22298 */ virtual int Create(); + /* 80C228B4 */ virtual int Execute(Mtx**); + /* 80C23CA4 */ virtual int Draw(); + /* 80C23DA8 */ virtual int Delete(); + + u8 getSwbit() { return fopAcM_GetParamBit(this, 0, 8); } + int getPathId() { return fopAcM_GetParamBit(this, 8, 8); } + int getCorrectPointNo() { return fopAcM_GetParamBit(this, 0x10, 8); } + u8 getSwbit2() { return fopAcM_GetParamBit(this, 0x18, 8); } + + void setAction(u8 i_action) { mAction = i_action; } + + /* 0x5A0 */ request_of_phase_process_class mPhase; + /* 0x5A8 */ J3DModel* mpIceModel; + /* 0x5AC */ J3DModel* mpModel; + /* 0x5B0 */ dBgS_ObjAcch mAcch; + /* 0x788 */ dBgS_AcchCir mAcchCir; + /* 0x7C8 */ dCcD_Stts mCcStts; + /* 0x804 */ dCcD_Cyl mCcCyl; + /* 0x940 */ dBgW::PushPullLabel mPPLabel; + /* 0x944 */ dBgW* mpIceBgW; + /* 0x948 */ u8 mCounter[4]; + /* 0x94C */ u8 mAction; + /* 0x94D */ u8 mMode; + /* 0x950 */ int mMoveDir; + /* 0x954 */ State_e mState; + /* 0x958 */ f32 mGroundY; + /* 0x95C */ cXyz mWallPrePos; + /* 0x968 */ dBgS_ObjGndChk mGndChk; + /* 0x9BC */ dPath* mpPath; + /* 0x9C0 */ u8 mSwbit; + /* 0x9C1 */ u8 mMaxSwNum; + /* 0x9C4 */ cXyz mWalkInitPos; + /* 0x9D0 */ u8 mWalkType; + /* 0x9D1 */ bool mIsPlayerRide; + /* 0x9D4 */ u32 field_0x9d4; + /* 0x9D8 */ u32 field_0x9d8; + /* 0x9DC */ u32 mKezuruEmtrID; + /* 0x9E0 */ u8 mHitCounter; + /* 0x9E4 */ JPABaseEmitter* mColdEffEmitters[2]; }; STATIC_ASSERT(sizeof(daObjIceBlk_c) == 0x9ec); - #endif /* D_A_OBJ_ICEBLOCK_H */ -- cgit v1.2.3