From 0b75cd4ed722cbfd0cffeea398e3d634719d2276 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Wed, 24 Apr 2024 15:45:16 -0400 Subject: [PATCH] d_a_npc_roten 100%, weak order not matched --- include/d/actor/d_a_npc_roten.h | 2 +- src/d/actor/d_a_npc_ji1.cpp | 6 +++++- src/d/actor/d_a_npc_roten.cpp | 36 ++++++++++++++++----------------- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/include/d/actor/d_a_npc_roten.h b/include/d/actor/d_a_npc_roten.h index fc9fd7d44..bbeb7af7f 100644 --- a/include/d/actor/d_a_npc_roten.h +++ b/include/d/actor/d_a_npc_roten.h @@ -131,7 +131,7 @@ public: /* 0x9C1 */ u8 field_0x9C1; /* 0x9C2 */ s8 field_0x9C2; /* 0x9C3 */ s8 field_0x9C3; - /* 0x9C4 */ u8 field_0x9C4; + /* 0x9C4 */ s8 field_0x9C4; /* 0x9C5 */ u8 field_0x9C5; /* 0x9C6 */ u8 field_0x9C6; /* 0x9C7 */ u8 field_0x9C7; diff --git a/src/d/actor/d_a_npc_ji1.cpp b/src/d/actor/d_a_npc_ji1.cpp index 73f327aeb..9ebcc4b3f 100644 --- a/src/d/actor/d_a_npc_ji1.cpp +++ b/src/d/actor/d_a_npc_ji1.cpp @@ -330,7 +330,11 @@ BOOL daNpc_Ji1_c::isClearRecord(s16 param_1) { } u8 level = dComIfGs_getEventReg(0xD003); - return param_1 >= l_HIO.field_0x60[level] ? TRUE : FALSE; // has a clrlwi without the ternary + TRUE/FALSE macros + if (param_1 >= l_HIO.field_0x60[level]) { + return TRUE; + } + + return FALSE; } /* 00000630-000006F8 .text setClearRecord__11daNpc_Ji1_cFs */ diff --git a/src/d/actor/d_a_npc_roten.cpp b/src/d/actor/d_a_npc_roten.cpp index 686562f7e..23f6eadd6 100644 --- a/src/d/actor/d_a_npc_roten.cpp +++ b/src/d/actor/d_a_npc_roten.cpp @@ -1348,7 +1348,7 @@ static u32 l_msg_try_force[] = { }; static u32 l_get_item_no[] = { - 0x7, + KAKERA_HEART, }; static dCcD_SrcSph l_sph_src = { @@ -1631,13 +1631,11 @@ s32 daNpcRoten_c::_create() { /* 00000A24-00000E88 .text createHeap__12daNpcRoten_cFv */ BOOL daNpcRoten_c::createHeap() { - /* Nonmatching - regalloc */ - - J3DModelData* modelData = static_cast(dComIfG_getObjectIDRes(l_arcname_tbl[mNpcNo], l_bmd_ix_tbl[mNpcNo])); + J3DModelData* modelData = (J3DModelData*)(dComIfG_getObjectIDRes(l_arcname_tbl[mNpcNo], l_bmd_ix_tbl[mNpcNo])); mpMorf = new mDoExt_McaMorf( modelData, NULL, NULL, - static_cast(dComIfG_getObjectIDRes(l_arcname_tbl[mNpcNo], l_bck_ix_tbl[mNpcNo][field_0x9C0])), + (J3DAnmTransformKey*)(dComIfG_getObjectIDRes(l_arcname_tbl[mNpcNo], l_bck_ix_tbl[mNpcNo][field_0x9C0])), J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, 0, -1, 1, NULL, 0x00080000, @@ -1648,11 +1646,11 @@ BOOL daNpcRoten_c::createHeap() { return false; } - J3DModelData* headModelData = static_cast(dComIfG_getObjectIDRes(l_arcname_tbl[mNpcNo], l_head_bmd_ix_tbl[mNpcNo])); + J3DModelData* headModelData = (J3DModelData*)(dComIfG_getObjectIDRes(l_arcname_tbl[mNpcNo], l_head_bmd_ix_tbl[mNpcNo])); field_0x6D8 = new mDoExt_McaMorf( headModelData, NULL, NULL, - static_cast(dComIfG_getObjectIDRes(l_arcname_tbl[mNpcNo], l_head_bck_ix_tbl[mNpcNo])), + (J3DAnmTransformKey*)(dComIfG_getObjectIDRes(l_arcname_tbl[mNpcNo], l_head_bck_ix_tbl[mNpcNo])), J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, 0, -1, 1, NULL, 0x00080000, @@ -1699,7 +1697,6 @@ static s16 daNpcRoten_XyEventCB(void* i_this, int param_1) { /* 00000EA8-000011C8 .text createInit__12daNpcRoten_cFv */ s32 daNpcRoten_c::createInit() { - /* Nonmatching */ int weight = 0xFF; if(getPrmRailID() != 0xFF) { mPathRun.setInf(getPrmRailID(), fopAcM_GetRoomNo(this), true); @@ -2282,7 +2279,8 @@ bool daNpcRoten_c::eventMesSet() { void daNpcRoten_c::eventSetItemInit() { u8 itemIdx = l_item_dat[mNpcNo][field_0x9BE]; cXyz pos(0.0f, 0.0f, 0.0f); - field_0x6F8 = fopAcM_createItemForPresentDemo(&pos, (u8)(itemIdx + FLOWER_1), 9, -1, fopAcM_GetRoomNo(this)); // fakematch with the cast? + u8 itemNo = itemIdx + FLOWER_1; + field_0x6F8 = fopAcM_createItemForPresentDemo(&pos, itemNo, 9, -1, fopAcM_GetRoomNo(this)); } /* 000028C4-0000290C .text eventSetItem__12daNpcRoten_cFv */ @@ -2313,20 +2311,22 @@ void daNpcRoten_c::eventClrItemInit() { /* 00002978-00002A70 .text eventGetItemInit__12daNpcRoten_cFi */ void daNpcRoten_c::eventGetItemInit(int staffIdx) { - /* Nonmatching */ - uint pcId; u32* pData = dComIfGp_evmng_getMyIntegerP(staffIdx, "ItemNo"); if(pData != NULL) { - pcId = fopAcM_createItemForPresentDemo(¤t.pos, l_get_item_no[*pData], 0, -1, current.roomNo); + u32 itemNo = *pData; // fakematch? + itemNo = l_get_item_no[itemNo]; + pcId = fopAcM_createItemForPresentDemo(¤t.pos, itemNo, 0, -1, fopAcM_GetRoomNo(this)); } else { - u8 itemIdx = l_item_dat[mNpcNo][field_0x9BE]; - dComIfGs_onGetItemReserve(itemIdx); + u8 temp = l_item_dat[mNpcNo][field_0x9BE]; + u32 itemIdx = temp; // fakematch? + dComIfGs_onGetItemReserve(temp); - u8 itemNo = itemIdx + FLOWER_1; - pcId = fopAcM_createItemForPresentDemo(¤t.pos, itemNo, 1, -1, current.roomNo); + u8 itemNo = FLOWER_1; + itemNo += itemIdx; // fakematch? + pcId = fopAcM_createItemForPresentDemo(¤t.pos, itemNo, 1, -1, fopAcM_GetRoomNo(this)); } if(pcId != fpcM_ERROR_PROCESS_ID_e) { @@ -2645,8 +2645,6 @@ void daNpcRoten_c::chkAttention() { /* 00003558-000036A4 .text lookBack__12daNpcRoten_cFv */ void daNpcRoten_c::lookBack() { - /* Nonmatching */ - cXyz temp4; s16 temp1 = field_0x9AC; s16 targetY = current.angle.y; @@ -2655,6 +2653,8 @@ void daNpcRoten_c::lookBack() { bool temp3 = field_0x99C; switch(field_0x9C4) { + case 0: + break; case 1: temp4 = field_0x708; dstPos = &temp4;