Skip to content

Commit

Permalink
d_a_player_dproc start
Browse files Browse the repository at this point in the history
  • Loading branch information
LagoLunatic committed Jun 28, 2024
1 parent 07a9265 commit 32dc871
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 6 deletions.
4 changes: 2 additions & 2 deletions include/d/actor/d_a_player_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -2102,11 +2102,11 @@ class daPy_lk_c : public daPy_py_c {
/* 0x361C */ u32 mMtrlSndId;
/* 0x3620 */ u32 m3620;
/* 0x3624 */ u32 m3624;
/* 0x3628 */ int m3628;
/* 0x3628 */ uint m3628;
/* 0x362C */ uint mTactZevPartnerPID;
/* 0x3630 */ uint m3630;
/* 0x3634 */ int m3634;
/* 0x3638 */ int mMsgId;
/* 0x3638 */ uint mMsgId;
/* 0x363C */ J3DFrameCtrl* mpSeAnmFrameCtrl;
/* 0x3640 */ s16 m3640;
/* 0x3644 */ f32 m3644;
Expand Down
90 changes: 87 additions & 3 deletions src/d/actor/d_a_player_dproc.inc
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,23 @@ void daPy_lk_c::setShapeAngleToTalkActor() {
}

/* 8012D08C-8012D134 .text checkEndMessage__9daPy_lk_cFUl */
BOOL daPy_lk_c::checkEndMessage(u32) {
/* Nonmatching */
BOOL daPy_lk_c::checkEndMessage(u32 i_msgNo) {
if (m3628 == fpcM_ERROR_PROCESS_ID_e) {
m3628 = fopMsgM_messageSet(i_msgNo);
} else {
msg_class* msg_p = fopMsgM_SearchByID(m3628);
if (msg_p != NULL) {
if (msg_p->mStatus == fopMsgStts_MSG_DISPLAYED_e) {
msg_p->mStatus = fopMsgStts_MSG_ENDS_e;
} else if (msg_p->mStatus == fopMsgStts_BOX_CLOSED_e) {
msg_p->mStatus = fopMsgStts_MSG_DESTROYED_e;
return TRUE;
} else if (msg_p->mStatus == fopMsgStts_MSG_PREPARING_e && i_msgNo == 0x14A2) {
fopMsgM_demoMsgFlagOn();
}
}
}
return FALSE;
}

/* 8012D134-8012D300 .text setTalkStartBack__9daPy_lk_cFv */
Expand Down Expand Up @@ -114,7 +129,76 @@ void daPy_lk_c::setGetItemSound(u16, int) {

/* 8012E418-8012E6B4 .text setGetDemo__9daPy_lk_cFv */
BOOL daPy_lk_c::setGetDemo() {
/* Nonmatching */
int staffIdx = dComIfGp_evmng_getMyStaffId("Link", this);
if (dComIfGp_event_runCheck() && m34CE & 0x04) {
dComIfGp_evmng_cutEnd(staffIdx);
return TRUE;
}

if (dComIfGp_evmng_startCheck("DEFAULT_GETITEM")) {
if (m34CE & 0x01 ||
(
(
checkNoResetFlg0(daPy_FLG0(daPyFlg0_UNK80000000 | daPyFlg0_UNK20000000)) ||
!mAcch.ChkGroundHit() ||
daPy_lk_c::checkPlayerFly()
) &&
!dComIfGp_checkPlayerStatus0(0, daPyStts0_SHIP_RIDE_e)
)
) {
if ((m34CE & 0x01) == 0) {
mMsgId = fpcM_ERROR_PROCESS_ID_e;
}
m34CE |= 0x01;
char* cutName = dComIfGp_getPEvtManager()->getMyNowCutName(staffIdx);
if (cutName != NULL) {
// TODO: is there an inline for parsing link's cut name -> cut index?
u32 r0 = (cutName[0] - '0') * 100 + (cutName[1] - '0') * 10 + (cutName[2] - '0');
if (r0 == 0xB) {
fopAc_ac_c* itemPartner = fopAcM_getItemEventPartner(this);
if (itemPartner != NULL && (fopAcM_GetName(itemPartner) == PROC_ITEM || fopAcM_GetName(itemPartner) == PROC_Demo_Item)) {
daItemBase_c* item = (daItemBase_c*)itemPartner;
item->hide();
u32 itemNo = item->getItemNo();
if ((m34CE & 0x02) == 0) {
setGetItemSound(itemNo, 0);
m34CE |= 0x02;
}

u32 itemGetMsgNo;
if (itemNo == dItem_HEART_PIECE_e && dComIfGs_getMaxLife() % 4 != 0) {
itemGetMsgNo = 0x7B + dComIfGs_getMaxLife() % 4;
} else {
itemGetMsgNo = 0x65 + itemNo;
}

if (mMsgId == fpcM_ERROR_PROCESS_ID_e) {
mMsgId = fopMsgM_messageSet(itemGetMsgNo);
} else {
msg_class* msg_p = fopMsgM_SearchByID(mMsgId);
if (msg_p != NULL) {
if (msg_p->mStatus == fopMsgStts_MSG_DISPLAYED_e) {
msg_p->mStatus = fopMsgStts_MSG_ENDS_e;
} else if (msg_p->mStatus == fopMsgStts_BOX_CLOSED_e) {
msg_p->mStatus = fopMsgStts_MSG_DESTROYED_e;
dComIfGp_evmng_cutEnd(staffIdx);
item->dead();
m34CE |= 0x04;
} else if (msg_p->mStatus == fopMsgStts_MSG_PREPARING_e) {
fopMsgM_demoMsgFlagOn();
}
}
}
}
} else {
dComIfGp_evmng_cutEnd(staffIdx);
}
}
return TRUE;
}
}
m34CE = 0;
return FALSE;
}

/* 8012E6B4-8012E8B0 .text dProcGetItem_init__9daPy_lk_cFv */
Expand Down
2 changes: 1 addition & 1 deletion src/d/actor/d_a_player_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3148,7 +3148,7 @@ BOOL daPy_lk_c::execute() {
onNoResetFlg1(daPyFlg1_UNK200);
dComIfGs_setBottleItemIn(FWATER_BOTTLE, BIN_IN_WATER);
mDemo.setDemoType(5);
m3628 = -1;
m3628 = fpcM_ERROR_PROCESS_ID_e;
if (mCurProc == daPyProc_SCOPE_e) {
procWait_init();
}
Expand Down

0 comments on commit 32dc871

Please sign in to comment.