Improve several almost-matching TUs (#2653)

This commit is contained in:
Max Roncace
2025-09-13 16:02:28 -04:00
committed by GitHub
parent 4c9ce97f3e
commit dbbd102db5
17 changed files with 405 additions and 412 deletions
+142 -134
View File
@@ -355,25 +355,30 @@ int daNpc_Saru_c::create() {
/* 80AC082C-80AC0A54 0004EC 0228+00 1/1 0/0 0/0 .text CreateHeap__12daNpc_Saru_cFv */
int daNpc_Saru_c::CreateHeap() {
// NONMATCHING
static int const bmdTypeList[2] = {
2, 3,
};
u32 uVar1 = mTwilight == true;
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_resNameList[l_bmdData[uVar1][1]], l_bmdData[uVar1][0]);
void* modelData = NULL;
J3DModel* model = NULL;
BOOL uVar1 = mTwilight == true ? TRUE : FALSE;
int arcNameIdx = l_bmdData[uVar1][1];
int resName = l_bmdData[uVar1][0];
modelData = dComIfG_getObjectRes(l_resNameList[arcNameIdx], resName);
if (modelData == NULL) {
return 0;
}
mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL,
NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020084);
u32 temp1 = 0x11020084;
mpMorf[0] = new mDoExt_McaMorfSO((J3DModelData*)modelData, NULL,
NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, temp1);
if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) {
return 0;
}
J3DModel* model = mpMorf[0]->getModel();
for (u16 i = 0; i < modelData->getJointNum(); i++) {
modelData->getJointNodePointer(i)->setCallBack(ctrlJointCallBack);
model = mpMorf[0]->getModel();
model = mpMorf[0]->getModel();
for (u16 i = 0; i < ((J3DModelData*)modelData)->getJointNum(); i++) {
((J3DModelData*)modelData)->getJointNodePointer(i)->setCallBack(ctrlJointCallBack);
}
model->setUserArea((uintptr_t)this);
@@ -386,7 +391,7 @@ int daNpc_Saru_c::CreateHeap() {
}
if (modelData != NULL) {
mpRoseModels[i] = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084);
mpRoseModels[i] = mDoExt_J3DModel__create((J3DModelData*)modelData, 0x80000, 0x11000084);
} else {
mpRoseModels[i] = NULL;
}
@@ -486,7 +491,6 @@ int daNpc_Saru_c::isDelete() {
/* 80AC0CE8-80AC0EA4 0009A8 01BC+00 1/1 0/0 0/0 .text reset__12daNpc_Saru_cFv */
void daNpc_Saru_c::reset() {
// NONMATCHING
csXyz acStack_20;
int iVar1 = (u8*)&field_0xfdc - (u8*)&field_0xfbc;
initialize();
@@ -499,7 +503,7 @@ void daNpc_Saru_c::reset() {
mPath.setPathInfo(getPathID(), fopAcM_GetRoomNo(this), 0);
}
memset(&field_0xfbc, 0, 32);
memset(&field_0xfbc, 0, iVar1);
acStack_20.setall(0);
acStack_20.y = home.angle.y;
@@ -773,7 +777,7 @@ void daNpc_Saru_c::drawOtherMdl() {
/* 80AC1B30-80AC1B78 0017F0 0048+00 1/1 0/0 0/0 .text selectAction__12daNpc_Saru_cFv */
int daNpc_Saru_c::selectAction() {
field_0xfbc = NULL;
field_0xfbc = &daNpc_Saru_c::talk;
field_0xfbc = &daNpc_Saru_c::wait;
return 1;
}
@@ -1059,126 +1063,129 @@ int daNpc_Saru_c::cutYmLook(int param_1) {
/* 80AC28A4-80AC2FD8 002564 0734+00 1/0 0/0 0/0 .text wait__12daNpc_Saru_cFPv */
int daNpc_Saru_c::wait(void* param_1) {
// NONMATCHING
obj_so_class* cage_p;
switch (mMode) {
case 1:
if (mStagger.checkStagger() == 0) {
switch (mType) {
case 0:
if (field_0xfd9 != 0) {
mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0);
mMotionSeqMngr.setNo(MOT_WAIT_A, -1.0f, 0, 0);
} else {
mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0);
mMotionSeqMngr.setNo(MOT_SCARED, -1.0f, 0, 0);
}
break;
case 2:
cage_p = (obj_so_class*)mActrMngr[0].getActorP();
if (cage_p != NULL) {
mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0);
mMotionSeqMngr.setNo(MOT_HELP_E, -1.0f, 0, 0);
if (cage_p->partBreak() == 1) {
mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0 ,0);
mMotionSeqMngr.setNo(MOT_HELP_C, -1.0f, 0, 0);
}
} else {
mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0);
mMotionSeqMngr.setNo(MOT_WAIT_A, -1.0f, 0, 0);
}
break;
default:
case 0:
case 1:
if (mStagger.checkStagger() == 0) {
switch (mType) {
case 0:
if (field_0xfd9 != 0) {
mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0);
mMotionSeqMngr.setNo(MOT_WAIT_A, -1.0f, 0, 0);
}
} else {
mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0);
mMotionSeqMngr.setNo(MOT_SCARED, -1.0f, 0, 0);
}
break;
mMode = 2;
}
// fallthrough
case 2:
if (mType == 1 && daNpcT_chkEvtBit(0x25C) /* dSv_event_flag_c::F_0701 - N/A - Talo discovers monkey in Link's house garden */) {
fopAcM_delete(this);
return 1;
} else {
if (mStagger.checkStagger() == 0) {
if (mType == 2 && mMotionSeqMngr.getNo() == MOT_HELP_E) {
cage_p = (obj_so_class*)mActrMngr[0].getActorP();
if (cage_p != NULL && cage_p->partBreak() == 1) {
mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0);
case 2:
cage_p = (obj_so_class*)mActrMngr[0].getActorP();
if (cage_p != NULL) {
mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0);
mMotionSeqMngr.setNo(MOT_HELP_E, -1.0f, 0, 0);
if (cage_p->partBreak() == 1) {
mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0 ,0);
mMotionSeqMngr.setNo(MOT_HELP_C, -1.0f, 0, 0);
}
} else {
mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0);
mMotionSeqMngr.setNo(MOT_WAIT_A, -1.0f, 0, 0);
}
break;
default:
mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0);
mMotionSeqMngr.setNo(MOT_WAIT_A, -1.0f, 0, 0);
}
mMode = 2;
}
// fallthrough
case 2:
if (mType == 1 && daNpcT_chkEvtBit(0x25C) /* dSv_event_flag_c::F_0701 - N/A - Talo discovers monkey in Link's house garden */) {
fopAcM_delete(this);
return 1;
} else {
if (mStagger.checkStagger() == 0) {
if (mType == 2 && mMotionSeqMngr.getNo() == MOT_HELP_E) {
cage_p = (obj_so_class*)mActrMngr[0].getActorP();
if (cage_p != NULL && cage_p->partBreak() == 1) {
mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0);
mMotionSeqMngr.setNo(MOT_HELP_C, -1.0f, 0, 0);
}
}
if (mPlayerActorMngr.getActorP() != NULL && mTwilight == false) {
mJntAnm.lookPlayer(0);
if (!chkActorInSight(mPlayerActorMngr.getActorP(), mAttnFovY, mCurAngle.y)) {
mJntAnm.lookNone(0);
}
if (mPlayerActorMngr.getActorP() != NULL && mTwilight == false) {
mJntAnm.lookPlayer(0);
if (!chkActorInSight(mPlayerActorMngr.getActorP(), mAttnFovY, mCurAngle.y)) {
mJntAnm.lookNone(0);
}
if (!srchPlayerActor() && home.angle.y == mCurAngle.y) {
mMode = 1;
}
} else {
mJntAnm.lookNone(0);
if (home.angle.y != mCurAngle.y) {
if (field_0xe34 != 0) {
if (step(home.angle.y, -1, -1, 15, 0)) {
mMode = 1;
}
} else {
setAngle(home.angle.y);
if (!srchPlayerActor() && home.angle.y == mCurAngle.y) {
mMode = 1;
}
} else {
mJntAnm.lookNone(0);
if (home.angle.y != mCurAngle.y) {
if (field_0xe34 != 0) {
if (step(home.angle.y, -1, -1, 15, 0)) {
mMode = 1;
}
attention_info.flags = 0;
} else {
if (mType == 0) {
if (mMotionSeqMngr.getNo() == MOT_SCARED_LOOK) {
if (mMotionSeqMngr.checkEndSequence() != 0) {
mMode = 1;
}
} else if (field_0xfd4 != 0 && cLib_calcTimer(&field_0xfd4) == 0 && mType == 0 && field_0xfd9 == 0) {
mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0);
mMotionSeqMngr.setNo(MOT_SCARED_LOOK, -1.0f, 0, 0);
}
}
setAngle(home.angle.y);
mMode = 1;
}
if (!mTwilight) {
srchPlayerActor();
attention_info.flags = 0;
} else {
if (mType == 0) {
if (mMotionSeqMngr.getNo() == MOT_SCARED_LOOK) {
if (mMotionSeqMngr.checkEndSequence() != 0) {
mMode = 1;
}
} else if (field_0xfd4 != 0 && cLib_calcTimer(&field_0xfd4) == 0 && mType == 0 && field_0xfd9 == 0) {
mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0);
mMotionSeqMngr.setNo(MOT_SCARED_LOOK, -1.0f, 0, 0);
}
}
}
mJntAnm.getMode();
if (!mTwilight) {
srchPlayerActor();
}
}
}
if (mType == 0) {
if (field_0xfd9 == 0) {
mFindCount = 0;
fopAcM_Search(srchYm, this);
int iVar1 = 0;
for (int i = 0; i < mFindCount; i++) {
if (mFindActorPtrs[i]->health > 0) {
iVar1++;
}
}
if (mFindCount != 0 && iVar1 == 0) {
mEvtNo = EVENT_YM_LOOK;
field_0xfd8 = 1;
}
} else {
field_0xfd8 = 0;
}
switch (mJntAnm.getMode()) {
case 0:
break;
}
}
break;
case 3:
break;
if (mType == 0) {
if (field_0xfd9 == 0) {
mFindCount = 0;
fopAcM_Search(srchYm, this);
int iVar1 = 0;
for (int i = 0; i < mFindCount; i++) {
if (mFindActorPtrs[i]->health > 0) {
iVar1++;
}
}
if (mFindCount && iVar1 == 0) {
mEvtNo = EVENT_YM_LOOK;
field_0xfd8 = 1;
}
} else {
field_0xfd8 = 0;
}
}
}
break;
case 3:
break;
}
return 1;
@@ -1186,33 +1193,34 @@ int daNpc_Saru_c::wait(void* param_1) {
/* 80AC2FD8-80AC31B4 002C98 01DC+00 3/0 0/0 0/0 .text talk__12daNpc_Saru_cFPv */
int daNpc_Saru_c::talk(void* param_1) {
// NONMATCHING
switch (mMode) {
case 0:
case 1:
if (mStagger.checkStagger() == 0) {
initTalk(mFlowNodeNo, NULL);
mMode = 2;
}
case 0:
case 1:
if (mStagger.checkStagger() == 0) {
initTalk(mFlowNodeNo, NULL);
mMode = 2;
}
case 2:
if (mStagger.checkStagger() == 0) {
if (mTwilight != false || mPlayerAngle == mCurAngle.y) {
if (talkProc(NULL, FALSE, NULL, FALSE) && mFlow.checkEndFlow()) {
mPlayerActorMngr.entry(daPy_getPlayerActorClass());
dComIfGp_event_reset();
mMode = 3;
}
mJntAnm.lookPlayer(0);
if (mTwilight != false) {
mJntAnm.lookNone(0);
}
} else {
mJntAnm.lookPlayer(0);
step(fopAcM_searchPlayerAngleY(this), -1, -1, 15, 0);
case 2:
if (mStagger.checkStagger() == 0) {
if (mTwilight != false || mPlayerAngle == mCurAngle.y) {
if (talkProc(NULL, FALSE, NULL, FALSE) && mFlow.checkEndFlow()) {
mPlayerActorMngr.entry(daPy_getPlayerActorClass());
dComIfGp_event_reset();
mMode = 3;
}
mJntAnm.lookPlayer(0);
if (mTwilight != false) {
mJntAnm.lookNone(0);
}
} else {
mJntAnm.lookPlayer(0);
step(fopAcM_searchPlayerAngleY(this), -1, -1, 15, 0);
}
}
case 3:
break;
}
return 0;