summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTakaRikka <38417346+TakaRikka@users.noreply.github.com>2024-07-17 12:51:24 -0700
committerGitHub <noreply@github.com>2024-07-17 13:51:24 -0600
commit5e283fd567b03c3ce8d1c2fc127fca505da1388f (patch)
tree70da14b1476fbea1e3d1f27dc43cba4a05e076fa /include
parent038cdb8b5f6207ba01c46799acf897fdb624fca0 (diff)
obj_movebox mostly done (#2181)
Diffstat (limited to 'include')
-rw-r--r--include/d/a/d_a_obj.h6
-rw-r--r--include/d/bg/d_bg_s.h2
-rw-r--r--include/d/bg/d_bg_s_movebg_actor.h1
-rw-r--r--include/rel/d/a/obj/d_a_obj_burnbox/d_a_obj_burnbox.h4
-rw-r--r--include/rel/d/a/obj/d_a_obj_eff/d_a_obj_eff.h8
-rw-r--r--include/rel/d/a/obj/d_a_obj_movebox/d_a_obj_movebox.h243
6 files changed, 212 insertions, 52 deletions
diff --git a/include/d/a/d_a_obj.h b/include/d/a/d_a_obj.h
index 18177f271f..bc771a0444 100644
--- a/include/d/a/d_a_obj.h
+++ b/include/d/a/d_a_obj.h
@@ -15,6 +15,12 @@ void posMoveF_grade(fopAc_ac_c*, cXyz const*, cXyz const*, f32, f32, cXyz const*
cXyz const*);
void quat_rotBaseY(Quaternion*, cXyz const&);
void HitSeStart(cXyz const*, int, dCcD_GObjInf const*, u32);
+
+template <typename T>
+int PrmAbstract(const fopAc_ac_c* i_actor, T i_prmA, T i_prmB) {
+ u32 param = fopAcM_GetParam(i_actor);
+ return ((1 << i_prmA) - 1) & (param >> i_prmB);
+}
}; // namespace daObj
#endif /* D_A_D_A_OBJ_H */
diff --git a/include/d/bg/d_bg_s.h b/include/d/bg/d_bg_s.h
index 510a452406..ccf9816251 100644
--- a/include/d/bg/d_bg_s.h
+++ b/include/d/bg/d_bg_s.h
@@ -108,7 +108,7 @@ public:
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); }
+ u32 GetMtrlSndId(const cBgS_PolyInfo& param_0) { return dKy_pol_sound_get(&param_0); }
}; // Size: 0x1404
bool dBgS_CheckBGroundPoly(cBgS_PolyInfo const&);
diff --git a/include/d/bg/d_bg_s_movebg_actor.h b/include/d/bg/d_bg_s_movebg_actor.h
index 8ae508d0d3..d8c605808b 100644
--- a/include/d/bg/d_bg_s_movebg_actor.h
+++ b/include/d/bg/d_bg_s_movebg_actor.h
@@ -20,6 +20,7 @@ public:
/* 80078950 */ int MoveBGExecute();
int MoveBGDraw() { return Draw(); }
+ int MoveBGIsDelete() { return IsDelete(); }
/* 80078688 */ virtual int CreateHeap();
/* 80078690 */ virtual int Create();
diff --git a/include/rel/d/a/obj/d_a_obj_burnbox/d_a_obj_burnbox.h b/include/rel/d/a/obj/d_a_obj_burnbox/d_a_obj_burnbox.h
index 1d3659f001..381a834497 100644
--- a/include/rel/d/a/obj/d_a_obj_burnbox/d_a_obj_burnbox.h
+++ b/include/rel/d/a/obj/d_a_obj_burnbox/d_a_obj_burnbox.h
@@ -22,6 +22,10 @@ public:
/* 8046EABC */ void Draw();
/* 8046EC10 */ void Delete();
+ static void make_prm_burnbox(u32* param_0, u8 param_1) {
+ *param_0 = param_1;
+ }
+
private:
/* 0x568 */ u8 field_0x568[0x740 - 0x568];
};
diff --git a/include/rel/d/a/obj/d_a_obj_eff/d_a_obj_eff.h b/include/rel/d/a/obj/d_a_obj_eff/d_a_obj_eff.h
index 966117ecdf..39f6d980bd 100644
--- a/include/rel/d/a/obj/d_a_obj_eff/d_a_obj_eff.h
+++ b/include/rel/d/a/obj/d_a_obj_eff/d_a_obj_eff.h
@@ -2,6 +2,7 @@
#define D_A_OBJ_EFF_H
#include "f_op/f_op_actor_mng.h"
+#include "d/a/d_a_obj.h"
/**
* @ingroup actors-objects
@@ -36,11 +37,4 @@ public:
};
}; // namespace daObjEff
-struct daObj {
-public:
- template <typename T>
- static int PrmAbstract(const fopAc_ac_c* param_0, T param_1, T param_2);
-};
-
-
#endif /* D_A_OBJ_EFF_H */
diff --git a/include/rel/d/a/obj/d_a_obj_movebox/d_a_obj_movebox.h b/include/rel/d/a/obj/d_a_obj_movebox/d_a_obj_movebox.h
index 9a778e3a7e..cd2610477a 100644
--- a/include/rel/d/a/obj/d_a_obj_movebox/d_a_obj_movebox.h
+++ b/include/rel/d/a/obj/d_a_obj_movebox/d_a_obj_movebox.h
@@ -2,7 +2,10 @@
#define D_A_OBJ_MOVEBOX_H
#include "d/com/d_com_inf_game.h"
+#include "d/a/d_a_obj.h"
#include "f_op/f_op_actor_mng.h"
+#include "d/bg/d_bg_s_movebg_actor.h"
+#include "d/bg/d_bg_w.h"
/**
* @ingroup actors-objects
@@ -15,26 +18,144 @@
* Arbiter's Grounds Block (2 of them), Kakariko Graveyard Gravestone
*
*/
-class daObjMovebox : public fopAc_ac_c {
- struct Act_c {
- struct Prm_e {};
+namespace daObjMovebox {
+ class Hio_c {
+ public:
+ class Attr_c {
+ public:
+ /* 0x00 */ s16 mFirstPushStopTime;
+ /* 0x02 */ s16 mRepeatPushStopTime;
+ /* 0x04 */ s16 mPushMoveTime;
+ /* 0x06 */ s16 mFirstPullStopTime;
+ /* 0x08 */ s16 mRepeatPullStopTime;
+ /* 0x0A */ s16 mPullMoveTime;
+ /* 0x0C */ f32 mUnitDistance;
+ /* 0x10 */ f32 mShadowSize;
+ /* 0x14 */ f32 mGravity;
+ /* 0x18 */ f32 mViscosityResistance;
+ /* 0x1C */ f32 mInertiaResistance;
+ /* 0x20 */ f32 mFallYInitSpeed;
+ /* 0x24 */ f32 mLandSmokeScale;
+ /* 0x28 */ f32 mBuoyancy;
+ /* 0x2C */ f32 mPlayerGravity;
+ /* 0x30 */ f32 mMiscGravity;
+ /* 0x34 */ f32 mWaterOscillationAccel;
+ /* 0x38 */ s16 mWaterOscillationAngleSpeed;
+ /* 0x3C */ f32 mWaterViscoscityResistance;
+ /* 0x40 */ f32 mWaterInertiaResistance;
+ /* 0x44 */ f32 mPlayerTiltPower;
+ /* 0x48 */ f32 mMiscTiltPower;
+ /* 0x4C */ f32 mMaxTiltPower;
+ /* 0x50 */ f32 mTiltSpringFactor;
+ /* 0x54 */ f32 mTiltViscoscityResistance;
+ /* 0x58 */ int field_0x58;
+ /* 0x5C */ int field_0x5c;
+ /* 0x60 */ u32 field_0x60;
+ /* 0x64 */ f32 field_0x64;
+ /* 0x68 */ f32 field_0x68;
+ /* 0x6C */ f32 field_0x6c;
+ /* 0x70 */ f32 field_0x70;
+ /* 0x74 */ f32 field_0x74;
+ /* 0x78 */ f32 field_0x78;
+ /* 0x7C */ u32 field_0x7c;
+ /* 0x80 */ u32 field_0x80;
+ /* 0x84 */ u32 field_0x84;
+ /* 0x88 */ u32 field_0x88;
+ /* 0x8C */ int field_0x8c;
+ /* 0x90 */ s16 field_0x90;
+ /* 0x92 */ s16 field_0x92;
+ /* 0x94 */ s16 field_0x94;
+ /* 0x96 */ s16 field_0x96;
+ /* 0x98 */ s16 field_0x98;
+ /* 0x9A */ s16 field_0x9a;
+ /* 0x9C */ u8 field_0x9c;
+ /* 0x9D */ u8 field_0x9d;
+ /* 0x9E */ u8 field_0x9e;
+ };
+ };
+
+ class BgcSrc_c {
+ public:
+ /* 0x0 */ f32 field_0x0;
+ /* 0x4 */ f32 field_0x4;
+ /* 0x8 */ f32 field_0x8;
+ /* 0xC */ f32 field_0xc;
+ };
+
+ class Act_c;
+
+ class Bgc_c {
+ public:
+ enum State_e {
+ STATE_0_e = 0x0,
+ STATE_1_e = 0x1,
+ STATE_2_e = 0x2,
+ STATE_4_e = 0x4,
+ STATE_8_e = 0x8,
+ STATE_10_e = 0x10,
+ STATE_20_e = 0x20,
+ STATE_40_e = 0x40,
+ };
+
+ /* 8047DAEC */ Bgc_c();
+ /* 8047DBF0 */ void gnd_pos(daObjMovebox::Act_c const*, daObjMovebox::BgcSrc_c const*, int,
+ f32);
+ /* 8047DD88 */ void wrt_pos(cXyz const&);
+ /* 8047DE58 */ void wall_pos(daObjMovebox::Act_c const*, daObjMovebox::BgcSrc_c const*, int,
+ s16, f32);
+ /* 8047E134 */ void proc_vertical(daObjMovebox::Act_c*);
+ /* 8047E2D4 */ bool chk_wall_pre(daObjMovebox::Act_c const*, daObjMovebox::BgcSrc_c const*,
+ int, s16);
+ /* 8047E350 */ bool chk_wall_touch(daObjMovebox::Act_c const*,
+ daObjMovebox::BgcSrc_c const*, s16);
+ /* 8047E5A0 */ bool chk_wall_touch2(daObjMovebox::Act_c const*,
+ daObjMovebox::BgcSrc_c const*, int, s16);
+
+ static const daObjMovebox::BgcSrc_c M_lin5[];
+ static const daObjMovebox::BgcSrc_c M_lin20[];
+
+ #ifdef NONMATCHING
+ static dBgS_ObjGndChk M_gnd_work[23];
+ static dBgS_WtrChk M_wrt_work;
+ static dBgS_ObjLinChk M_wall_work[23];
+ #else
+ static u8 M_gnd_work[1932];
+ static u8 M_wrt_work[84];
+ static u8 M_wall_work[2576];
+ #endif
+
+ /* 0x000 */ f32 field_0x0[23];
+ /* 0x05C */ int field_0x5c;
+ /* 0x060 */ f32 field_0x60;
+ /* 0x064 */ cXyz field_0x64[23];
+ /* 0x178 */ int field_0x178;
+ /* 0x17C */ f32 field_0x17c;
+ /* 0x180 */ State_e mState;
+ };
+
+ class Act_c : public dBgS_MoveBgActor {
+ public:
+ enum Prm_e {
+ PRM_4_e = 0x4,
+ PRM_8_e = 0x8,
+ PRM_18_e = 0x18,
+ PRM_1C_e = 0x1C,
+ };
- /* 8047E628 */ void prm_get_swSave1() const;
+ /* 8047E628 */ int prm_get_swSave1() const;
/* 8047E650 */ void prmZ_init();
/* 8047E680 */ void prmX_init();
- /* 8047E6B0 */ void attr() const;
+ /* 8047E6B0 */ const daObjMovebox::Hio_c::Attr_c& attr() const;
/* 8047E6C8 */ void set_mtx();
/* 8047E7B0 */ void init_mtx();
/* 8047E7F4 */ void path_init();
/* 8047E92C */ void path_save();
- /* 8047EB48 */ void CreateHeap();
- /* 8047EBEC */ void RideCallBack(dBgW*, fopAc_ac_c*, fopAc_ac_c*);
- /* 8047ED10 */ void PPCallBack(fopAc_ac_c*, fopAc_ac_c*, s16, dBgW_Base::PushPullLabel);
- /* 8047EE0C */ void Create();
+ /* 8047EBEC */ static void RideCallBack(dBgW*, fopAc_ac_c*, fopAc_ac_c*);
+ /* 8047ED10 */ static fopAc_ac_c* PPCallBack(fopAc_ac_c*, fopAc_ac_c*, s16, dBgW_Base::PushPullLabel);
/* 8047F11C */ void afl_sway();
- /* 8047F38C */ void check_to_walk();
+ /* 8047F38C */ int check_to_walk();
/* 8047F50C */ void clr_moment_cnt();
- /* 8047F530 */ void chk_appear() const;
+ /* 8047F530 */ bool chk_appear() const;
/* 8047F5CC */ void eff_smoke_slip_start();
/* 8047F634 */ void mode_wait_init();
/* 8047F6A8 */ void mode_wait();
@@ -47,44 +168,78 @@ class daObjMovebox : public fopAc_ac_c {
/* 804800E4 */ void sound_land();
/* 804801A8 */ void vib_land();
/* 804801FC */ void eff_land_smoke();
- /* 8048027C */ void Execute(f32 (**)[3][4]);
- /* 80480728 */ void Draw();
- /* 804808FC */ void Delete();
-
- static void* M_dir_base[2];
- static void* const M_arcname[8];
- static u8 const M_cyl_src[68];
- static u8 const M_attr[1280];
- };
- struct BgcSrc_c {};
+ /* 8047EB48 */ virtual int CreateHeap();
+ /* 8047EE0C */ virtual int Create();
+ /* 8048027C */ virtual int Execute(Mtx**);
+ /* 80480728 */ virtual int Draw();
+ /* 804808FC */ virtual int Delete();
- struct Bgc_c {
- /* 8047DAEC */ Bgc_c();
- /* 8047DBF0 */ void gnd_pos(daObjMovebox::Act_c const*, daObjMovebox::BgcSrc_c const*, int,
- f32);
- /* 8047DD88 */ void wrt_pos(cXyz const&);
- /* 8047DE58 */ void wall_pos(daObjMovebox::Act_c const*, daObjMovebox::BgcSrc_c const*, int,
- s16, f32);
- /* 8047E134 */ void proc_vertical(daObjMovebox::Act_c*);
- /* 8047E2D4 */ void chk_wall_pre(daObjMovebox::Act_c const*, daObjMovebox::BgcSrc_c const*,
- int, s16);
- /* 8047E350 */ void chk_wall_touch(daObjMovebox::Act_c const*,
- daObjMovebox::BgcSrc_c const*, s16);
- /* 8047E5A0 */ void chk_wall_touch2(daObjMovebox::Act_c const*,
- daObjMovebox::BgcSrc_c const*, int, s16);
+ inline void mode_proc_call();
+ inline int Mthd_Create();
+ inline int Mthd_Delete();
- static u8 const M_lin5[80];
- static u8 const M_lin20[368];
- static u8 M_gnd_work[1932];
- static u8 M_wrt_work[84];
- static u8 M_wall_work[2576];
- };
+ // some functions need an inlined version of `attr`, find better fix later
+ const daObjMovebox::Hio_c::Attr_c& i_attr() const { return M_attr[mType]; }
-private:
- /* 0x568 */ u8 field_0x568[0x90c - 0x568];
+ int prm_get_swSave() const { return daObj::PrmAbstract(this, PRM_8_e, PRM_8_e); }
+ int prmZ_get_swSave2() const { return (u8)(mPrmZ >> 8); }
+ int prm_get_dmy() const { return 0; }
+ int prmZ_get_pathId() const { return mPrmZ & 0xFF; }
+ u8 prm_get_answer() const { return daObj::PrmAbstract(this, PRM_4_e, PRM_1C_e); }
+ int prm_get_type() const { return daObj::PrmAbstract(this, PRM_4_e, PRM_18_e); }
+
+ int is_switch1() const { return fopAcM_isSwitch(this, prm_get_swSave1()) != 0; }
+ int is_switch2() const { return fopAcM_isSwitch(this, prmZ_get_swSave2()) != 0; }
+
+ void on_switch1() const { fopAcM_onSwitch(this, prm_get_swSave1()); }
+ void on_switch2() const { fopAcM_onSwitch(this, prmZ_get_swSave2()); }
+ void off_switch1() const { fopAcM_offSwitch(this, prm_get_swSave1()); }
+ void off_switch2() const { fopAcM_offSwitch(this, prmZ_get_swSave2()); }
+
+ static s16 M_dir_base[4];
+ static const char* M_arcname[8];
+ static const dCcD_SrcCyl M_cyl_src;
+ static const daObjMovebox::Hio_c::Attr_c M_attr[8];
+
+ /* 0x5A0 */ request_of_phase_process_class mPhase;
+ /* 0x5A8 */ J3DModel* mpModel;
+ /* 0x5AC */ int field_0x5ac;
+ /* 0x5B0 */ dCcD_Stts mCcStts;
+ /* 0x5EC */ dCcD_Cyl mCcCyl;
+ /* 0x728 */ Bgc_c mBgc;
+ /* 0x8AC */ int mType;
+ /* 0x8B0 */ u16 mPrmZ;
+ /* 0x8B2 */ u16 mPrmX;
+ /* 0x8B4 */ dPath* mpPath;
+ /* 0x8B8 */ s16 field_0x8b8;
+ /* 0x8BC */ f32 field_0x8bc;
+ /* 0x8C0 */ f32 field_0x8c0;
+ /* 0x8C4 */ f32 field_0x8c4;
+ /* 0x8C8 */ f32 field_0x8c8;
+ /* 0x8CC */ f32 field_0x8cc;
+ /* 0x8D0 */ f32 field_0x8d0;
+ /* 0x8D4 */ f32 field_0x8d4;
+ /* 0x8D8 */ f32 field_0x8d8;
+ /* 0x8DC */ int field_0x8dc;
+ /* 0x8E0 */ int field_0x8e0;
+ /* 0x8E4 */ f32 field_0x8e4;
+ /* 0x8E8 */ int field_0x8e8;
+ /* 0x8EC */ dBgW::PushPullLabel mPPLabel;
+ /* 0x8F0 */ s16 field_0x8f0[4];
+ /* 0x8F8 */ s16 field_0x8f8;
+ /* 0x8FA */ s16 field_0x8fa;
+ /* 0x8FC */ s16 field_0x8fc;
+ /* 0x8FE */ u8 field_0x8fe;
+ /* 0x8FF */ s8 mReverb;
+ /* 0x900 */ u8 field_0x900;
+ /* 0x901 */ u8 field_0x901;
+ /* 0x902 */ u8 field_0x902;
+ /* 0x904 */ int field_0x904;
+ /* 0x908 */ s8 field_0x908;
+ };
};
-STATIC_ASSERT(sizeof(daObjMovebox) == 0x90C);
+STATIC_ASSERT(sizeof(daObjMovebox::Act_c) == 0x90C);
#endif /* D_A_OBJ_MOVEBOX_H */