Skip to content

Commit b6febdc

Browse files
TtobasTtobas
andauthored
d_a_obj_shoe 91% (#2347)
* Basic structure done * daNpcShoe_Param_c done, class cleaned a bit, ::Create matching, destructor matching * WIP * About 70% done * Fix after merging main * TU almost done, missing correct rodata ordering, constructor, setMotionAnim, __sinit not matching * Fix: Apply suggestions --------- Co-authored-by: Ttobas <anon@ym.ous>
1 parent e876797 commit b6febdc

File tree

3 files changed

+781
-920
lines changed

3 files changed

+781
-920
lines changed

include/d/actor/d_a_npc_shoe.h

Lines changed: 121 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,47 +11,147 @@
1111
* @details
1212
*
1313
*/
14-
class daNpcShoe_c : public fopAc_ac_c {
14+
class daNpcShoe_c : public daNpcF_c {
1515
public:
16+
typedef bool (daNpcShoe_c::*actionFunc)(void*);
17+
typedef BOOL (daNpcShoe_c::*EventFn)(int);
18+
19+
enum Animation {
20+
/* 0x01 */ ANM_M_SITWAIT_A,
21+
/* 0x02 */ ANM_M_SITTALK_A,
22+
/* 0x03 */ ANM_M_SITTALK_A_B,
23+
/* 0x04 */ ANM_SHOE_TALK_A,
24+
/* 0x05 */ ANM_M_SIT_TO_WOLF_A
25+
};
26+
27+
enum Motion {
28+
/* 0x01 */ MOT_SITWAIT_A,
29+
/* 0x02 */ MOT_SITTALK_A,
30+
/* 0x03 */ MOT_SITTALK_A_B,
31+
/* 0x04 */ MOT_SHOE_TALK_A,
32+
/* 0x05 */ MOT_SIT_TO_WOLF_A,
33+
};
34+
1635
/* 80AE794C */ daNpcShoe_c();
1736
/* 80AE7B60 */ ~daNpcShoe_c();
18-
/* 80AE7D48 */ void Create();
19-
/* 80AE7FD8 */ void CreateHeap();
20-
/* 80AE81E8 */ void Delete();
21-
/* 80AE821C */ void Execute();
22-
/* 80AE8308 */ void Draw();
23-
/* 80AE840C */ void ctrlJoint(J3DJoint*, J3DModel*);
24-
/* 80AE8598 */ void createHeapCallBack(fopAc_ac_c*);
25-
/* 80AE85B8 */ void ctrlJointCallBack(J3DJoint*, int);
26-
/* 80AE8604 */ void setMotion(int, f32, int);
37+
/* 80AE7D48 */ cPhs__Step Create();
38+
/* 80AE7FD8 */ BOOL CreateHeap();
39+
/* 80AE81E8 */ int Delete();
40+
/* 80AE821C */ int Execute();
41+
/* 80AE8308 */ int Draw();
42+
/* 80AE840C */ bool ctrlJoint(J3DJoint*, J3DModel*);
43+
/* 80AE8598 */ static int createHeapCallBack(fopAc_ac_c*);
44+
/* 80AE85B8 */ static BOOL ctrlJointCallBack(J3DJoint*, int);
45+
/* 80AE8604 */ void setMotion(int, f32, BOOL);
2746
/* 80AE864C */ void reset();
28-
/* 80AE895C */ void setAction(bool (daNpcShoe_c::*)(void*));
29-
/* 80AE8A04 */ void wait(void*);
30-
/* 80AE8E24 */ void fear(void*);
31-
/* 80AE8ED4 */ void talk(void*);
32-
/* 80AE9094 */ void demo(void*);
47+
/* 80AE895C */ inline int setAction(actionFunc);
48+
/* 80AE8A04 */ bool wait(void*);
49+
/* 80AE8E24 */ bool fear(void*);
50+
/* 80AE8ED4 */ bool talk(void*);
51+
/* 80AE9094 */ bool demo(void*);
3352
/* 80AE92E8 */ void setParam();
34-
/* 80AE93A0 */ void main();
53+
/* 80AE93A0 */ BOOL main();
3554
/* 80AE9624 */ void setAttnPos();
3655
/* 80AE9820 */ void lookat();
3756
/* 80AE9A00 */ bool setMotionAnm(int, f32);
38-
/* 80AE9AD0 */ bool drawDbgInfo();
57+
/* 80AE9AD0 */ BOOL drawDbgInfo();
3958
/* 80AEA340 */ void adjustShapeAngle();
4059

41-
static u8 mEvtSeqList[12];
60+
s16 getMessageNo() { return fopAcM_GetParam(this) >> 0x10; }
61+
62+
int getTime() { return getTimeMinute() + getTimeHour() * 60; }
63+
int getTimeHour() {
64+
if (dKy_darkworld_check() != 0) {
65+
return dKy_getDarktime_hour();
66+
} else {
67+
return dKy_getdaytime_hour();
68+
}
69+
}
70+
int getTimeMinute() {
71+
if (dKy_darkworld_check() != 0) {
72+
return dKy_getDarktime_minute();
73+
} else {
74+
return dKy_getdaytime_minute();
75+
}
76+
}
4277

78+
int getStartTime() { return fopAcM_GetParam(this) & 0xff; }
79+
int getEndTime() { return (fopAcM_GetParam(this) >> 8) & 0xff; }
80+
81+
inline void setLookMode(int i_lookMode);
82+
inline bool chkFindPlayer();
83+
inline void playMotion();
84+
85+
static EventFn mEvtSeqList[1];
86+
4387
private:
44-
/* 0x568 */ u8 field_0x568[0xe1c - 0x568];
88+
/* 0xB48 */ J3DModel* mpModel1;
89+
/* 0xB4C */ J3DModel* mpModel2;
90+
/* 0xB50 */ Z2CreatureCitizen mCreature;
91+
/* 0xBF4 */ u8 field_0xbf4[0xbf8 - 0xbf4];
92+
/* 0xBF8 */ daNpcF_Lookat_c mLookat;
93+
/* 0xC94 */ daNpcF_ActorMngr_c mActorMngr[1];
94+
/* 0xC9C */ u8 field_0xc9c[0xca0 - 0xc9c];
95+
/* 0xCA0 */ dCcD_Cyl mCcCyl;
96+
/* 0xDDC */ actionFunc mpActionFn;
97+
/* 0xDE8 */ request_of_phase_process_class mPhases[3];
98+
/* 0xE00 */ u32 field_0xe00;
99+
/* 0xE04 */ u32 field_0xe04;
100+
/* 0xE08 */ u32 field_0xe08;
101+
/* 0xE0C */ u32 field_0xe0c;
102+
/* 0xE10 */ s16 mLookMode;
103+
/* 0xE12 */ u16 mStartTime;
104+
/* 0xE14 */ u16 mEndTime;
105+
/* 0xE16 */ u16 field_0xe16;
106+
/* 0xE18 */ u16 mMode;
107+
/* 0xE1A */ u8 field_0xe1a;
108+
/* 0xE1B */ u8 field_0xe1b; // Probably isDaytime or isNighttime
45109
};
46110

47111
STATIC_ASSERT(sizeof(daNpcShoe_c) == 0xe1c);
48112

49113
class daNpcShoe_Param_c {
50114
public:
51-
/* 80AEA344 */ ~daNpcShoe_Param_c();
115+
/* 8095D5D4 */ virtual ~daNpcShoe_Param_c() {}
116+
117+
struct param {
118+
/* 0x00 */ f32 mAttnOffsetY;
119+
/* 0x04 */ f32 mGravity;
120+
/* 0x08 */ f32 mScale;
121+
/* 0x0C */ f32 mShadowDepth;
122+
/* 0x10 */ f32 mCcWeight;
123+
/* 0x14 */ f32 mCylH;
124+
/* 0x18 */ f32 mWallH;
125+
/* 0x1C */ f32 mWallR;
126+
/* 0x20 */ f32 mBodyUpAngle;
127+
/* 0x24 */ f32 mBodyDownAngle;
128+
/* 0x28 */ f32 mBodyLeftAngle;
129+
/* 0x2C */ f32 mBodyRightAngle;
130+
/* 0x30 */ f32 mHeadUpAngle;
131+
/* 0x34 */ f32 mHeadDownAngle;
132+
/* 0x38 */ f32 mHeadLeftAngle;
133+
/* 0x3C */ f32 mHeadRightAngle;
134+
/* 0x40 */ f32 mNeckAngleScl;
135+
/* 0x44 */ f32 mMorfFrames;
136+
/* 0x48 */ s16 mSpeakDistIdx;
137+
/* 0x4A */ s16 mSpeakAngleIdx;
138+
/* 0x4C */ s16 mTalkDistIdx;
139+
/* 0x4E */ s16 mTalkAngleIdx;
140+
/* 0x50 */ f32 mAttnFovY;
141+
/* 0x54 */ f32 mAttnRadius;
142+
/* 0x58 */ f32 mAttnUpperY;
143+
/* 0x5C */ f32 mAttnLowerY;
144+
/* 0x60 */ s16 field_0x60;
145+
/* 0x62 */ s16 mDamageTimer;
146+
/* 0x64 */ s16 mTestExpression;
147+
/* 0x66 */ s16 mTestMotion;
148+
/* 0x68 */ s16 mTestLookMode;
149+
/* 0x6A */ bool mTest;
150+
};
52151

53-
static u8 const m[108];
152+
static param const m;
54153
};
55154

155+
STATIC_ASSERT(sizeof(daNpcShoe_Param_c::param) == 0x6C);
56156

57157
#endif /* D_A_NPC_SHOE_H */

include/m_Do/m_Do_ext.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ class mDoExt_McaMorfSO : public mDoExt_morf_c {
334334
J3DModel* getModel() { return mpModel; }
335335
void offMorfNone() { mMorfNone = false; }
336336
void onMorfNone() { mMorfNone = true; }
337+
inline void setTranslateScale(cXyz& i_scale) { mTranslateScale = i_scale; }
337338
J3DTransformInfo* getOldTransInfo() { return mpTransformInfo; }
338339
Quaternion* getOldQuaternion() { return mpQuat; }
339340
void offTranslate() { mTranslate = true; }

0 commit comments

Comments
 (0)