Skip to content

Commit b0d08c5

Browse files
authored
d_a_obj_swpush equivalent (#2589)
* initial work * Create method done * tiny work * more work * swpush equivalent
1 parent 39ed9ff commit b0d08c5

File tree

5 files changed

+959
-978
lines changed

5 files changed

+959
-978
lines changed

configure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1498,7 +1498,7 @@ def MatchingFor(*versions) -> bool:
14981498
ActorRel(NonMatching, "d_a_obj_carry"),
14991499
ActorRel(NonMatching, "d_a_obj_ito"),
15001500
ActorRel(NonMatching, "d_a_obj_movebox"),
1501-
ActorRel(NonMatching, "d_a_obj_swpush"),
1501+
ActorRel(Equivalent, "d_a_obj_swpush"), # weak func order
15021502
ActorRel(MatchingFor("GZ2E01"), "d_a_obj_timer"),
15031503
ActorRel(MatchingFor("GZ2E01"), "d_a_path_line"),
15041504
ActorRel(NonMatching, "d_a_scene_exit"),

include/d/actor/d_a_obj_swpush.h

Lines changed: 157 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#ifndef D_A_OBJ_SWPUSH_H
22
#define D_A_OBJ_SWPUSH_H
33

4-
#include "f_op/f_op_actor_mng.h"
4+
#include "d/d_a_obj.h"
5+
#include "d/d_bg_w_sv.h"
6+
#include "d/d_com_inf_game.h"
57

68
/**
79
* @ingroup actors-objects
@@ -11,25 +13,93 @@
1113
* @details This is a multi-purpose depression switch actor.
1214
* Used by: Gold Pressure Switch, Lakebed Pressure Switch
1315
*
14-
*/
15-
class daObjSwpush : public fopAc_ac_c {
16-
public:
17-
class Act_c {
16+
*/
17+
namespace daObjSwpush {
18+
enum AttrFlag_e {
19+
FLAG_OBEY_SAVE = 0x1,
20+
FLAG_STAY_PRESSED = 0x2,
21+
FLAG_IS_TOGGLE = 0x4,
22+
FLAG_REQ_HEAVY = 0x8,
23+
FLAG_ON_IS_UP = 0x10,
24+
FLAG_UNK20 = 0x20,
25+
};
26+
27+
class Hio_c {
28+
public:
29+
class Attr_c {
30+
public:
31+
/* § 踏みスイッチ §\n - Foot Switch */
32+
/* 0x00 */ AttrFlag_e flags;
33+
/* 0x04 */ f32 scale;
34+
/* 0x08 */ f32 draw_spring; // draw_spring
35+
/* 0x0C */ f32 draw_resist; // draw_resist
36+
/* 0x10 */ f32 draw_down_spd0; // draw_down_spd0
37+
/* 0x14 */ f32 draw_pypcon_acc; // draw_pypcon_acc
38+
/* 0x18 */ s16 bg_time_lag; // bg_time_lag
39+
/* 0x1A */ s16 able_push_time_any; // able_push_time_any
40+
/* 0x1C */ s16 able_push_time_heavy; // able_push_time_heavy
41+
/* 0x1E */ s16 able_ride_time_middle; // able_ride_time_middle
42+
/* 0x20 */ f32 step_up_space; // step_up_space
43+
/* 0x24 */ f32 step_down_space; // step_down_space
44+
/* 0x28 */ s16 demo_run_time; // demo_run_time
45+
/* 0x2A */ u8 field_0x2a;
46+
/* 0x2B */ u8 field_0x2b;
47+
};
48+
};
49+
50+
class Act_c : public fopAc_ac_c {
1851
public:
19-
struct Prm_e {};
52+
enum Prm_e {
53+
/* 0x00 */ PRM_0_e,
54+
/* 0x01 */ PRM_1_e,
55+
/* 0x03 */ PRM_3_e = 0x3,
56+
/* 0x04 */ PRM_4_e,
57+
/* 0x08 */ PRM_8_e = 0x8,
58+
/* 0x10 */ PRM_10_e = 0X10,
59+
/* 0x18 */ PRM_18_e = 0x18,
60+
/* 0x1D */ PRM_1D_e = 0x1D,
61+
};
62+
63+
enum Mode_e {
64+
MODE_UPPER = 0,
65+
MODE_U_L = 1,
66+
MODE_LOWER = 2,
67+
MODE_L_U = 3
68+
};
69+
70+
enum DemoMode_e {
71+
DEMO_MODE_NON = 0,
72+
DEMO_MODE_REQ_PAUSE = 1,
73+
DEMO_MODE_RUN_PAUSE = 2,
74+
DEMO_MODE_REQ_SW = 3,
75+
DEMO_MODE_RUN_SW = 4
76+
};
77+
78+
const Hio_c::Attr_c& attr() const { return M_attr[mType]; }
79+
u8 prmZ_get_swSave2() const { return mPrmZ & 0xFF; }
80+
int prm_get_couple() const { return daObj::PrmAbstract(this, PRM_1_e, PRM_1D_e); }
81+
u8 prm_get_evId() const { return daObj::PrmAbstract(this, PRM_8_e, PRM_0_e); }
82+
int prm_get_mdl() const { return daObj::PrmAbstract(this, PRM_4_e, PRM_10_e); }
83+
int prm_get_swSave() const { return daObj::PrmAbstract(this, PRM_8_e, PRM_8_e); }
84+
int prm_get_type() const { return daObj::PrmAbstract(this, PRM_3_e, PRM_18_e); }
85+
bool is_switch() { return fopAcM_isSwitch(this, prm_get_swSave()); }
86+
void fopAcM_revSwitch(fopAc_ac_c* i_actor, int param) { dComIfGs_revSwitch(param, fopAcM_GetHomeRoomNo(i_actor)); }
87+
void rev_switch() { fopAcM_revSwitch(this, prm_get_swSave()); }
88+
void off_switch() { fopAcM_offSwitch(this, prm_get_swSave()); }
89+
void on_switch() { fopAcM_onSwitch(this, prm_get_swSave()); }
2090

2191
/* 80482D4C */ void prmZ_init();
22-
/* 80482D7C */ void is_switch2() const;
23-
/* 80482DC4 */ void solidHeapCB(fopAc_ac_c*);
24-
/* 80482DE8 */ void create_heap();
25-
/* 80482FE8 */ void create_res_load();
26-
/* 80483038 */ void Mthd_Create();
27-
/* 8048348C */ void Mthd_Delete();
92+
/* 80482D7C */ bool is_switch2() const;
93+
/* 80482DC4 */ static BOOL solidHeapCB(fopAc_ac_c*);
94+
/* 80482DE8 */ bool create_heap();
95+
/* 80482FE8 */ cPhs__Step create_res_load();
96+
/* 80483038 */ cPhs__Step Mthd_Create();
97+
/* 8048348C */ int Mthd_Delete();
2898
/* 804834E8 */ void set_mtx();
2999
/* 80483534 */ void init_mtx();
30100
/* 80483570 */ void set_btp_frame();
31-
/* 80483574 */ void rideCB(dBgW*, fopAc_ac_c*, fopAc_ac_c*);
32-
/* 804839B4 */ void jnodeCB(J3DJoint*, int);
101+
/* 80483574 */ static void rideCB(dBgW*, fopAc_ac_c*, fopAc_ac_c*);
102+
/* 804839B4 */ static int jnodeCB(J3DJoint*, int);
33103
/* 80483A5C */ void calc_top_pos();
34104
/* 80483B70 */ void top_bg_aim_req(f32, s16);
35105
/* 80483B7C */ void set_push_flag();
@@ -52,32 +122,84 @@ class daObjSwpush : public fopAc_ac_c {
52122
/* 804847B4 */ void demo_reqSw();
53123
/* 80484828 */ void demo_runSw_init();
54124
/* 80484834 */ void demo_runSw();
55-
/* 80484890 */ void check_ride_couple(s16);
56-
/* 804848D8 */ void nr_ride_people(char);
57-
/* 80484908 */ void Mthd_Execute();
58-
/* 80484BB8 */ void Mthd_Draw();
125+
/* 80484890 */ bool check_ride_couple(s16);
126+
/* 804848D8 */ int nr_ride_people(char);
127+
/* 80484908 */ int Mthd_Execute();
128+
/* 80484BB8 */ int Mthd_Draw();
59129

60-
static u8 const M_bmd[6 + 2 /* padding */];
61-
static u8 const M_dzb[6 + 2 /* padding */];
62-
static u8 const M_heap_size[12];
63-
static u8 const M_attr[220];
64-
static u32 const M_op_vtx;
65-
static void* M_arcname[3];
130+
static s16 const M_bmd[3];
131+
static s16 const M_dzb[3];
132+
static u32 const M_heap_size[3];
133+
static Hio_c::Attr_c const M_attr[5];
134+
static u8 const M_op_vtx[4];
135+
static char* M_arcname[3];
136+
137+
/* 0x568 */ request_of_phase_process_class mPhase;
138+
/* 0x570 */ dBgWSv* mpBgW;
139+
/* 0x574 */ Mtx mMtx;
140+
/* 0x5A4 */ f32 field_0x5a4;
141+
/* 0x5A8 */ J3DModel* mpModel;
142+
/* 0x5AC */ int mType;
143+
/* 0x5B0 */ int mMode;
144+
/* 0x5B4 */ int mDemoMode;
145+
/* 0x5B8 */ s16 mPauseTimer;
146+
/* 0x5BA */ s16 mEventID;
147+
/* 0x5BC */ u16 mPrmZ;
148+
/* 0x5BE */ bool mPrmZInit;
149+
/* 0x5BF */ u8 mVibTimer;
150+
/* 0x5C0 */ u8 mRidingMode;
151+
/* 0x5C1 */ bool mPrevRiding;
152+
/* 0x5C2 */ s16 mMiniPushTimer;
153+
/* 0x5C4 */ bool mMiniPushFlg;
154+
/* 0x5C5 */ u8 field_0x5c5;
155+
/* 0x5C6 */ bool mHeavyRiding;
156+
/* 0x5C7 */ bool mPrevHeavyRiding;
157+
/* 0x5C8 */ s16 mPushTimer;
158+
/* 0x5CA */ bool mPushFlg;
159+
/* 0x5CB */ bool mChangingState;
160+
/* 0x5CC */ f32 mTargetHFrac;
161+
/* 0x5D0 */ f32 mCurHFrac;
162+
/* 0x5D4 */ f32 mSpeed;
163+
/* 0x5D8 */ f32 field_0x5d8;
164+
/* 0x5DC */ f32 field_0x5dc;
165+
/* 0x5E0 */ s16 field_0x5e0;
166+
/* 0x5E4 */ f32 field_0x5e4;
167+
/* 0x5E8 */ f32 field_0x5e8;
168+
/* 0x5EC */ f32 mTopPos;
169+
/* 0x5F0 */ s16 mDebounceTimer;
170+
/* 0x5F2 */ s8 field_0x5f2;
171+
/* 0x5F3 */ u8 field_0x5f3;
172+
/* 0x5F4 */ u8 mMdl;
173+
/* 0x5F8 */ cXyz field_0x5f8;
66174
};
67175

68-
private:
69-
/* 0x568 */ u8 field_0x568[0x604 - 0x568];
70-
};
176+
#ifdef DEBUG
177+
class Hio_c : public JORReflexible {
178+
public:
179+
void ct() {
180+
if (mCount++ == 0) {
181+
daObj::HioVarious_c::init(this, "踏みスイッチ"); // Foot Switch
182+
}
183+
}
71184

72-
STATIC_ASSERT(sizeof(daObjSwpush) == 0x604);
185+
void default_set() {
186+
for (int i = 0; i < 5; i++) {
187+
field_0x8[i] = Act_c::M_attr[i];
188+
}
189+
}
73190

74-
struct daObj {
75-
public:
76-
template <typename A1>
77-
void PrmAbstract(/* ... */);
78-
/* 80484CE4 */ /* daObj::PrmAbstract<daObjSwpush::Act_c::Prm_e> */
79-
void func_80484CE4(void* _this, fopAc_ac_c const*, daObjSwpush::Act_c::Prm_e,
80-
daObjSwpush::Act_c::Prm_e);
191+
void dt() {
192+
if (--mCount == 0) {
193+
daObj::HioVarious_c::clean(this);
194+
}
195+
}
196+
197+
/* 0x4 */ int mCount;
198+
/* 0x8 */ Attr_c field_0x8[5];
199+
};
200+
#endif
81201
};
82202

203+
STATIC_ASSERT(sizeof(daObjSwpush::Act_c) == 0x604);
204+
83205
#endif /* D_A_OBJ_SWPUSH_H */

include/d/d_bg_w.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,9 @@ class cBgW : public dBgW_Base {
225225
bool ChkRoofRegist() { return field_0x91 & 4;}
226226
cBgD_Vtx_t* GetVtxTbl() const { return pm_vtx_tbl; }
227227
int GetVtxNum() const { return pm_bgd->m_v_num; }
228+
void ClrNoCalcVtx() { mFlags &= ~NO_CALC_VTX_e; }
229+
void SetBaseMtxP(MtxP mtx) { pm_base = mtx; }
230+
void SetNoCalcVtx() { mFlags |= NO_CALC_VTX_e; }
228231

229232
public:
230233
/* 0x18 */ MtxP pm_base; // Model Matrix

include/d/d_com_inf_game.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2105,6 +2105,10 @@ inline void dComIfGs_offTransformLV(int i_no) {
21052105
g_dComIfG_gameInfo.info.getPlayer().getPlayerStatusB().offTransformLV(i_no);
21062106
}
21072107

2108+
inline void dComIfGs_revSwitch(int i_no, int i_roomNo) {
2109+
g_dComIfG_gameInfo.info.revSwitch(i_no, i_roomNo);
2110+
}
2111+
21082112
void dComIfGp_setSelectItem(int index);
21092113
s32 dComIfGp_offHeapLockFlag(int flag);
21102114
void dComIfGp_createSubExpHeap2D();

0 commit comments

Comments
 (0)