diff --git a/include/d/d_attention.h b/include/d/d_attention.h index 694aa9de5..09bee7f86 100644 --- a/include/d/d_attention.h +++ b/include/d/d_attention.h @@ -167,7 +167,7 @@ public: fopAc_ac_c* Owner() { return (fopAc_ac_c*)mpPlayer; } - BOOL chkFlag(u32 flag) { return (mFlags & flag) ? TRUE : FALSE; } + bool chkFlag(u32 flag) { return (mFlags & flag) ? true : false; } void setFlag(u32 flag) { mFlags |= flag; } void clrFlag(u32 flag) { mFlags &= ~flag; } bool Lockon() { return LockonTruth() || chkFlag(0x20000000); } // regswap diff --git a/src/d/actor/d_a_am.cpp b/src/d/actor/d_a_am.cpp index fbd515695..5c44c085c 100644 --- a/src/d/actor/d_a_am.cpp +++ b/src/d/actor/d_a_am.cpp @@ -546,10 +546,9 @@ static void action_dousa(am_class* i_this) { case 3: if (i_this->mCurrBckIdx != AM_BCK_CLOSE && i_this->mCurrBckIdx != AM_BCK_CLOSE_LOOP) { if (i_this->mCurrBckIdx != AM_BCK_DAMAGE_END) { + fopAcM_seStart(i_this, JA_SE_CM_AM_NEEDLE_OUT, 0); // Using the fopAcM_seStart inline multiple times in a single case makes the codegen not match. - // fopAcM_seStart(i_this, JA_SE_CM_AM_NEEDLE_OUT, 0); // fopAcM_seStart(i_this, JA_SE_CM_AM_MOUTH_CLOSE, 0); - mDoAud_seStart(JA_SE_CM_AM_NEEDLE_OUT, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); mDoAud_seStart(JA_SE_CM_AM_MOUTH_CLOSE, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); } anm_init(i_this, AM_BCK_CLOSE, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); @@ -636,8 +635,8 @@ static void action_dousa(am_class* i_this) { anm_init(i_this, AM_BCK_DAMAGE, 0.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); // Using the fopAcM_seStart inline multiple times in a single case makes the codegen not match. // fopAcM_seStart(i_this, JA_SE_CM_AM_NEEDLE_IN, 0); - // fopAcM_seStart(i_this, JA_SE_CM_AM_MOUTH_OPEN, 0); mDoAud_seStart(JA_SE_CM_AM_NEEDLE_IN, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + // fopAcM_seStart(i_this, JA_SE_CM_AM_MOUTH_OPEN, 0); mDoAud_seStart(JA_SE_CM_AM_MOUTH_OPEN, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); fopAcM_monsSeStart(i_this, JA_SE_CV_AM_OPEN_MOUTH, 0); i_this->mNeedleCyl.OffAtSetBit(); @@ -761,10 +760,9 @@ static void action_handou_move(am_class* i_this) { } i_this->mTargetAngleY = i_this->current.angle.y; if (i_this->mCurrBckIdx != AM_BCK_CLOSE && i_this->mCurrBckIdx != AM_BCK_CLOSE_LOOP) { + fopAcM_seStart(i_this, JA_SE_CM_AM_NEEDLE_OUT, 0); // Using the fopAcM_seStart inline multiple times makes the codegen not match. - // fopAcM_seStart(i_this, JA_SE_CM_AM_NEEDLE_OUT, 0); // fopAcM_seStart(i_this, JA_SE_CM_AM_MOUTH_CLOSE, 0); - mDoAud_seStart(JA_SE_CM_AM_NEEDLE_OUT, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); mDoAud_seStart(JA_SE_CM_AM_MOUTH_CLOSE, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); anm_init(i_this, AM_BCK_CLOSE, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); } @@ -810,10 +808,9 @@ static void action_itai_move(am_class* i_this) { break; } anm_init(i_this, AM_BCK_DAMAGE_END, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); + fopAcM_seStart(i_this, JA_SE_CM_AM_NEEDLE_OUT, 0); // Using the fopAcM_seStart inline multiple times in a single case makes the codegen not match. - // fopAcM_seStart(i_this, JA_SE_CM_AM_NEEDLE_OUT, 0); // fopAcM_seStart(i_this, JA_SE_CM_AM_MOUTH_CLOSE, 0); - mDoAud_seStart(JA_SE_CM_AM_NEEDLE_OUT, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); mDoAud_seStart(JA_SE_CM_AM_MOUTH_CLOSE, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); i_this->mState += 1; break; @@ -899,9 +896,7 @@ static void action_itai_move(am_class* i_this) { dComIfGp_particle_set(0x8127, &i_this->mWaistPos); dComIfGp_particle_set(0x8128, &i_this->mWaistPos); - // The fopAcM_seStart inline makes the codegen not match. - // fopAcM_seStart(i_this, JA_SE_CM_AM_BEF_EXPLODE, 0); - mDoAud_seStart(JA_SE_CM_AM_BEF_EXPLODE, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + fopAcM_seStart(i_this, JA_SE_CM_AM_BEF_EXPLODE, 0); i_this->mTargetAngleY = i_this->current.angle.y; if (i_this->m033C) { @@ -936,10 +931,9 @@ static void action_itai_move(am_class* i_this) { } } + fopAcM_seStart(i_this, JA_SE_CM_AM_EXPLODE, 0); // Using the fopAcM_seStart inline multiple times in a single case makes the codegen not match. - // fopAcM_seStart(i_this, JA_SE_CM_AM_EXPLODE, 0); // fopAcM_seStart(i_this, JA_SE_LK_LAST_HIT, 0); - mDoAud_seStart(JA_SE_CM_AM_EXPLODE, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); mDoAud_seStart(JA_SE_LK_LAST_HIT, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); fopAcM_createDisappear(i_this, ¢erPos, 5); diff --git a/src/d/actor/d_a_am2.cpp b/src/d/actor/d_a_am2.cpp index 432e610a9..c677e0fb2 100644 --- a/src/d/actor/d_a_am2.cpp +++ b/src/d/actor/d_a_am2.cpp @@ -823,9 +823,7 @@ static void action_mahi(am2_class* i_this) { anm_init(i_this, AM2_BCK_BURUBURU, 1.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, -1); i_this->mCountDownTimers[3] = 20*30; actor->mAttentionInfo.mFlags &= ~fopAc_Attn_ACTION_CARRY_e; - // Using the fopAcM_seStart inline multiple times makes the codegen not match. - // fopAcM_seStart(i_this, JA_SE_CM_AM2_RECOVER, 0); - mDoAud_seStart(JA_SE_CM_AM2_RECOVER, &actor->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + fopAcM_seStart(i_this, JA_SE_CM_AM2_RECOVER, 0); fopAcM_monsSeStart(actor, JA_SE_CV_AM2_AWAKE, 0); } @@ -960,7 +958,7 @@ static void action_itai(am2_class* i_this) { centerPos.y += 50.0f; dComIfGp_particle_set(0x81AF, &i_this->current.pos, &i_this->shape_angle); dComIfGp_particle_set(0x81B0, &i_this->current.pos, &i_this->shape_angle); - mDoAud_seStart(JA_SE_CM_AM2_EXPLODE, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + fopAcM_seStart(i_this, JA_SE_CM_AM2_EXPLODE, 0); fopAcM_createDisappear(i_this, ¢erPos, 5); fopAcM_onActor(i_this); fopAcM_delete(i_this); diff --git a/src/d/actor/d_a_npc_md.cpp b/src/d/actor/d_a_npc_md.cpp index 2c3521525..d259acea2 100644 --- a/src/d/actor/d_a_npc_md.cpp +++ b/src/d/actor/d_a_npc_md.cpp @@ -993,16 +993,17 @@ s16 daNpc_Md_c::getStickAngY(BOOL param_1) { /* 00003430-00003588 .text calcStickPos__10daNpc_Md_cFsP4cXyz */ int daNpc_Md_c::calcStickPos(s16 param_1, cXyz* param_2) { - /* Nonmatching - dAttention_c::Lockon regswap */ - dAttList_c* attList = dComIfGp_getAttention().GetLockonList(0); + // This temp variable for attention is probably a fakematch, but it fixes a regswap in dAttention_c::Lockon. + dAttention_c& attention = dComIfGp_getAttention(); + dAttList_c* attList = attention.GetLockonList(0); - bool r26 = dComIfGp_getAttention().Lockon(); + bool r26 = attention.Lockon(); int r31; if (!r26) { r31 = 0; } else { - BOOL lockon = dComIfGp_getAttention().LockonTruth(); + BOOL lockon = attention.LockonTruth(); r31 = -1; if (lockon) { r31 = 1; @@ -1010,7 +1011,7 @@ int daNpc_Md_c::calcStickPos(s16 param_1, cXyz* param_2) { } if (attList == NULL) { - attList = dComIfGp_getAttention().GetActionList(0); + attList = attention.GetActionList(0); } if (attList) { *param_2 = attList->getActor()->mEyePos; diff --git a/src/f_op/f_op_actor_mng.cpp b/src/f_op/f_op_actor_mng.cpp index 0d2adb356..60a705ec0 100644 --- a/src/f_op/f_op_actor_mng.cpp +++ b/src/f_op/f_op_actor_mng.cpp @@ -27,6 +27,9 @@ #include "JSystem/JUtility/JUTAssert.h" #include "SSystem/SComponent/c_malloc.h" +#define MAKE_ITEM_PARAMS(itemNo, itemBitNo, switchNo2, type, action) \ + ((itemNo & 0xFF) << 0 | (itemBitNo & 0xFF) << 0x8 | switchNo2 << 0x10 | (type & 0x3) << 0x18 | (action & 0x3F) << 0x1A) + static Vec dummy_3569; /* 80024060-80024104 .text fopAcM_setStageLayer__FPv */ @@ -962,7 +965,7 @@ s32 fopAcM_createItem(cXyz* pos, int i_itemNo, int i_itemBitNo, int roomNo, int prmRot.z = switchNo; u8 itemNo = check_itemno(i_itemNo); - u32 params = (i_itemBitNo & 0xFF) << 0x08 | itemNo & 0xFF | switchNo2 << 16 | (type & 3) << 24 | action << 26; + u32 params = MAKE_ITEM_PARAMS(itemNo, i_itemBitNo, switchNo2, type, action); switch (i_itemNo) { case RECOVER_FAIRY: @@ -1001,7 +1004,7 @@ void* fopAcM_fastCreateItem2(cXyz* pos, int i_itemNo, int i_itemBitNo, int roomN prmRot.z = switchNo; u8 itemNo = check_itemno(i_itemNo); - u32 params = (i_itemBitNo & 0xFF) << 0x08 | itemNo & 0xFF | switchNo2 << 16 | (type & 3) << 24 | action << 26; + u32 params = MAKE_ITEM_PARAMS(itemNo, i_itemBitNo, switchNo2, type, action); switch (i_itemNo) { case RECOVER_FAIRY: @@ -1057,7 +1060,7 @@ void* fopAcM_fastCreateItem(cXyz* pos, int i_itemNo, int roomNo, csXyz* rot, cXy u8 itemNo = check_itemno(i_itemNo); u8 itemBitNo = i_itemBitNo; - u32 params = (itemNo & 0xFF) << 0 | (itemBitNo & 0xFF) << 8 | switchNo2 << 16 | (type & 3) << 24 | action << 26; + u32 params = MAKE_ITEM_PARAMS(itemNo, itemBitNo, switchNo2, type, action); if (isHeart(i_itemNo)) { speedF = 2.0f * speedF;