Skip to content

Commit bc94559

Browse files
authored
d_a_npc_ks work (#2461)
* Initial work * Work on ori2 and others * Work on npc_ks_home * Work on npc_ks_demo_022 * Chugging through * Started on demo_camera * More demo_camera work * 51% equivalent * General cleanup * Fixed compile error in d_a_e_mk * Small d_a_e_mk fix * d_a_e_fs fix * PR cleanup * Started work on d_a_obj_sw
1 parent 6fd5560 commit bc94559

File tree

11 files changed

+4356
-3332
lines changed

11 files changed

+4356
-3332
lines changed

include/d/actor/d_a_npc_ks.h

Lines changed: 132 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#define D_A_NPC_KS_H
33

44
#include "d/actor/d_a_npc.h"
5+
#include "d/actor/d_a_obj_so.h"
6+
#include "d/actor/d_a_obj_sw.h"
57

68
/**
79
* @ingroup actors-npcs
@@ -11,23 +13,146 @@
1113
* @details
1214
*
1315
*/
14-
class npc_ks_class : public fopAc_ac_c {
16+
class npc_ks_class {
1517
public:
16-
/* 0x568 */ u8 field_0x568[0x5b6 - 0x568];
18+
/* 0x000 */ fopAc_ac_c actor;
19+
/* 0x568 */ u8 field_0x568[0x570 - 0x568];
20+
/* 0x570 */ u8 field_0x570;
21+
/* 0x571 */ u8 field_0x571[0x5b4 - 0x571];
22+
/* 0x5B4 */ u8 mRoomMonkeyID;
23+
/* 0x5B5 */ u8 field_0x5b5;
1724
/* 0x5B6 */ u8 field_0x5b6;
18-
/* 0x5B7 */ u8 field_0x5b7[0x5c8 - 0x5b7];
25+
/* 0x5B7 */ u8 field_0x5b7;
26+
/* 0x5B8 */ int field_0x5b8;
27+
/* 0x5BC */ int field_0x5bc;
28+
/* 0x5C0 */ char* mResName;
29+
/* 0x5C4 */ f32 field_0x5c4;
1930
/* 0x5C8 */ s16 field_0x5c8;
20-
/* 0x5CA */ u8 field_0x5ca[0x5ea - 0x5ca];
31+
/* 0x5CC */ mDoExt_McaMorfSO* mpModelMorf;
32+
/* 0x5D0 */ int field_0x5d0;
33+
/* 0x5D4 */ f32 field_0x5d4;
34+
/* 0x5D8 */ mDoExt_btpAnm* mBtp1;
35+
/* 0x5DC */ mDoExt_btpAnm* mBtp2;
36+
/* 0x5E0 */ s16 field_0x5e0;
37+
/* 0x5E2 */ u8 field_0x5e2[2];
38+
/* 0x5E4 */ s8 field_0x5e4;
39+
/* 0x5E5 */ u8 field_0x5e5;
40+
/* 0x5E6 */ s16 field_0x5e6;
41+
/* 0x5E8 */ s16 mActionID;
2142
/* 0x5EA */ s16 mMode;
22-
/* 0x5EC */ u8 field_0x5ec[0xc20 - 0x5ec];
43+
/* 0x5EC */ u32 mShadowKey;
44+
/* 0x5F0 */ s16 mTimers[4];
45+
/* 0x5F8 */ s16 field_0x5f8;
46+
/* 0x5FA */ s16 field_0x5fa;
47+
/* 0x5FC */ s8 field_0x5fc;
48+
/* 0x5FD */ u8 field_0x5fd;
49+
/* 0x5FE */ s16 field_0x5fe;
50+
/* 0x600 */ s16 field_0x600;
51+
/* 0x602 */ s16 field_0x602;
52+
/* 0x604 */ s16 field_0x604;
53+
/* 0x606 */ s16 field_0x606;
54+
/* 0x608 */ s16 field_0x608;
55+
/* 0x60C */ f32 field_0x60c;
56+
/* 0x610 */ s16 field_0x610;
57+
/* 0x614 */ cXyz field_0x614;
58+
/* 0x620 */ s8 field_0x620;
59+
/* 0x621 */ u8 field_0x621;
60+
/* 0x622 */ u8 field_0x622;
61+
/* 0x623 */ u8 field_0x623;
62+
/* 0x624 */ cXyz field_0x624;
63+
/* 0x630 */ int field_0x630;
64+
/* 0x634 */ f32 field_0x634;
65+
/* 0x638 */ f32 field_0x638;
66+
/* 0x63C */ f32 field_0x63c;
67+
/* 0x640 */ dBgS_AcchCir mAcchCir;
68+
/* 0x680 */ dBgS_ObjAcch mObjAcch;
69+
/* 0x858 */ u32 field_0x858;
70+
/* 0x85C */ u32 field_0x85c;
71+
/* 0x860 */ Z2Creature mSound;
72+
/* 0x8F0 */ cXyz field_0x8f0;
73+
/* 0x8FC */ csXyz field_0x8fc;
74+
/* 0x904 */ int field_0x904;
75+
/* 0x908 */ f32 field_0x908;
76+
/* 0x90C */ s8 field_0x90c;
77+
/* 0x910 */ cXyz field_0x910;
78+
/* 0x91C */ cXyz field_0x91c;
79+
/* 0x928 */ f32 field_0x928;
80+
/* 0x92C */ s8 field_0x92c;
81+
/* 0x930 */ void* field_0x930;
82+
/* 0x934 */ obj_sw_class* field_0x934;
83+
/* 0x938 */ fpc_ProcID field_0x938;
84+
/* 0x93C */ int field_0x93c;
85+
/* 0x940 */ cXyz field_0x940;
86+
/* 0x94C */ s16 field_0x94c;
87+
/* 0x94E */ s16 field_0x94e;
88+
/* 0x950 */ dCcD_Stts mStts;
89+
/* 0x98C */ dCcD_Cyl field_0x98c;
90+
/* 0xAC8 */ u8 field_0xac8[0xaec - 0xac8];
91+
/* 0xAEC */ s8 field_0xaec;
92+
/* 0xAED */ u8 field_0xaed[0xaf4 - 0xaed];
93+
/* 0xAF4 */ dMsgFlow_c mMsgFlow;
94+
/* 0xB40 */ u8 field_0xb40;
95+
/* 0xB41 */ u8 field_0xb41;
96+
/* 0xB42 */ s16 field_0xb42;
97+
/* 0xB44 */ s16 field_0xb44;
98+
/* 0xB48 */ cXyz field_0xb48;
99+
/* 0xB54 */ cXyz field_0xb54;
100+
/* 0xB60 */ cXyz field_0xb60;
101+
/* 0xB6C */ cXyz field_0xb6c;
102+
/* 0xB78 */ cXyz field_0xb78;
103+
/* 0xB84 */ cXyz field_0xb84;
104+
/* 0xB90 */ u8 field_0xb90[0xba8 - 0xb90];
105+
/* 0xBA8 */ cXyz field_0xba8;
106+
/* 0xBB4 */ f32 field_0xbb4;
107+
/* 0xBB8 */ f32 field_0xbb8;
108+
/* 0xBBC */ u8 field_0xbbc[0xbc0 - 0xbbc];
109+
/* 0xBC0 */ npc_ks_class* field_0xbc0;
110+
/* 0xBC4 */ f32 field_0xbc4;
111+
/* 0xBC8 */ cXyz field_0xbc8;
112+
/* 0xBD4 */ s16 field_0xbd4;
113+
/* 0xBD6 */ u8 field_0xbd6;
114+
/* 0xBD7 */ s8 field_0xbd7;
115+
/* 0xBD8 */ s8 field_0xbd8;
116+
/* 0xBD9 */ s8 field_0xbd9;
117+
/* 0xBDA */ u8 field_0xbda;
118+
/* 0xBDB */ s8 field_0xbdb;
119+
/* 0xBDC */ s8 field_0xbdc;
120+
/* 0xBDD */ s8 field_0xbdd;
121+
/* 0xBDE */ s16 field_0xbde;
122+
/* 0xBE0 */ s8 field_0xbe0;
123+
/* 0xBE4 */ u32 field_0xbe4[4];
124+
/* 0xBF4 */ u32 field_0xbf4;
125+
/* 0xBF8 */ u8 field_0xbf8[0xbfc - 0xbf8];
126+
/* 0xBFC */ J3DModel* field_0xbfc;
127+
/* 0xC00 */ J3DModel* field_0xc00;
128+
/* 0xC04 */ cXyz field_0xc04;
129+
/* 0xC10 */ u8 field_0xc10[0xc17 - 0xc10];
130+
/* 0xC17 */ s8 field_0xc17;
131+
/* 0xC18 */ u8 field_0xc18[0xc20 - 0xc18];
23132
};
24133

25134
STATIC_ASSERT(sizeof(npc_ks_class) == 0xc20);
26135

27-
class daNpc_Ks_HIO_c {
136+
class daNpc_Ks_HIO_c : public JORReflexible {
28137
public:
29138
/* 80A48F8C */ daNpc_Ks_HIO_c();
30-
/* 80A5DA90 */ ~daNpc_Ks_HIO_c();
139+
/* 80A5DA90 */ virtual ~daNpc_Ks_HIO_c() {};
140+
141+
void genMessage(JORMContext*);
142+
143+
/* 0x04 */ s8 field_0x4;
144+
/* 0x08 */ f32 field_0x8;
145+
/* 0x0C */ f32 field_0xc;
146+
/* 0x10 */ f32 field_0x10;
147+
/* 0x14 */ f32 field_0x14;
148+
/* 0x18 */ f32 field_0x18;
149+
/* 0x1C */ f32 field_0x1c;
150+
/* 0x20 */ f32 field_0x20;
151+
/* 0x24 */ f32 field_0x24;
152+
/* 0x28 */ u8 field_0x28;
153+
/* 0x2C */ f32 field_0x2c;
154+
/* 0x30 */ f32 field_0x30;
155+
/* 0x34 */ f32 field_0x34;
31156
};
32157

33158

include/d/actor/d_a_obj_so.h

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,32 @@
1212
*
1313
*/
1414
class obj_so_class : public fopAc_ac_c {
15-
private:
16-
/* 0x568 */ u8 field_0x568[0x1bd0 - 0x568];
15+
public:
16+
/* 0x0568 */ u8 field_0x568[0x8fc - 0x568];
17+
/* 0x08FC */ f32 field_0x8fc;
18+
/* 0x0900 */ f32 field_0x900;
19+
/* 0x0904 */ u8 field_0x904[0x91c - 0x904];
20+
/* 0x091C */ int field_0x91c;
21+
/* 0x0920 */ cXyz field_0x920[12];
22+
/* 0x09B0 */ u8 field_0x9b0[0xdac - 0x9b0];
23+
/* 0x0DAC */ s16 field_0xdac;
24+
/* 0x0DAE */ s16 field_0xdae;
25+
/* 0x0DB0 */ u8 field_0xdb0[0xdc4 - 0xdb0];
26+
/* 0x0DC4 */ s8 field_0xdc4;
27+
/* 0x0DC5 */ u8 field_0xdc5[0xdc8 - 0xdc5];
28+
/* 0x0DC8 */ f32 field_0xdc8;
29+
/* 0x0DCC */ u8 field_0xdcc[0x1054 - 0xdcc];
30+
/* 0x1054 */ s8 field_0x1054;
31+
/* 0x1055 */ u8 field_0x1055[0x1a98 - 0x1055];
32+
/* 0x1A98 */ s8 field_0x1a98[7];
33+
/* 0x1A9F */ u8 field_0x1a9f[0x1bd0 - 0x1a9f];
34+
35+
bool partBreak() {
36+
for (int i = 0; i < 8; i++) {
37+
if (field_0x1a98[i] == 2) return 1;
38+
}
39+
return 0;
40+
}
1741
};
1842

1943
STATIC_ASSERT(sizeof(obj_so_class) == 0x1bd0);

include/d/actor/d_a_obj_sw.h

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,63 @@
1111
* @details
1212
*
1313
*/
14-
class obj_sw_class : public fopAc_ac_c {
15-
private:
16-
/* 0x568 */ u8 field_0x568[0xd90 - 0x568];
17-
};
18-
19-
STATIC_ASSERT(sizeof(obj_sw_class) == 0xd90);
2014

2115
struct obj_sc_s {
2216
public:
2317
/* 80CF2F3C */ ~obj_sc_s();
2418
/* 80CF2FA8 */ obj_sc_s();
19+
20+
/* 0x00 */ s8 field_0x0;
21+
/* 0x01 */ u8 field_0x1[0x4 - 0x1];
22+
/* 0x04 */ cXyz field_0x4;
23+
/* 0x10 */ cXyz field_0x10;
24+
/* 0x1C */ cXyz field_0x1c;
25+
/* 0x28 */ s16 field_0x28;
26+
/* 0x2A */ s16 field_0x2a;
27+
/* 0x2C */ s16 field_0x2c;
28+
/* 0x2E */ u8 field_0x2e[0x30 - 0x2e];
29+
/* 0x30 */ f32 field_0x30;
30+
/* 0x34 */ s8 field_0x34;
31+
/* 0x35 */ s8 field_0x35;
32+
/* 0x36 */ u8 field_0x36[0x38 - 0x36];
33+
/* 0x38 */ int field_0x38;
34+
/* 0x3C */ int field_0x3c;
35+
/* 0x40 */ mDoExt_McaMorf* mpModelMorf;
36+
/* 0x44 */ Z2SoundObjSimple mSound;
37+
/* 0x64 */ J3DModel* mpModel;
38+
/* 0x68 */ s16 field_0x68;
39+
// + 2 bytes of padding
2540
};
2641

42+
class obj_sw_class {
43+
public:
44+
/* 0x000 */ fopAc_ac_c actor;
45+
/* 0x568 */ u8 field_0x568[0x570 - 0x568];
46+
/* 0x570 */ u8 field_0x570;
47+
/* 0x571 */ u8 field_0x571[0x576 - 0x571];
48+
/* 0x576 */ s16 field_0x576;
49+
/* 0x578 */ u8 field_0x578[0x57a - 0x578];
50+
/* 0x57A */ s16 field_0x57a;
51+
/* 0x57C */ s16 field_0x57c;
52+
/* 0x57E */ s16 field_0x57e;
53+
/* 0x580 */ s16 field_0x580;
54+
/* 0x582 */ s16 field_0x582;
55+
/* 0x584 */ u8 field_0x584[0x5a8 - 0x584];
56+
/* 0x5A8 */ obj_sc_s field_0x5a8;
57+
/* 0x614 */ cXyz field_0x614;
58+
/* 0x620 */ u8 field_0x620[0x864 - 0x620];
59+
/* 0x864 */ obj_sc_s field_0x864;
60+
/* 0x8D0 */ u8 field_0x8d0[0x8fc - 0x8d0];
61+
/* 0x8FC */ f32 field_0x8fc;
62+
/* 0x900 */ f32 field_0x900;
63+
/* 0x904 */ cXyz field_0x904[2];
64+
/* 0x91C */ int field_0x91c;
65+
/* 0x920 */ cXyz field_0x920[12];
66+
/* 0x9B0 */ u8 field_0x9b0[0xd50 - 0x9b0];
67+
/* 0xD50 */ mDoExt_3DlineMat1_c field_0xd50;
68+
/* 0xD8C */ int field_0xd8c;
69+
};
70+
71+
STATIC_ASSERT(sizeof(obj_sw_class) == 0xd90);
2772

2873
#endif /* D_A_OBJ_SW_H */

include/d/actor/d_a_player.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ class daPy_py_c : public fopAc_ac_c {
10701070
mDemo.setParam2(i_param2);
10711071
}
10721072

1073-
void changeDemoParam0(s16 i_param1) {
1073+
void changeDemoParam0(int i_param1) {
10741074
mDemo.setParam0(i_param1);
10751075
}
10761076

@@ -1156,6 +1156,8 @@ class daPy_py_c : public fopAc_ac_c {
11561156

11571157
void setGiantPuzzle() { mSpecialMode = SMODE_WOLF_PUZZLE; }
11581158
void setGiantPuzzleEnd() { mSpecialMode = 0; }
1159+
1160+
BOOL checkAutoJumpStart() { return checkResetFlg0(RFLG0_UNK_100); }
11591161
};
11601162

11611163
int daPy_addCalcShort(s16* param_0, s16 param_1, s16 param_2, s16 param_3, s16 param_4);

include/d/d_com_inf_game.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,7 @@ u8 dComIfGs_checkGetInsectNum();
10571057
u8 dComIfGs_getSelectMixItemNoArrowIndex(int i_selmixItemIdx);
10581058
BOOL dComIfGs_isStageTbox(int i_stageNo, int i_no);
10591059
s8 dComIfGs_PolyDamageOff_Check();
1060+
void dComIfGs_shake_kandelaar();
10601061
void dComIfGs_Grass_hide_Set(s8 param_0);
10611062
void dComIfGs_onGetMagicUseFlag();
10621063
void dComIfG_playerStatusD();

include/d/d_meter2_info.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,10 @@ inline u16 dMeter2Info_getOilGaugeBackUp() {
356356
return g_meter2_info.getOilGaugeBackUp();
357357
}
358358

359+
inline void dMeter2Info_setOilGaugeBackUp(u16 param_1) {
360+
g_meter2_info.mOilGaugeBackUp = param_1;
361+
}
362+
359363
inline void dMeter2Info_setSaveStageName(const char* i_stageName) {
360364
g_meter2_info.setSaveStageName(i_stageName);
361365
}

include/d/d_stage.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,7 @@ class dStage_roomControl_c {
10931093
static s8 getRoomReadId() { return mRoomReadId; }
10941094
static void offNoChangeRoom() { mNoChangeRoom = false; }
10951095
static void onNoChangeRoom() { mNoChangeRoom = true; }
1096+
static s8 getNextStayNo() { return mNextStayNo; }
10961097
static void setProcID(u32 id) { mProcID = id; }
10971098
static u32 getProcID() { return mProcID; }
10981099
static void setStatusProcID(int i_roomNo, fpc_ProcID i_id) { mStatus[i_roomNo].mProcID = i_id; }

src/d/actor/d_a_e_fs.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,6 @@ static bool checkViewArea(cXyz* i_pos) {
478478
}
479479

480480
/* 806BCE5C-806BD0A8 00147C 024C+00 2/1 0/0 0/0 .text e_fs_demowait__FP10e_fs_class */
481-
// NONMATCHING regalloc
482481
static void e_fs_demowait(e_fs_class* i_this) {
483482
cXyz delta;
484483
npc_ks_class* monkey = (npc_ks_class*)fopAcM_SearchByName(PROC_NPC_KS);
@@ -499,8 +498,8 @@ static void e_fs_demowait(e_fs_class* i_this) {
499498
break;
500499

501500
case 2:
502-
delta.x = monkey->current.pos.x - i_this->current.pos.x;
503-
delta.z = monkey->current.pos.z - i_this->current.pos.z;
501+
delta.x = monkey->actor.current.pos.x - i_this->current.pos.x;
502+
delta.z = monkey->actor.current.pos.z - i_this->current.pos.z;
504503
i_this->mTargetAngleY = cM_atan2s(delta.x, delta.z);
505504
if (i_this->mAcch.ChkGroundHit()) {
506505
i_this->mpMorf->setPlaySpeed(1.0f);

0 commit comments

Comments
 (0)