Skip to content

Commit 3d29429

Browse files
authored
d_a_e_ym, d_a_e_oc, and d_a_npc_hanjo equivalent, d_a_npc_ashB work (#2368)
* d_a_e_ym, d_a_e_oc, and d_a_npc_hanjo equivalent, d_a_npc_ashB work * Updates to PR based on feedback, plus fix debug build
1 parent c6f76e7 commit 3d29429

File tree

10 files changed

+176
-858
lines changed

10 files changed

+176
-858
lines changed

configure.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,7 +1652,7 @@ def MatchingFor(*versions):
16521652
ActorRel(NonMatching, "d_a_e_mm_mt"),
16531653
ActorRel(NonMatching, "d_a_e_ms"),
16541654
ActorRel(NonMatching, "d_a_e_nz"),
1655-
ActorRel(NonMatching, "d_a_e_oc"),
1655+
ActorRel(Equivalent, "d_a_e_oc"),
16561656
ActorRel(MatchingFor("GZ2E01"), "d_a_e_oct_bg"),
16571657
ActorRel(Equivalent, "d_a_e_ot"), # weak func order
16581658
ActorRel(MatchingFor("GZ2E01"), "d_a_e_ph"),
@@ -1689,7 +1689,7 @@ def MatchingFor(*versions):
16891689
ActorRel(NonMatching, "d_a_e_yg"),
16901690
ActorRel(NonMatching, "d_a_e_yh"),
16911691
ActorRel(Equivalent, "d_a_e_yk"), # weak func order
1692-
ActorRel(NonMatching, "d_a_e_ym"),
1692+
ActorRel(Equivalent, "d_a_e_ym"),
16931693
ActorRel(MatchingFor("GZ2E01"), "d_a_e_ym_tag"),
16941694
ActorRel(NonMatching, "d_a_e_ymb"),
16951695
ActorRel(NonMatching, "d_a_e_yr"),
@@ -1752,7 +1752,7 @@ def MatchingFor(*versions):
17521752
ActorRel(NonMatching, "d_a_npc_grz"),
17531753
ActorRel(NonMatching, "d_a_npc_guard"),
17541754
ActorRel(NonMatching, "d_a_npc_gwolf"),
1755-
ActorRel(NonMatching, "d_a_npc_hanjo"),
1755+
ActorRel(Equivalent, "d_a_npc_hanjo"),
17561756
ActorRel(MatchingFor("GZ2E01"), "d_a_npc_henna0"),
17571757
ActorRel(NonMatching, "d_a_npc_hoz"),
17581758
ActorRel(NonMatching, "d_a_npc_impal"),

include/d/actor/d_a_npc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,7 @@ class daNpcF_c : public fopAc_ac_c {
10331033
/* 5 */ LOOK_ATTN,
10341034
};
10351035

1036+
daNpcF_c() { initialize(); }
10361037
/* 80152014 */ BOOL execute();
10371038
/* 801522AC */ int draw(BOOL, BOOL, f32, _GXColorS10*, BOOL);
10381039
/* 80152614 */ static void tgHitCallBack(fopAc_ac_c*, dCcD_GObjInf*, fopAc_ac_c*,
@@ -1091,7 +1092,7 @@ class daNpcF_c : public fopAc_ac_c {
10911092
/* 80155BC8 */ virtual void setParam();
10921093
/* 80155BC0 */ virtual BOOL main();
10931094
/* 80155BD8 */ virtual BOOL ctrlBtk();
1094-
/* 80155BBC */ virtual void adjustShapeAngle();
1095+
/* 80155BBC */ virtual void adjustShapeAngle() {}
10951096
/* 8015276C */ virtual void setMtx();
10961097
/* 801527FC */ virtual void setMtx2();
10971098
/* 80155BB8 */ virtual void setAttnPos();

include/d/actor/d_a_npc_ashB.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ STATIC_ASSERT(sizeof(daNpcAshB_c) == 0xdf0);
137137

138138
class daNpcAshB_Param_c {
139139
public:
140-
/* 80962078 */ virtual ~daNpcAshB_Param_c();
140+
/* 80962078 */ virtual ~daNpcAshB_Param_c() {}
141141

142142
struct param {
143143
/* 0x00 */ f32 mAttnOffsetY;

include/d/actor/d_a_npc_hanjo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class daNpc_Hanjo_c : public daNpcT_c {
179179
static dCcD_SrcGObjInf const mStoneCcDObjInfo;
180180
static char* mCutNameList[6];
181181
static cutFunc mCutList[6];
182-
static u8 mStoneCcDSph[64];
182+
static dCcD_SrcSph mStoneCcDSph;
183183
private:
184184
/* 0x0E40 */ int field_0x0E40;
185185
/* 0x0E44 */ J3DModel* mModel1;

src/d/actor/d_a_e_oc.cpp

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2508,32 +2508,30 @@ static int useHeapInit(fopAc_ac_c* i_this) {
25082508

25092509
/* 80734DA8-807352AC 0088C8 0504+00 1/1 0/0 0/0 .text create__8daE_OC_cFv */
25102510
cPhs__Step daE_OC_c::create() {
2511-
// NONMATCHING. regalloc issue
2512-
f32 mult_val = 100.0f;
2513-
fopAc_ac_c* a_this = this;
25142511
fopAcM_SetupActor(this, daE_OC_c);
25152512
field_0x6b4 = fopAcM_GetParam(this) & 0xff;
25162513
if (field_0x6b4 == 0xff) {
25172514
field_0x6b4 = 0;
25182515
}
2519-
u8 range_sel = (fopAcM_GetParam(this) >> 8 & 0xff);
2520-
if (range_sel == 0x1) {
2516+
2517+
u8 u_var = ((fopAcM_GetParam(this) & 0xff00) >> 8);
2518+
if (u_var == 0x1) {
25212519
mPlayerRange = l_HIO.field_0x0c;
25222520
} else {
25232521
mPlayerRange = l_HIO.field_0x08;
25242522
}
2525-
field_0x6e0 = fopAcM_GetParam(this) >> 0x10;
2523+
field_0x6e0 = (fopAcM_GetParam(this) & 0xff0000) >> 0x10;
25262524
if (field_0x6e0 != 0xff) {
25272525
if (dComIfGs_isSwitch(field_0x6e0, fopAcM_GetRoomNo(this))) {
25282526
return cPhs_ERROR_e;
25292527
}
25302528
}
2531-
field_0x6e1 = fopAcM_GetParam(this) >> 0x18;
2532-
u8 u_var = current.angle.x;
2529+
field_0x6e1 = (fopAcM_GetParam(this) & 0xff000000) >> 0x18;
2530+
u_var = current.angle.x & 0xff;
25332531
if (u_var == 0xff) {
25342532
u_var = 0;
25352533
}
2536-
mMoveRange = mult_val * u_var;
2534+
mMoveRange = 100.0f * u_var;
25372535
u_var = current.angle.x >> 8 & 0xff;
25382536
if (u_var == 0xff || u_var == 0) {
25392537
mName = "E_OC";
@@ -2557,7 +2555,8 @@ cPhs__Step daE_OC_c::create() {
25572555
fopAcM_SetMtx(this, mpMorf->getModel()->getBaseTRMtx());
25582556
fopAcM_SetMin(this, -200.0f, -200.0f, -200.0f);
25592557
fopAcM_SetMax(this, 200.0f, 200.0f, 200.0f);
2560-
mAcch.Set(&current.pos, &old.pos, a_this, 1, &mAcchCir, &speed, NULL, NULL);
2558+
mAcch.Set(fopAcM_GetPosition_p(this), fopAcM_GetOldPosition_p(this), this, 1, &mAcchCir,
2559+
fopAcM_GetSpeed_p(this), NULL, NULL);
25612560
if (0 == strcmp("D_MN05", dComIfGp_getStartStageName())
25622561
&& dComIfGp_getStartStageRoomNo() == 0xc) {
25632562
mAcchCir.SetWallH(95.0f);
@@ -2566,12 +2565,11 @@ cPhs__Step daE_OC_c::create() {
25662565
}
25672566
mAcchCir.SetWallR(100.0f);
25682567
if (mName == "E_OC") {
2569-
health = 40;
2570-
field_0x560 = 40;
2568+
field_0x560 = health = 40;
25712569
} else {
2572-
health = 220;
2573-
field_0x560 = 220;
2570+
field_0x560 = health = 220;
25742571
}
2572+
25752573
mStts.Init(100.0f, 0, this);
25762574
mSphs_cc[0].Set(E_OC_n::cc_sph_src);
25772575
mSphs_cc[0].SetStts(&mStts);
@@ -2593,8 +2591,7 @@ cPhs__Step daE_OC_c::create() {
25932591
mSound.setEnemyName("E_oc");
25942592
mpSound = &mSound;
25952593
field_0xe5a = 1;
2596-
shape_angle.x = 0;
2597-
current.angle.x = 0;
2594+
current.angle.x = shape_angle.x = 0;
25982595
gravity = -5.0f;
25992596
switch (field_0x6b4) {
26002597
case 2:

src/d/actor/d_a_e_ym.cpp

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3227,7 +3227,6 @@ static int useHeapInit(fopAc_ac_c* i_this) {
32273227

32283228
/* 80813EA4-808143A0 00BE64 04FC+00 2/2 0/0 0/0 .text checkBeforeBg__8daE_YM_cFs */
32293229
u8 daE_YM_c::checkBeforeBg(s16 i_rot_val) {
3230-
// NONMATCHING - regalloc
32313230
dBgS_LinChk lin_chk;
32323231
cXyz my_vec_0;
32333232
cXyz my_vec_1;
@@ -3275,16 +3274,15 @@ u8 daE_YM_c::checkBeforeBg(s16 i_rot_val) {
32753274
mDoMtx_stack_c::multVec(&my_vec_0, &my_vec_1);
32763275
my_vec_3 = current.pos + my_vec_1;
32773276
cXyz inside_vec(0.0f, 0.0f, 80.0f);
3278-
cLib_offsetPos(&my_vec_2, &my_vec_3, field_0x668.z, &inside_vec);
3277+
cLib_offsetPos(&my_vec_2, &my_vec_3, (s16)field_0x668.z, &inside_vec);
32793278
lin_chk.Set(&my_vec_3, &my_vec_2, NULL);
32803279
if (dComIfG_Bgsp().LineCross(&lin_chk) == 0) {
32813280
return 1;
32823281
}
32833282
cM3dGPla plane;
32843283
dComIfG_Bgsp().GetTriPla(lin_chk, &plane);
32853284
cXyz* p_vec = plane.GetNP();
3286-
f32 absxz_val = p_vec->absXZ();
3287-
s16 tan_val = cM_atan2s(absxz_val, p_vec->y) + -0x8000;
3285+
s16 tan_val = cM_atan2s(p_vec->absXZ(), p_vec->y) + -0x8000;
32883286
if (abs(tan_val + 0x4000) <= 0x1555) {
32893287
if (field_0x668.z != (s16)(cM_atan2s(p_vec->x, p_vec->z) + 0x8000)) {
32903288
return 1;
@@ -3395,25 +3393,24 @@ void daE_YM_c::setHideType() {
33953393

33963394
/* 80814BA4-80815224 00CB64 0680+00 2/1 0/0 0/0 .text create__8daE_YM_cFv */
33973395
int daE_YM_c::create() {
3398-
// NONMATCHING - regalloc
33993396
fopAcM_SetupActor(this, daE_YM_c);
34003397

34013398
mType = fopAcM_GetParam(this);
34023399
if (mType == 0xFF) {
34033400
mType = 0;
34043401
}
34053402

3406-
mSwitchBit = fopAcM_GetParam(this) >> 0x18;
3403+
mSwitchBit = (fopAcM_GetParam(this) & 0xff000000) >> 24;
34073404

3408-
u8 prm2 = fopAcM_GetParam(this) >> 0x10;
3405+
u8 prm2 = (fopAcM_GetParam(this) & 0xff0000) >> 16;
34093406
if (prm2 == 0xFF) {
34103407
prm2 = 0;
34113408
}
34123409

34133410
field_0x6e0 = prm2 * 100.0f;
34143411

3415-
u8 prm1 = fopAcM_GetParam(this) >> 0x8;
3416-
u8 tmp0 = (current.angle.z >> 8) & 0xff;
3412+
u8 prm1 = (fopAcM_GetParam(this) & 0xff00) >> 8;
3413+
u8 tmp0 = (current.angle.z & 0xff00) >> 8;
34173414
mTagNo = current.angle.z;
34183415
field_0x6a1 = 1;
34193416
if ((current.angle.x & 3) != 0) {
@@ -3424,7 +3421,7 @@ int daE_YM_c::create() {
34243421
field_0x6cb = 1;
34253422
}
34263423

3427-
field_0x6a3 = (current.angle.x >> 8) & 0xff;
3424+
field_0x6a3 = (current.angle.x & 0xff00) >> 8;
34283425

34293426
if (mSwitchBit != 0xFF && dComIfGs_isSwitch(mSwitchBit, fopAcM_GetRoomNo(this))) {
34303427
#ifdef DEBUG
@@ -3448,10 +3445,9 @@ int daE_YM_c::create() {
34483445
}
34493446

34503447
if (phase == cPhs_COMPLEATE_e) {
3451-
current.angle.z = 0;
3452-
current.angle.x = 0;
3453-
shape_angle.z = 0;
3454-
shape_angle.x = 0;
3448+
OS_REPORT("E_YM PARAM %x %x %x \n", fopAcM_GetParam(this), current.angle.z, current.angle.x);
3449+
current.angle.x = current.angle.z = 0;
3450+
shape_angle.x = shape_angle.z = 0;
34553451

34563452
if (!fopAcM_entrySolidHeap(this, useHeapInit, 0x28B0)) {
34573453
return cPhs_ERROR_e;
@@ -3469,12 +3465,11 @@ int daE_YM_c::create() {
34693465
fopAcM_SetMin(this, -200.0f, -100.0f, -200.0f);
34703466
fopAcM_SetMax(this, 200.0f, 100.0f, 200.0f);
34713467

3472-
mAcch.Set(&current.pos, &old.pos, this, 1, &mAcchCir, &speed, NULL, NULL);
3468+
mAcch.Set(fopAcM_GetPosition_p(this), fopAcM_GetOldPosition_p(this), this, 1, &mAcchCir,
3469+
fopAcM_GetSpeed_p(this), NULL, NULL);
34733470
mAcch.OnLineCheck();
34743471
mAcchCir.SetWall(30.0f, 60.0f);
3475-
3476-
health = 10;
3477-
field_0x560 = 10;
3472+
field_0x560 = health = 10;
34783473

34793474
mStts.Init(100, 0, this);
34803475
mSphCc.Set(E_YM_n::cc_sph_src);

src/d/actor/d_a_npc.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5188,11 +5188,6 @@ void daNpcF_c::setAttnPos() {
51885188
/* empty function */
51895189
}
51905190

5191-
/* 80155BBC-80155BC0 1504FC 0004+00 2/0 0/0 0/0 .text adjustShapeAngle__8daNpcF_cFv */
5192-
void daNpcF_c::adjustShapeAngle() {
5193-
/* empty function */
5194-
}
5195-
51965191
/* 80155BC0-80155BC8 150500 0008+00 2/0 0/0 0/0 .text main__8daNpcF_cFv */
51975192
BOOL daNpcF_c::main() {
51985193
return true;

0 commit comments

Comments
 (0)