Skip to content

Commit 4679b6e

Browse files
authored
d_a_cow Equivalent (#2353)
* decompile d_a_cow * rescope enums to daCow_c class * apply suggestions by TakaRikka * fix JUT_ASSERT
1 parent 57289d0 commit 4679b6e

File tree

9 files changed

+3316
-2309
lines changed

9 files changed

+3316
-2309
lines changed

configure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,7 @@ def MatchingFor(*versions):
16001600
ActorRel(NonMatching, "d_a_bullet"),
16011601
ActorRel(NonMatching, "d_a_coach_2D"),
16021602
ActorRel(MatchingFor("GZ2E01"), "d_a_coach_fire"),
1603-
ActorRel(NonMatching, "d_a_cow"),
1603+
ActorRel(Equivalent, "d_a_cow"),
16041604
ActorRel(NonMatching, "d_a_cstatue"),
16051605
ActorRel(Equivalent, "d_a_do"), # Z2SoundObjSimple dtor
16061606
ActorRel(MatchingFor("GZ2E01"), "d_a_door_boss"),

include/d/actor/d_a_cow.h

Lines changed: 213 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,154 @@
11
#ifndef D_A_COW_H
22
#define D_A_COW_H
33

4-
#include "f_op/f_op_actor_mng.h"
4+
#include "d/d_bg_s_acch.h"
5+
#include "d/d_cc_d.h"
6+
#include "d/d_particle_copoly.h"
7+
#include "d/d_path.h"
8+
9+
#define N_COW_COLLIDERS 3
510

611
/**
712
* @ingroup actors-unsorted
8-
* @class daCow_c
13+
* @class c
914
* @brief Ordon Goat
1015
*
1116
* @details
1217
*
1318
*/
1419
class daCow_c : public fopAc_ac_c {
1520
public:
16-
/* 806585CC */ void calcRunAnime(int);
21+
enum Crazy {
22+
Crazy_Wait = 0,
23+
Crazy_Dash = 1,
24+
Crazy_BeforeCatch = 2,
25+
Crazy_Catch = 3,
26+
Crazy_Throw = 4,
27+
Crazy_Attack = 5,
28+
Crazy_Away = 6,
29+
Crazy_End = 7,
30+
Crazy_Back = 8,
31+
};
32+
33+
enum Mode {
34+
Mode_0 = 0,
35+
Mode_1 = 1,
36+
Mode_2 = 2,
37+
Mode_3 = 3,
38+
};
39+
40+
enum Action {
41+
Action_Wait = 0,
42+
Action_NadeNade = 1,
43+
Action_Cry = 2,
44+
Action_3 = 3,
45+
Action_4 = 4,
46+
Action_5 = 5,
47+
Action_6 = 6,
48+
Action_Running = 7,
49+
};
50+
51+
enum Animation {
52+
Animation_5 = 5,
53+
Animation_6 = 6,
54+
Animation_7 = 7,
55+
Animation_8 = 8,
56+
Animation_Eat = 9,
57+
Animation_10 = 10,
58+
Animation_11 = 11,
59+
Animation_12 = 12,
60+
Animation_13 = 13,
61+
Animation_14 = 14,
62+
Animation_Moo = 15,
63+
Animation_16 = 16,
64+
Animation_17 = 17,
65+
Animation_18 = 18,
66+
Animation_Run = 19,
67+
Animation_CrazyDash = 20,
68+
Animation_Shake = 21,
69+
Animation_22 = 22,
70+
Animation_23 = 23,
71+
Animation_24 = 24,
72+
Animation_Walk = 25,
73+
Animation_Wait = 26,
74+
Animation_27 = 27,
75+
Animation_28 = 28,
76+
};
77+
78+
enum RunType {
79+
RunType_None = 0,
80+
RunType_Walk = 1,
81+
RunType_Run = 2,
82+
};
83+
84+
enum Execute {
85+
Execute_0 = 0,
86+
Execute_1 = 1,
87+
Execute_2 = 2,
88+
Execute_3 = 3,
89+
Execute_4 = 4,
90+
Execute_5 = 5,
91+
Execute_6 = 6,
92+
};
93+
94+
enum Flag {
95+
Flag_CrazyBeforeCatch = 1 << 0,
96+
Flag_CrazyCatch = 1 << 1,
97+
Flag_CrazyDash = 1 << 2,
98+
Flag_CrazyThrowLeft = 1 << 3,
99+
Flag_CrazyThrowRight = 1 << 4,
100+
Flag_CrazyReady = 1 << 5,
101+
Flag_CrazyGo = 1 << 6,
102+
Flag_Naderu = 1 << 7,
103+
Flag_NaderuFinish = 1 << 8,
104+
Flag_CrazyReadyDrawOn = 1 << 9,
105+
};
106+
107+
/* 806585CC */ int calcRunAnime(int);
17108
/* 80658730 */ void setBck(int, u8, f32, f32);
18-
/* 806587D4 */ void checkBck(int);
109+
/* 806587D4 */ u8 checkBck(int);
19110
/* 80658830 */ void setEffect();
20-
/* 80658AA4 */ void isChaseCowGame();
111+
/* 80658AA4 */ bool isChaseCowGame();
21112
/* 80658B10 */ void setCarryStatus();
22113
/* 80658C18 */ void setActetcStatus();
23-
/* 80658C78 */ void checkNadeNadeFinish();
24-
/* 80658CA4 */ void checkNadeNade();
114+
/* 80658C78 */ bool checkNadeNadeFinish();
115+
/* 80658CA4 */ bool checkNadeNade();
25116
/* 80658CD0 */ void setSeSnort();
26117
/* 80658D3C */ void setRushVibration(int);
27-
/* 80658DB8 */ void checkThrow();
118+
/* 80658DB8 */ bool checkThrow();
28119
/* 80658E98 */ void setBodyAngle(s16);
29120
/* 80658F94 */ void setBodyAngle2(s16);
30-
/* 806590E8 */ void checkProcess(void (daCow_c::*)());
31-
/* 80659114 */ void setProcess(void (daCow_c::*)(), int);
121+
/* 806590E8 */ BOOL checkProcess(void (daCow_c::*)());
122+
/* 80659114 */ bool setProcess(void (daCow_c::*)(), int);
32123
/* 806591BC */ void damage_check();
33124
/* 8065945C */ void setEnterCow20();
34125
/* 80659540 */ void setEnterCow10();
35126
/* 80659630 */ void setGroundAngle();
36-
/* 80659970 */ void checkRun();
37-
/* 806599C0 */ void checkNearCowRun();
127+
/* 80659970 */ bool checkRun();
128+
/* 806599C0 */ bool checkNearCowRun();
38129
/* 80659ADC */ void action_wait();
39130
/* 8065A0E8 */ void action_eat();
40131
/* 8065A594 */ void action_moo();
41132
/* 8065A8A4 */ void action_shake();
42-
/* 8065ACC8 */ void checkNearWolf();
43-
/* 8065AD2C */ void checkPlayerWait();
44-
/* 8065ADB0 */ void checkPlayerSurprise();
45-
/* 8065AE88 */ void checkPlayerPos();
133+
/* 8065ACC8 */ bool checkNearWolf();
134+
/* 8065AD2C */ bool checkPlayerWait();
135+
/* 8065ADB0 */ bool checkPlayerSurprise();
136+
/* 8065AE88 */ bool checkPlayerPos();
46137
/* 8065B034 */ void checkBeforeBg();
47-
/* 8065B760 */ void checkOutOfGate(cXyz);
48-
/* 8065B8A8 */ void getCowshedAngle();
49-
/* 8065B8D8 */ void getCowshedDist();
50-
/* 8065BA30 */ void checkCowIn(f32, f32);
51-
/* 8065BB34 */ void checkCowInOwn(int);
138+
/* 8065B760 */ int checkOutOfGate(cXyz);
139+
/* 8065B8A8 */ s16 getCowshedAngle();
140+
/* 8065B8D8 */ double getCowshedDist();
141+
/* 8065BA30 */ int checkCowIn(f32, f32);
142+
/* 8065BB34 */ bool checkCowInOwn(int);
52143
/* 8065BC68 */ void action_run();
53-
/* 8065C32C */ void checkCurringPen();
144+
/* 8065C32C */ bool checkCurringPen();
54145
/* 8065C508 */ void setCowInCage();
55146
/* 8065C680 */ void setEnterCount();
56147
/* 8065C70C */ void action_enter();
57148
/* 8065CFBC */ bool isAngry();
58-
/* 8065D03C */ void isGuardFad();
149+
/* 8065D03C */ bool isGuardFad();
59150
/* 8065D0B8 */ void setAngryHit();
60-
/* 8065D17C */ void checkBeforeBgAngry(s16);
151+
/* 8065D17C */ bool checkBeforeBgAngry(s16);
61152
/* 8065D230 */ void setRedTev();
62153
/* 8065D29C */ void setAngryTurn();
63154
/* 8065D2F0 */ void action_angry();
@@ -80,38 +171,114 @@ class daCow_c : public fopAc_ac_c {
80171
/* 8065FE50 */ void action_crazy();
81172
/* 8066010C */ void executeCrazyBack2();
82173
/* 80660544 */ void action_thrown();
83-
/* 806607B8 */ void checkWolfBusters();
174+
/* 806607B8 */ bool checkWolfBusters();
84175
/* 806608F0 */ void action_wolf();
85176
/* 806612DC */ void action_damage();
86177
/* 806613EC */ void action();
87178
/* 80661580 */ void setMtx();
88179
/* 806615EC */ void setAttnPos();
89180
/* 80661720 */ void setCollisions();
90-
/* 80661940 */ void Execute();
91-
/* 80661AF0 */ void CreateHeap();
92-
/* 80661D24 */ void createHeapCallBack(fopAc_ac_c*);
93-
/* 80661D44 */ void initialize();
94-
/* 80662228 */ void create();
95-
/* 80662710 */ void ctrlJoint(J3DJoint*, J3DModel*);
96-
/* 80662920 */ void ctrlJointCallBack(J3DJoint*, int);
97-
/* 8066296C */ void Draw();
98-
/* 80662BE4 */ void Delete();
99-
/* 80662D70 */ void getShapeAngle();
100-
101-
void setNaderu() { field_0x568 |= 0x80; }
102-
void setNaderuFinish() { field_0x568 |= 0x100; }
103-
void setCrazyDash() { field_0x568 |= 4; }
104-
void setCrazyBeforeCatch() { field_0x568 |= 1; }
105-
void setCrazyCatch() { field_0x568 |= 2; }
106-
void setCrazyThrowLeft() { field_0x568 |= 8; }
107-
void setCrazyThrowRight() { field_0x568 |= 0x10; }
181+
/* 80661940 */ int Execute();
182+
/* 80661AF0 */ int CreateHeap();
183+
/* 80661D24 */ static int createHeapCallBack(fopAc_ac_c*);
184+
/* 80661D44 */ u8 initialize();
185+
/* 80662228 */ int create();
186+
/* 80662710 */ int ctrlJoint(J3DJoint*, J3DModel*);
187+
/* 80662920 */ static int ctrlJointCallBack(J3DJoint*, int);
188+
/* 8066296C */ int Draw();
189+
/* 80662BE4 */ int Delete();
190+
// /* 80662D70 */ csXyz getShapeAngle();
191+
csXyz getShapeAngle() { return mSavedAngle; }
192+
193+
void setCowP(daCow_c* cow) { mCowP = cow; }
194+
daCow_c* getCowP() { return mCowP; }
195+
196+
// cLib_onBit<u16>(mFlags, (mask))
197+
void setCrazyBeforeCatch() { mFlags |= Flag_CrazyBeforeCatch; }
198+
void setCrazyCatch() { mFlags |= Flag_CrazyCatch; }
199+
void setCrazyDash() { mFlags |= Flag_CrazyDash; }
200+
void setCrazyThrowLeft() { mFlags |= Flag_CrazyThrowLeft; }
201+
void setCrazyThrowRight() { mFlags |= Flag_CrazyThrowRight; }
202+
void setCrazyReady() { mFlags |= Flag_CrazyReady; }
203+
void setCrazyGo() { mFlags |= Flag_CrazyGo; }
204+
void setNaderu() { mFlags |= Flag_Naderu; }
205+
void setNaderuFinish() { mFlags |= Flag_NaderuFinish; }
206+
void setCrazyReadyDrawOn() { mFlags |= Flag_CrazyReadyDrawOn; }
207+
208+
bool getCowIn() { return mCowIn; }
209+
int getNoNearCheckTimer() const { return mNoNearCheckTimer; }
108210

109211
private:
110-
/* 0x568 */ u16 field_0x568;
111-
/* 0x56A */ u8 field_0x56a[0xD40 - 0x56A];
212+
/* 0x568 */ u16 mFlags;
213+
/* 0x56c */ request_of_phase_process_class mPhase;
214+
/* 0x574 */ mDoExt_McaMorfSO* mpMorf;
215+
/* 0x578 */ mDoExt_btpAnm* mpBtp;
216+
/* 0x57c */ Z2Creature mSound;
217+
/* 0x60c */ dBgS_ObjAcch mAcch;
218+
/* 0x7e4 */ dCcD_Stts mCcStts;
219+
/* 0x820 */ dBgS_AcchCir mAcchCir;
220+
/* 0x860 */ dCcD_Sph mSph[N_COW_COLLIDERS];
221+
/* 0xc08 */ daCow_c* mCowP;
222+
/* 0xc0c */ dPath* mPath;
223+
/* 0xc10 */ s8 mPointIndex;
224+
/* 0xc14 */ cXyz mJointPos;
225+
/* 0xc20 */ cXyz mTarget;
226+
/* 0xc2c */ csXyz mGroundTransform;
227+
/* 0xc32 */ csXyz mSavedAngle;
228+
/* 0xc38 */ csXyz mJoint1Offset;
229+
/* 0xc3e */ csXyz mJoint8Offset;
230+
/* 0xc44 */ f32 mGroundHeight;
231+
/* 0xc48 */ void (daCow_c::*mProcess)();
232+
/* 0xc54 */ int mTimer6;
233+
/* 0xc58 */ int mIdleTimer;
234+
/* 0xc5c */ u16 mMode;
235+
/* 0xc5e */ s8 mRunType;
236+
/* 0xc5f */ u8 mPrm0;
237+
/* 0xc60 */ u8 mExecute;
238+
/* 0xc61 */ u8 mAction;
239+
/* 0xc62 */ u8 mJointIndex;
240+
/* 0xc63 */ bool mIsCrazy;
241+
/* 0xc64 */ u32 mShadowKey;
242+
/* 0xc68 */ u8 mCounter1;
243+
/* 0xc69 */ u8 mISpeed;
244+
/* 0xc6c */ f32 mBoostSpeed;
245+
/* 0xc70 */ s16 mBoostAngle;
246+
/* 0xc72 */ s16 mTargetAngle;
247+
/* 0xc74 */ s16 mTurningSpeed;
248+
/* 0xc76 */ s16 mThrowIntensity;
249+
/* 0xc78 */ f32 mAttentionDistance;
250+
/* 0xc7c */ f32 mSpeed;
251+
/* 0xc80 */ int mInvulnerabilityTimer;
252+
/* 0xc84 */ int mDealDamageTimer;
253+
/* 0xc88 */ int mWaitTimer;
254+
/* 0xc8c */ int mTakenDamageCounter;
255+
/* 0xc90 */ int mTimer1;
256+
/* 0xc94 */ int mForgetCowPTimer;
257+
/* 0xc98 */ int mTimer10;
258+
/* 0xc9c */ u8 mAnimationInterval;
259+
/* 0xc9d */ u8 mOutOfGate;
260+
/* 0xc9e */ u8 mWillGetAngry;
261+
/* 0xc9f */ u8 mCrazy;
262+
/* 0xca0 */ bool mReadyToDash;
263+
/* 0xca1 */ u8 mRunDuration;
264+
/* 0xca2 */ u8 mIntersectedPlanes;
265+
/* 0xca3 */ u8 mRunTimer;
266+
/* 0xca4 */ u8 mNoNearCheckTimer;
267+
/* 0xca5 */ u8 mCowIn;
268+
/* 0xca6 */ bool mDrawOff;
269+
/* 0xca7 */ u8 _unused;
270+
/* 0xca8 */ bool mNadeNade;
271+
/* 0xca9 */ bool mEnterTimerDone;
272+
/* 0xcaa */ u8 mDoAnim6;
273+
/* 0xcac */ f32 mRedTev;
274+
/* 0xcb0 */ f32 mTargetRedTev;
275+
/* 0xcb4 */ u8 mChangeRedTev;
276+
/* 0xcb5 */ u8 mShouldSetEffect;
277+
/* 0xcb8 */ dPaPoT_c mParticle;
278+
/* 0xd38 */ u32 mSmokeKey;
279+
/* 0xd3c */ u32 mSmokeKey2;
112280
};
113281

114282
STATIC_ASSERT(sizeof(daCow_c) == 0xd40);
115283

116-
117284
#endif /* D_A_COW_H */

include/d/actor/d_a_npc_aru.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,15 @@ class daNpc_Aru_c : public fopAc_ac_c {
7474
/* 809575F4 */ s32 getFootLJointNo();
7575
/* 809575FC */ s32 getFootRJointNo();
7676

77+
void setLastIn() { mLastGoatIn = true; }
78+
7779
static void* mCutNameList[7];
7880
static u8 mCutList[84];
7981

8082
private:
81-
/* 0x568 */ u8 field_0x568[0xfd8 - 0x568];
83+
/* 0x568 */ u8 field_0x568[0xfce - 0x568];
84+
/* 0xfce */ bool mLastGoatIn;
85+
/* 0xfcf */ u8 field_0xfce[0xfd8 - 0xfcf];
8286
};
8387

8488
STATIC_ASSERT(sizeof(daNpc_Aru_c) == 0xfd8);
@@ -90,5 +94,4 @@ class daNpc_Aru_Param_c {
9094
static u8 const m[160];
9195
};
9296

93-
9497
#endif /* D_A_NPC_ARU_H */

include/d/actor/d_a_player.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ class daPy_py_c : public fopAc_ac_c {
558558
RFLG0_FRONT_ROLL_CRASH = 0x2000,
559559
RFLG0_ENEMY_ATTN_LOCK = 0x1000,
560560
RFLG0_UNK_400 = 0x400,
561-
RFLG0_UNK_200 = 0x200,
561+
RFLG0_COW_GAME_LEASH = 0x200,
562562
RFLG0_UNK_100 = 0x100,
563563
RFLG0_UNK_80 = 0x80,
564564
RFLG0_UNK_40 = 0x40,
@@ -1106,6 +1106,7 @@ class daPy_py_c : public fopAc_ac_c {
11061106
onNoResetFlg3(FLG3_UNK_200000);
11071107
}
11081108

1109+
BOOL checkCowGameLash() const { return checkResetFlg0(RFLG0_COW_GAME_LEASH); }
11091110
BOOL checkClimbEndHang() { return checkResetFlg0(RFLG0_UNK_40000); }
11101111

11111112
void onForceHorseGetOff() {

include/d/d_com_inf_actor.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class fopAc_ac_c;
55

66
class dComIfGoat_info_c {
77
public:
8-
/* 0x0 */ fopAc_ac_c* field_0x0;
8+
/* 0x0 */ fopAc_ac_c* mThrowActor;
99
};
1010

1111
class dComIfAc_info_c {
@@ -22,7 +22,11 @@ inline bool dComIfA_PauseCheck() {
2222
}
2323

2424
inline fopAc_ac_c* dComIfGoat_GetThrow() {
25-
return g_dComIfGoat_gameInfo.field_0x0;
25+
return g_dComIfGoat_gameInfo.mThrowActor;
26+
}
27+
28+
inline void dComIfGoat_SetThrow(fopAc_ac_c* actor) {
29+
g_dComIfGoat_gameInfo.mThrowActor = actor;
2630
}
2731

2832
#endif /* D_COM_D_COM_INF_ACTOR_H */

0 commit comments

Comments
 (0)