DBG npc_henna and mg_fshop equiv (#3069)

* DBG npc_henna almost, some mg_fshop

* Fix weed_control

* demo_camera_shop OK

* misc dbg symbol/etc fixes

* Fix e_ym/npc_henna dbg bss splits
Thanks @LagoLunatic

* dbg mg_fshop equiv

* PR comments

* DEBUG_CHECK_PAD_TRIG_Z mg_fshop
This commit is contained in:
YunataSavior 2026-01-28 14:19:46 -08:00 committed by GitHub
parent d787afaee0
commit 5812194fad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 639 additions and 520 deletions

View File

@ -14,4 +14,4 @@ d/actor/d_a_e_ym.cpp:
.ctors start:0x00000000 end:0x00000004
.rodata start:0x00000000 end:0x00000164
.data start:0x00000000 end:0x00000624
.bss start:0x00000004 end:0x00000030
.bss start:0x00000000 end:0x00000030

View File

@ -251,7 +251,7 @@ lbl_244_data_300 = .data:0x00000300; // type:object size:0x24
@122156 = .data:0x0000052C; // type:object size:0x11 scope:local data:string
@122157 = .data:0x00000554; // type:object size:0xD scope:local data:string
lbl_244_data_561 = .data:0x00000561; // type:object size:0xC3
lbl_244_bss_0 = .bss:0x00000000; // type:object size:0x1 data:byte
lbl_253_bss_8 = .bss:0x00000000; // type:object size:0x1 scope:local data:byte
l_HIO = .bss:0x00000004; // type:object size:0x24 scope:global data:byte
m_near_obj = .bss:0x00000028; // type:object size:0x4 scope:global data:4byte
m_obj_dist = .bss:0x0000002C; // type:object size:0x4 scope:global align:4 data:float

View File

@ -14,4 +14,4 @@ d/actor/d_a_npc_henna.cpp:
.ctors start:0x00000000 end:0x00000004
.rodata start:0x00000000 end:0x0000030C
.data start:0x00000000 end:0x000004E0
.bss start:0x00000008 end:0x0000014C
.bss start:0x00000000 end:0x0000014C

View File

@ -257,7 +257,7 @@ __RTTI__17daNpc_Henna_HIO_c = .data:0x00000400; // type:object size:0x8 scope:gl
@124836 = .data:0x0000045C; // type:object size:0x11 scope:local data:string
@124837 = .data:0x00000484; // type:object size:0xD scope:local data:string
lbl_79_data_491 = .data:0x00000491; // type:object size:0x4F
lbl_79_bss_0 = .bss:0x00000000; // type:object size:0x1 data:byte
hio_set = .bss:0x00000000; // type:object size:0x1 scope:local data:byte
l_HIO = .bss:0x00000008; // type:object size:0x38 scope:global data:byte
lrl = .bss:0x00000040; // type:object size:0x4 scope:global data:4byte
lbl_79_bss_44 = .bss:0x00000044; // type:object size:0x1 data:byte

View File

@ -18,7 +18,7 @@ struct fs_weed_s {
struct fs_tsubo_s {
/* 0x00 */ cXyz field_0x00;
/* 0x0C */ u8 field_0x0c[0x14 - 0x0c];
/* 0x0C */ csXyz field_0x0c; // unused
/* 0x14 */ J3DModel* model;
/* 0x18 */ u8 field_0x18[0x1C - 0x18];
/* 0x1C */ f32 field_0x1c;
@ -29,7 +29,7 @@ struct fs_tsubo_s {
struct fs_rod_s {
/* 0x00 */ cXyz field_0x00;
/* 0x0C */ u8 field_0x0C[0x14 - 0x0C];
/* 0x0C */ csXyz field_0x0C; // unused
/* 0x14 */ J3DModel* model;
/* 0x18 */ J3DModel* ringModel[6];
/* 0x30 */ mDoExt_3DlineMat0_c line_mat;
@ -41,9 +41,7 @@ struct fs_rod_s {
struct fs_lure_s {
/* 0x00 */ cXyz field_0x00;
/* 0x0C */ s16 field_0x0c;
/* 0x0E */ s16 field_0x0e;
/* 0x10 */ s16 field_0x10;
/* 0x0C */ csXyz field_0x0c;
/* 0x14 */ J3DModel* model;
/* 0x18 */ J3DModel* hookModel[2];
/* 0x20 */ u8 field_0x20[0x24 - 0x20];
@ -113,6 +111,10 @@ public:
/* 0x40B4 */ dBgS_ObjAcch ballAcch;
/* 0x428C */ u8 field_0x428c;
/* 0x428D */ u8 field_0x428d;
#if PLATFORM_SHIELD
u8 unk_dbg_padding[0x6];
J3DModel* dbg_models[2];
#endif
/* 0x4290 */ fs_koro2_s mKoro2[100];
/* 0x6B30 */ J3DModel* canoeModel;
/* 0x6B34 */ s16 field_0x6b34;

View File

@ -26,7 +26,7 @@ public:
/* 0x5BC */ s16 field_0x5bc;
/* 0x5BE */ s16 field_0x5be;
/* 0x5C0 */ dMsgFlow_c mMsgFlow;
/* 0x60C */ u8 field_0x60c[0x618 - 0x60c];
/* 0x60C */ cXyz field_0x60c; // unused
/* 0x618 */ s16 field_0x618;
/* 0x61C */ f32 field_0x61c;
/* 0x620 */ s16 field_0x620;

View File

@ -145,4 +145,11 @@ static const float INF = 2000000000.0f;
#define UNSET_FLAG(var, flag, type) (var) &= ~(flag)
#endif
// potential fakematch?
#if DEBUG
#define FABSF fabsf
#else
#define FABSF std::fabsf
#endif
#endif

View File

@ -139,7 +139,7 @@ int daE_OC_c::ctrlJoint(J3DJoint* i_joint, J3DModel* param_1) {
mDoMtx_stack_c::YrotM(field_0x6d0);
}
param_1->setAnmMtx(jnt_no, mDoMtx_stack_c::get());
mDoMtx_copy(mDoMtx_stack_c::get(), J3DSys::mCurrentMtx);
cMtx_copy(mDoMtx_stack_c::get(), J3DSys::mCurrentMtx);
return 1;
}
@ -1487,22 +1487,26 @@ void daE_OC_c::executeAttack() {
current.pos.x += (my_float - field_0x6a0) * cM_ssin(shape_angle.y);
current.pos.z += (my_float - field_0x6a0) * cM_scos(shape_angle.y);
field_0x6a0 = my_float;
if (mpMorf->isStop()) {
setBck(0x1c, 2, 5.0f, 1.0f);
mSound.startCreatureVoice(Z2SE_EN_OC_V_WAIT_ST, -1);
if (field_0x6e3) {
setActionMode(E_OC_ACTION_MOVE_OUT, 0);
} else {
if (field_0x6ca && fopAcM_searchPlayerDistance(this) < 500.0f) {
if (abs(shape_angle.y - fopAcM_searchPlayerAngleY(this)) < 0x1000) {
mOcState = 0;
break;
}
}
if (!mpMorf->isStop()) {
break;
}
setActionMode(E_OC_ACTION_FIND, 0);
setBck(0x1c, 2, 5.0f, 1.0f);
mSound.startCreatureVoice(Z2SE_EN_OC_V_WAIT_ST, -1);
if (field_0x6e3) {
setActionMode(E_OC_ACTION_MOVE_OUT, 0);
break;
}
if (field_0x6ca && fopAcM_searchPlayerDistance(this) < 500.0f) {
if (abs(shape_angle.y - fopAcM_searchPlayerAngleY(this)) < 0x1000) {
mOcState = 0;
break;
}
}
setActionMode(E_OC_ACTION_FIND, 0);
int _; // forces b in dbg asm
break;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -326,13 +326,6 @@ static void* s_b_sub(void* i_actor, void* i_data) {
static int target_bgc[10];
// FIXME: possible fakematch?
#if DEBUG
#define NPC_KS_FABSF fabsf
#else
#define NPC_KS_FABSF std::fabsf
#endif
static fopAc_ac_c* search_bomb(npc_ks_class* i_this, int param_2) {
fopAc_ac_c* actor = &i_this->actor;
fopAc_ac_c* actor_p;
@ -362,7 +355,7 @@ static fopAc_ac_c* search_bomb(npc_ks_class* i_this, int param_2) {
if (target_bgc[i] != 0 || fopAcM_otherBgCheck(actor, actor_p)) {
target_bgc[i] = 1;
} else if (NPC_KS_FABSF(sp4c.y) <= 300.0f) {
} else if (FABSF(sp4c.y) <= 300.0f) {
s16 sVar1 = actor->shape_angle.y - cM_atan2s(sp4c.x, sp4c.z);
if (sVar1 < 0) {
sVar1 = -1 * sVar1;
@ -448,7 +441,7 @@ static fopAc_ac_c* search_enemy(npc_ks_class* i_this, int param_2, f32 param_3)
if (target_bgc[i] != 0 || fopAcM_otherBgCheck(actor, enemy_p)) {
target_bgc[i] = 1;
} else if (NPC_KS_FABSF(mae.y) <= fVar2) {
} else if (FABSF(mae.y) <= fVar2) {
s16 sVar1 = actor->shape_angle.y - cM_atan2s(mae.x, mae.z);
if (sVar1 < 0) {
sVar1 = -1 * sVar1;
@ -1241,7 +1234,7 @@ static int npc_ks_demo_02(npc_ks_class* i_this) {
cLib_addCalc2(&actor->current.pos.z, ato.z, 1.0f, 10.0f);
cLib_addCalc2(&actor->current.pos.y, i_this->ObjAcch.GetGroundH(), 1.0f, l_HIO.demo_speed);
if (NPC_KS_FABSF(actor->current.pos.y - i_this->ObjAcch.GetGroundH()) < 1.0f) {
if (FABSF(actor->current.pos.y - i_this->ObjAcch.GetGroundH()) < 1.0f) {
anm_init(i_this, 26, 5.0f, 2, 1.0f);
actor->speedF = 0.0f;
i_this->timer[0] = 20;
@ -2709,9 +2702,9 @@ static void demo_camera(npc_ks_class* i_this) {
i_this->field_0xb6c.y = i_this->field_0xb6c.y - 150.0f;
i_this->field_0xb6c.z = saru_p[sw_p->field_0x91c - 2]->actor.current.pos.z;
i_this->field_0xb84.x = NPC_KS_FABSF(i_this->field_0xb6c.x - i_this->demo_eye.x);
i_this->field_0xb84.y = NPC_KS_FABSF(i_this->field_0xb6c.y - i_this->demo_eye.y);
i_this->field_0xb84.z = NPC_KS_FABSF(i_this->field_0xb6c.z - i_this->demo_eye.z);
i_this->field_0xb84.x = FABSF(i_this->field_0xb6c.x - i_this->demo_eye.x);
i_this->field_0xb84.y = FABSF(i_this->field_0xb6c.y - i_this->demo_eye.y);
i_this->field_0xb84.z = FABSF(i_this->field_0xb6c.z - i_this->demo_eye.z);
i_this->field_0xbc4 = 0.0f;
i_this->demo_camera_no = 5;
} else {
@ -3032,12 +3025,12 @@ static void demo_camera(npc_ks_class* i_this) {
i_this->field_0xb6c.set(12772.0f, 3940.0f, 3565.0f);
i_this->field_0xb54.set(13003.0f, 4022.0f, 3613.0f);
i_this->field_0xb78.x = NPC_KS_FABSF(i_this->field_0xb54.x - i_this->demo_way.x);
i_this->field_0xb78.y = NPC_KS_FABSF(i_this->field_0xb54.y - i_this->demo_way.y);
i_this->field_0xb78.z = NPC_KS_FABSF(i_this->field_0xb54.z - i_this->demo_way.z);
i_this->field_0xb84.x = NPC_KS_FABSF(i_this->field_0xb6c.x - i_this->demo_eye.x);
i_this->field_0xb84.y = NPC_KS_FABSF(i_this->field_0xb6c.y - i_this->demo_eye.y);
i_this->field_0xb84.z = NPC_KS_FABSF(i_this->field_0xb6c.z - i_this->demo_eye.z);
i_this->field_0xb78.x = FABSF(i_this->field_0xb54.x - i_this->demo_way.x);
i_this->field_0xb78.y = FABSF(i_this->field_0xb54.y - i_this->demo_way.y);
i_this->field_0xb78.z = FABSF(i_this->field_0xb54.z - i_this->demo_way.z);
i_this->field_0xb84.x = FABSF(i_this->field_0xb6c.x - i_this->demo_eye.x);
i_this->field_0xb84.y = FABSF(i_this->field_0xb6c.y - i_this->demo_eye.y);
i_this->field_0xb84.z = FABSF(i_this->field_0xb6c.z - i_this->demo_eye.z);
i_this->field_0xbc4 = 0.0f;
// fallthrough
case 111:
@ -3104,9 +3097,9 @@ static void demo_camera(npc_ks_class* i_this) {
i_this->demo_way.set(-22672.0f, 311.0f, -15080.0f);
i_this->field_0xb6c.set(-22343.0f, 273.0f, -15017.0f);
i_this->field_0xb78.set(0.0f, 0.0f, 0.0f);
i_this->field_0xb84.x = NPC_KS_FABSF(i_this->field_0xb6c.x - i_this->demo_eye.x);
i_this->field_0xb84.y = NPC_KS_FABSF(i_this->field_0xb6c.y - i_this->demo_eye.y);
i_this->field_0xb84.z = NPC_KS_FABSF(i_this->field_0xb6c.z - i_this->demo_eye.z);
i_this->field_0xb84.x = FABSF(i_this->field_0xb6c.x - i_this->demo_eye.x);
i_this->field_0xb84.y = FABSF(i_this->field_0xb6c.y - i_this->demo_eye.y);
i_this->field_0xb84.z = FABSF(i_this->field_0xb6c.z - i_this->demo_eye.z);
i_this->field_0xbc4 = 0.0f;
/* dSv_event_flag_c::F_0224 - Faron Woods - Flag for lantern guide monkey cutscene */
dComIfGs_onEventBit(u16(dSv_event_flag_c::saveBitLabels[0xE0]));
@ -3314,12 +3307,12 @@ static void demo_camera(npc_ks_class* i_this) {
i_this->field_0xb6c.set(-36574.0f, 421.0f, -21554.0f);
i_this->field_0xb54.set(-36397.0f, 374.0f, -20263.0f);
i_this->field_0xb78.x = NPC_KS_FABSF(i_this->field_0xb54.x - i_this->demo_way.x);
i_this->field_0xb78.y = NPC_KS_FABSF(i_this->field_0xb54.y - i_this->demo_way.y);
i_this->field_0xb78.z = NPC_KS_FABSF(i_this->field_0xb54.z - i_this->demo_way.z);
i_this->field_0xb84.x = NPC_KS_FABSF(i_this->field_0xb6c.x - i_this->demo_eye.x);
i_this->field_0xb84.y = NPC_KS_FABSF(i_this->field_0xb6c.y - i_this->demo_eye.y);
i_this->field_0xb84.z = NPC_KS_FABSF(i_this->field_0xb6c.z - i_this->demo_eye.z);
i_this->field_0xb78.x = FABSF(i_this->field_0xb54.x - i_this->demo_way.x);
i_this->field_0xb78.y = FABSF(i_this->field_0xb54.y - i_this->demo_way.y);
i_this->field_0xb78.z = FABSF(i_this->field_0xb54.z - i_this->demo_way.z);
i_this->field_0xb84.x = FABSF(i_this->field_0xb6c.x - i_this->demo_eye.x);
i_this->field_0xb84.y = FABSF(i_this->field_0xb6c.y - i_this->demo_eye.y);
i_this->field_0xb84.z = FABSF(i_this->field_0xb6c.z - i_this->demo_eye.z);
i_this->field_0xbc4 = 0.0f;
i_this->demo_mode = 352;
i_this->demo_camera_no = 0;
@ -3370,12 +3363,12 @@ static void demo_camera(npc_ks_class* i_this) {
i_this->field_0xb6c.set(-38113.0f, 1234.0f, -22897.0f);
i_this->field_0xb54.set(-37882.0f, 1182.0f, -22713.0f);
i_this->field_0xb78.x = NPC_KS_FABSF(i_this->field_0xb54.x - i_this->demo_way.x);
i_this->field_0xb78.y = NPC_KS_FABSF(i_this->field_0xb54.y - i_this->demo_way.y);
i_this->field_0xb78.z = NPC_KS_FABSF(i_this->field_0xb54.z - i_this->demo_way.z);
i_this->field_0xb84.x = NPC_KS_FABSF(i_this->field_0xb6c.x - i_this->demo_eye.x);
i_this->field_0xb84.y = NPC_KS_FABSF(i_this->field_0xb6c.y - i_this->demo_eye.y);
i_this->field_0xb84.z = NPC_KS_FABSF(i_this->field_0xb6c.z - i_this->demo_eye.z);
i_this->field_0xb78.x = FABSF(i_this->field_0xb54.x - i_this->demo_way.x);
i_this->field_0xb78.y = FABSF(i_this->field_0xb54.y - i_this->demo_way.y);
i_this->field_0xb78.z = FABSF(i_this->field_0xb54.z - i_this->demo_way.z);
i_this->field_0xb84.x = FABSF(i_this->field_0xb6c.x - i_this->demo_eye.x);
i_this->field_0xb84.y = FABSF(i_this->field_0xb6c.y - i_this->demo_eye.y);
i_this->field_0xb84.z = FABSF(i_this->field_0xb6c.z - i_this->demo_eye.z);
i_this->field_0xbc4 = 0.0f;
anm_init(i_this, 39, 5.0f, 2, 1.0f);
i_this->mode = 41;
@ -3412,12 +3405,12 @@ static void demo_camera(npc_ks_class* i_this) {
i_this->field_0xb6c.set(-36467.0f, 426.0f, -20914.0f);
i_this->field_0xb54.set(-36244.0f, 409.0f, -20714.0f);
i_this->field_0xb78.x = NPC_KS_FABSF(i_this->field_0xb54.x - i_this->demo_way.x);
i_this->field_0xb78.y = NPC_KS_FABSF(i_this->field_0xb54.y - i_this->demo_way.y);
i_this->field_0xb78.z = NPC_KS_FABSF(i_this->field_0xb54.z - i_this->demo_way.z);
i_this->field_0xb84.x = NPC_KS_FABSF(i_this->field_0xb6c.x - i_this->demo_eye.x);
i_this->field_0xb84.y = NPC_KS_FABSF(i_this->field_0xb6c.y - i_this->demo_eye.y);
i_this->field_0xb84.z = NPC_KS_FABSF(i_this->field_0xb6c.z - i_this->demo_eye.z);
i_this->field_0xb78.x = FABSF(i_this->field_0xb54.x - i_this->demo_way.x);
i_this->field_0xb78.y = FABSF(i_this->field_0xb54.y - i_this->demo_way.y);
i_this->field_0xb78.z = FABSF(i_this->field_0xb54.z - i_this->demo_way.z);
i_this->field_0xb84.x = FABSF(i_this->field_0xb6c.x - i_this->demo_eye.x);
i_this->field_0xb84.y = FABSF(i_this->field_0xb6c.y - i_this->demo_eye.y);
i_this->field_0xb84.z = FABSF(i_this->field_0xb6c.z - i_this->demo_eye.z);
i_this->field_0xbc4 = 0.0f;
}
i_this->msg_flow.doFlow(actor, NULL, 0);
@ -3943,7 +3936,7 @@ static int npc_ks_option(npc_ks_class* i_this) {
gnd_chk.SetPos(&ato);
ato.y = dComIfG_Bgsp().GroundCross(&gnd_chk);
yuka_jump_x *= -1.0f;
if (NPC_KS_FABSF(ato.y - player->current.pos.y) < 20.0f) {
if (FABSF(ato.y - player->current.pos.y) < 20.0f) {
i_this->mode = 51;
i_this->guide_path = ato;
i_this->field_0x910 = actor->current.pos;
@ -4048,7 +4041,7 @@ static int npc_ks_option(npc_ks_class* i_this) {
fopAc_ac_c* player3 = (fopAc_ac_c*) dComIfGp_getPlayer(0);
if (iVar2 != 0) {
if (NPC_KS_FABSF(player3->current.pos.y - actor->current.pos.y) > 3000.0f ||
if (FABSF(player3->current.pos.y - actor->current.pos.y) > 3000.0f ||
(fopAcM_CheckCondition(actor, 4) != 0 && fopAcM_otherBgCheck(actor, dComIfGp_getPlayer(0)))) {
if (iVar1 != 0 && player3->speedF > 2.0f) {
camera_class* camera = (camera_class*) dComIfGp_getCamera(0);
@ -4063,7 +4056,7 @@ static int npc_ks_option(npc_ks_class* i_this) {
dBgS_GndChk gnd_chk;
gnd_chk.SetPos(&ato);
if (NPC_KS_FABSF(ato.y - dComIfG_Bgsp().GroundCross(&gnd_chk)) < 500.0f) {
if (FABSF(ato.y - dComIfG_Bgsp().GroundCross(&gnd_chk)) < 500.0f) {
actor->current.pos = ato;
actor->old = actor->current;
OS_REPORT("////////KS OP RESET \n");
@ -6441,7 +6434,7 @@ static void action(npc_ks_class* i_this) {
}
}
if (int_0x2c && i_this->dis < 500.0f + KREG_F(15) && NPC_KS_FABSF(actor->current.pos.y - player->current.pos.y) < 1000.0f) {
if (int_0x2c && i_this->dis < 500.0f + KREG_F(15) && FABSF(actor->current.pos.y - player->current.pos.y) < 1000.0f) {
daPy_py_c::setLookPos(&actor->eyePos);
}
@ -6787,9 +6780,9 @@ static int daNpc_Ks_Execute(npc_ks_class* i_this) {
if (i_this->field_0x620 != 0) {
if (i_this->field_0x620 == 1) {
cLib_addCalc2(&obj_pos.x, i_this->field_0x614.x, 1.0f, NPC_KS_FABSF(i_this->field_0x624.x) + 4.0f);
cLib_addCalc2(&obj_pos.y, i_this->field_0x614.y, 1.0f, NPC_KS_FABSF(i_this->field_0x624.y) + 4.0f);
cLib_addCalc2(&obj_pos.z, i_this->field_0x614.z, 1.0f, NPC_KS_FABSF(i_this->field_0x624.z) + 4.0f);
cLib_addCalc2(&obj_pos.x, i_this->field_0x614.x, 1.0f, FABSF(i_this->field_0x624.x) + 4.0f);
cLib_addCalc2(&obj_pos.y, i_this->field_0x614.y, 1.0f, FABSF(i_this->field_0x624.y) + 4.0f);
cLib_addCalc2(&obj_pos.z, i_this->field_0x614.z, 1.0f, FABSF(i_this->field_0x624.z) + 4.0f);
mae.x = obj_pos.x - i_this->field_0x614.x;
mae.z = obj_pos.z - i_this->field_0x614.z;
if ((mae.x * mae.x + mae.z * mae.z) <= 15.0f) {