diff --git a/include/SSystem/SComponent/c_bg_s_gnd_chk.h b/include/SSystem/SComponent/c_bg_s_gnd_chk.h index a102cfc3e..a4ebace1c 100644 --- a/include/SSystem/SComponent/c_bg_s_gnd_chk.h +++ b/include/SSystem/SComponent/c_bg_s_gnd_chk.h @@ -12,7 +12,9 @@ public: m_pos = *pos; } void SetPos(Vec* pos) { - m_pos = *pos; + m_pos.x = pos->x; + m_pos.y = pos->y; + m_pos.z = pos->z; } virtual ~cBgS_GndChk() {} diff --git a/include/d/actor/d_a_tn.h b/include/d/actor/d_a_tn.h index 5ec081fbd..b19eb9c1d 100644 --- a/include/d/actor/d_a_tn.h +++ b/include/d/actor/d_a_tn.h @@ -40,7 +40,7 @@ struct tn_class { /* 0x02C4 */ mDoExt_McaMorf* mpBodyMorf; /* 0x02C8 */ mDoExt_McaMorf* mpShieldMorf; /* 0x02CC */ mDoExt_McaMorf* mpArmorMorf; - /* 0x02D0 */ u8 mRemainingEquipmentPieces; + /* 0x02D0 */ s8 mRemainingEquipmentPieces; /* 0x02D1 */ u8 m02D1[0x02D4 - 0x02D1]; /* 0x02D4 */ u32 mShadowId; /* 0x02D8 */ mDoExt_brkAnm* mpBrkAnm; diff --git a/include/d/d_cc_uty.h b/include/d/d_cc_uty.h index dd96413e3..a1891019e 100644 --- a/include/d/d_cc_uty.h +++ b/include/d/d_cc_uty.h @@ -29,6 +29,8 @@ void def_se_set_p(fopAc_ac_c*, cXyz*, cCcD_Obj*, unsigned long); fopAc_ac_c* at_power_check(CcAtInfo*); fopAc_ac_c* cc_at_check(fopAc_ac_c*, CcAtInfo*); -inline void dCc_GetAc(void*) {} +inline fopAc_ac_c* dCc_GetAc(void* i_actor) { + return static_cast(i_actor); +} #endif /* D_CC_UTY_H */ diff --git a/include/d/d_path.h b/include/d/d_path.h index c791a10b4..9c83e611d 100644 --- a/include/d/d_path.h +++ b/include/d/d_path.h @@ -22,7 +22,7 @@ struct dPath { /* 0x08 */ dPnt* m_points; }; -inline BOOL dPath_ChkClose(dPath* i_path) { return i_path->m_closed & 1; } +inline BOOL dPath_ChkClose(dPath* i_path) { return (i_path->m_closed & 1) != 0; } dPath* dPath_GetRoomPath(int, int); dPath* dPath_GetNextRoomPath(dPath*, int); diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index 8462ecf90..c01a4479c 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -127,7 +127,7 @@ inline MtxP fopAcM_GetMtx(fopAc_ac_c* pActor) { return pActor->cullMtx; } -inline bool fopAcM_CheckStatus(fopAc_ac_c* pActor, u32 status) { +inline u32 fopAcM_CheckStatus(fopAc_ac_c* pActor, u32 status) { return pActor->actor_status & status; } @@ -155,8 +155,8 @@ inline void fopAcM_SetParam(void* p_actor, u32 param) { fpcM_SetParam(p_actor, param); } -inline void fopAcM_SetJntHit(fopAc_ac_c* i_actorP, JntHit_c* i_jntHitP) { - i_actorP->jntHit = i_jntHitP; +inline void fopAcM_SetJntHit(fopAc_ac_c* i_actorP, void* i_jntHitP) { + i_actorP->jntHit = (JntHit_c*)i_jntHitP; } inline s16 fopAcM_GetProfName(void* pActor) { @@ -475,12 +475,8 @@ fpc_ProcID fopAcM_create(char*, u32 i_parameter, cXyz* i_pos = NULL, int i_roomN csXyz* i_angle = NULL, cXyz* i_scale = NULL, createFunc i_createFunc = NULL); -inline fpc_ProcID fopAcM_create(s16 i_procName, createFunc i_createFunc, void* params) { - return fpcM_Create(i_procName, i_createFunc, params); -} - inline fpc_ProcID fopAcM_Create(s16 i_procName, createFunc i_createFunc, void* params) { - return fpcM_Create(i_procName, i_createFunc,params); + return fpcM_Create(i_procName, i_createFunc, params); } void* fopAcM_fastCreate(s16 procName, u32 parameter, cXyz* p_pos = NULL, int roomNo = -1, diff --git a/src/d/actor/d_a_bmd.cpp b/src/d/actor/d_a_bmd.cpp index 41d8e09b6..4debad561 100644 --- a/src/d/actor/d_a_bmd.cpp +++ b/src/d/actor/d_a_bmd.cpp @@ -1993,12 +1993,12 @@ static cPhs_State daBmd_Create(fopAc_ac_c* a_this) { for (s32 i = 0; i < 20; i++) { fopAcM_prm_class* params = fopAcM_CreateAppend(); params->base.parameters = i; - fopAcM_create(fpcNm_BMDHAND_e, 0, params); + fopAcM_Create(fpcNm_BMDHAND_e, NULL, params); } for (s32 i = 0; i < 8; i++) { fopAcM_prm_class* params = fopAcM_CreateAppend(); params->base.parameters = i; - fopAcM_create(fpcNm_BMDFOOT_e, 0, params); + fopAcM_Create(fpcNm_BMDFOOT_e, NULL, params); } a_this->home.pos.y += REG0_F(2) + 20.0f; a_this->current.pos.y = a_this->home.pos.y; diff --git a/src/d/actor/d_a_ff.cpp b/src/d/actor/d_a_ff.cpp index 2a4e4609d..9ceffa234 100644 --- a/src/d/actor/d_a_ff.cpp +++ b/src/d/actor/d_a_ff.cpp @@ -304,7 +304,7 @@ static cPhs_State daFf_Create(fopAc_ac_c* i_this) { pfVar4->base.angle.y = 0; pfVar4->base.angle.x = 0; pfVar4->base.parameters = fopAcM_GetParam(a_this); - fopAcM_create(fpcNm_FF_e, NULL, pfVar4); + fopAcM_Create(fpcNm_FF_e, NULL, pfVar4); } } a_this->mbNoUseGroundY = fopAcM_GetParam(a_this) >> 8; diff --git a/src/d/actor/d_a_kokiie.cpp b/src/d/actor/d_a_kokiie.cpp index c5d3df5d5..5398ac1b4 100644 --- a/src/d/actor/d_a_kokiie.cpp +++ b/src/d/actor/d_a_kokiie.cpp @@ -187,7 +187,7 @@ BOOL himo_create(kokiie_class* i_this) { pfVar3->base.angle.y = actor->current.angle.y + i * 0x3333 + -13000; pfVar3->base.parameters = 0xffffff01; pfVar3->room_no = actor->current.roomNo; - i_this->m2D4[i] = fopAcM_create(fpcNm_SHAND_e, NULL, pfVar3); + i_this->m2D4[i] = fopAcM_Create(fpcNm_SHAND_e, NULL, pfVar3); i_this->m2E8[i]++; case 1: diff --git a/src/d/actor/d_a_mo2.cpp b/src/d/actor/d_a_mo2.cpp index 08a62cb0d..3d4f1348b 100644 --- a/src/d/actor/d_a_mo2.cpp +++ b/src/d/actor/d_a_mo2.cpp @@ -1794,7 +1794,7 @@ static fopAc_ac_c* yari_hit_check(mo2_class* i_this) { } else { pcVar2 = i_this->mWeapon2Sph.GetAtHitObj(); } - return pcVar2->GetAc(); + return dCc_GetAc(pcVar2->GetAc()); } } return NULL; @@ -1809,7 +1809,7 @@ static void AtHitCallback(fopAc_ac_c* a_this, dCcD_GObjInf*, fopAc_ac_c* actor, if (fopAcM_GetName(actor) != fpcNm_PLAYER_e) { return; } - if (!daPy_getPlayerActorClass()->checkGrabWear()) { + if (!((daPy_py_c*)dComIfGp_getPlayer(0))->checkGrabWear()) { return; } i_this->m2A48 = 1; @@ -1833,7 +1833,7 @@ static void fight(mo2_class* i_this) { i_this->mDamageReaction.mMode = 1; i_this->m05A4[2] = 8; // Fall-through - case 1: + case 1: { i_this->mWeaponSph.SetAtAtp(mo2_attack_AP[i_this->m2060]); i_this->mWeapon2Sph.SetAtAtp(mo2_attack_AP[i_this->m2060]); attack_info_s* info = attack_info[i_this->m2060]; @@ -1907,7 +1907,7 @@ static void fight(mo2_class* i_this) { fopAc_ac_c* hitActor = yari_hit_check(i_this); if (hitActor != NULL) { if (fopAcM_GetName(hitActor) == fpcNm_PLAYER_e) { - if (player->checkPlayerGuard() && (i_this->m2060 != 3)) { + if (player->checkPlayerGuard() && i_this->m2060 != 3) { i_this->mpMorf->setPlaySpeed(-1.0f); if (i_this->m05F0 != 0) { i_this->m05F0 = l_mo2HIO.m024 + 6; @@ -1944,9 +1944,10 @@ static void fight(mo2_class* i_this) { } } if (i_this->mpMorf->isStop()) { - if (((((i_this->m2064 == 2) && (i_this->m207E > 0)) || (i_this->m2060 == 4 && (i_this->m2064 == 0))) || - (i_this->m207E < 0 && (i_this->m2064 == 0))) || - (i_this->m2060 == 5 && (i_this->m207E < 0 && (i_this->m2064 == 1)))) + if ((i_this->m2064 == 2 && i_this->m207E > 0) || + (i_this->m2060 == 4 && i_this->m2064 == 0) || + (i_this->m207E < 0 && i_this->m2064 == 0) || + (i_this->m2060 == 5 && i_this->m207E < 0 && i_this->m2064 == 1)) { if (i_this->m2060 == 3) { attack_set(i_this, 1); @@ -1995,6 +1996,7 @@ static void fight(mo2_class* i_this) { anm_init(i_this, info[i_this->m2064].bckFileIdx, 0.0f, J3DFrameCtrl::EMode_NONE, fVar11, info[i_this->m2064].soundFileIdx); } } + } } } @@ -3345,7 +3347,7 @@ static s32 kantera_get_init(mo2_class* i_this) { params->base.angle.y = actor->current.angle.y; params->base.parameters = (fopAcM_GetParam(actor) & 0xFF000000U) | 0xFFFF23; // TODO clean up parameters params->room_no = fopAcM_GetRoomNo(actor); - i_this->m02E8 = fopAcM_create(fpcNm_KANTERA_e, NULL, params); + i_this->m02E8 = fopAcM_Create(fpcNm_KANTERA_e, NULL, params); i_this->m2A08++; } else if (i_this->m2A08 != 100) { kantera_class* kantera = (kantera_class*)fopAcM_SearchByID(i_this->m02E8); @@ -3380,7 +3382,8 @@ static BOOL daMo2_Execute(mo2_class* i_this) { i_this->mpMorf->setPlayMode(J3DFrameCtrl::EMode_NONE); i_this->mpMorf->setPlaySpeed(3.0f); i_this->mpMorf->play(&actor->eyePos, 0, 0); - i_this->mpMorf->getModel()->setBaseTRMtx(mDoMtx_stack_c::now); + J3DModel* model = i_this->mpMorf->getModel(); + model->setBaseTRMtx(mDoMtx_stack_c::get()); i_this->mpMorf->calc(); return TRUE; } diff --git a/src/d/actor/d_a_player_npc.cpp b/src/d/actor/d_a_player_npc.cpp index d0905f9f3..d7224420e 100644 --- a/src/d/actor/d_a_player_npc.cpp +++ b/src/d/actor/d_a_player_npc.cpp @@ -162,7 +162,11 @@ BOOL daPy_npc_c::checkNowPosMove(const char* pName) { return TRUE; } - return fopAcM_CheckStatus(this, fopAcStts_UNK800_e); + if (fopAcM_CheckStatus(this, fopAcStts_UNK800_e)) { + return TRUE; + } + + return FALSE; } /* 8015AC74-8015AD20 .text drawDamageFog__10daPy_npc_cFv */ diff --git a/src/d/actor/d_a_tn.cpp b/src/d/actor/d_a_tn.cpp index 540961e8d..fea89e490 100644 --- a/src/d/actor/d_a_tn.cpp +++ b/src/d/actor/d_a_tn.cpp @@ -257,7 +257,6 @@ static void ground_smoke_set(tn_class* i_this) { /* 00001244-0000149C .text nodeCallBack__FP7J3DNodei */ static BOOL nodeCallBack(J3DNode* node, int calcTiming) { - /* Nonmatching - retail-only regalloc */ if (calcTiming == J3DNodeCBCalcTiming_In) { J3DJoint* joint = (J3DJoint*)node; s32 jntNo = joint->getJntNo(); @@ -708,7 +707,7 @@ static fopAc_ac_c* search_bomb(tn_class* i_this, int r26) { sp28.y = 50.0f + r24->current.pos.y - actor->eyePos.y; sp28.z = r24->current.pos.z - actor->current.pos.z; f32 f0 = std::sqrtf(sp28.x * sp28.x + sp28.z * sp28.z); - if (f0 < f29 && !(f0 > 30.0f + i_this->mPlayerDistance) && !(daTn_other_bg_check(i_this, r24) && r26)) { + if (f0 < f29 && !(f0 > 30.0f + i_this->mPlayerDistance) && (!daTn_other_bg_check(i_this, r24) || !r26)) { if (r26) { if (std::fabsf(r24->current.pos.y + 50.0f - actor->eyePos.y) <= l_tnHIO.m038) { s16 angleDiff = i_this->m0414 - cM_atan2s(sp28.x, sp28.z); @@ -1074,7 +1073,7 @@ static void jyunkai(tn_class* i_this) { break; } s32 r3 = fopAcM_otoCheck(actor, 1000.0f); - if (i_this->mMantPcId != (u16)fpcM_ERROR_PROCESS_ID_e) { + if (i_this->mMantPcId != 0xFFFF) { mant_class* mant_actor = (mant_class*)fopAcM_SearchByID(i_this->mMantPcId); if ((mant_actor != NULL) && (mant_actor->m1C0E != 0)) { r3 |= 2; @@ -1376,11 +1375,11 @@ static fopAc_ac_c* wepon_hit_check(tn_class* i_this) { i_this->mWepon2Sph.SetAtAtp(atp); if (i_this->m0C48 == 3) { MTXCopy(i_this->mpBodyMorf->getModel()->getAnmMtx(0x05), *calc_mtx); - local_28.setall(0.0f); + local_28.set(0.0f, 0.0f, 0.0f); } else { MTXCopy(i_this->mpBodyMorf->getModel()->getAnmMtx(0x17), *calc_mtx); if (i_this->m0C48 == 2) { - local_28.setall(0.0f); + local_28.set(0.0f, 0.0f, 0.0f); } else { local_28.set(0.0f, 0.0f, 150.0f); } @@ -1419,7 +1418,7 @@ static fopAc_ac_c* wepon_hit_check(tn_class* i_this) { hitObj = i_this->mWepon2Sph.GetAtHitObj(); } if (hitObj != NULL) { - return hitObj->GetAc(); + return dCc_GetAc(hitObj->GetAc()); } JUTReport(440, 220, "TN AT HITOBJ NON"); } @@ -1572,8 +1571,10 @@ static void fight(tn_class* i_this) { actor->setBtMaxDis(l_tnHIO.m0D4); actor->setBtNowFrame(i_this->mpBodyMorf->getFrame()); fopAc_ac_c* wepon_hit_actor = wepon_hit_check(i_this); - if ((((wepon_hit_actor != NULL) && (fopAcM_GetName(wepon_hit_actor) == fpcNm_PLAYER_e)) && (player->checkPlayerGuard())) && - (i_this->m0C48 == 0 || (i_this->m0C48 == 1))) + if (wepon_hit_actor != NULL && + fopAcM_GetName(wepon_hit_actor) == fpcNm_PLAYER_e && + player->checkPlayerGuard() && + (i_this->m0C48 == 0 || i_this->m0C48 == 1)) { i_this->mpBodyMorf->setPlaySpeed(-1.0f); i_this->m0C66 = -1; @@ -1670,7 +1671,7 @@ static void fight(tn_class* i_this) { yoroi_anm_init(i_this, TN_BCK_YAT_KAITEN4, 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f); fopAcM_monsSeStart(actor, JA_SE_CV_TN_ATTACK_L, 0); } - if (i_this->mMantPcId != (u16)fpcM_ERROR_PROCESS_ID_e) { + if (i_this->mMantPcId != 0xFFFF) { mant_class* mant_actor = (mant_class*)fopAcM_SearchByID(i_this->mMantPcId); if (mant_actor != NULL) { cLib_addCalc2(&mant_actor->m1BF8, REG0_F(6) + 50.0f, 1.0f, 20.0f); @@ -2189,7 +2190,7 @@ static void stand(tn_class* i_this) { i_this->mDamageReaction.m710 = 0; s32 r30 = fopAcM_otoCheck(actor, 1000.0f); - if (i_this->mMantPcId != (u16)fpcM_ERROR_PROCESS_ID_e) { + if (i_this->mMantPcId != 0xFFFF) { mant_class* mant_actor = (mant_class*)fopAcM_SearchByID(i_this->mMantPcId); if ((mant_actor != NULL) && (mant_actor->m1C0E != 0)) { r30 |= 2; @@ -2776,19 +2777,19 @@ static void yoroi_break(tn_class* i_this, cXyz* particlePos, u8 param_3) { dComIfGp_particle_set(dPa_name::ID_AK_JN_SIBOUFLASH, particlePos, NULL, &particle_scale); GXColor prmColor; - f32 tmp = (i_this->actor.tevStr.mColorK0.r / 255.0f); + f32 tmp = (actor->tevStr.mColorK0.r / 255.0f); prmColor.r = tmp * prim[i_this->mArmorColorIndex].r; - tmp = (i_this->actor.tevStr.mColorK0.g / 255.0f); + tmp = (actor->tevStr.mColorK0.g / 255.0f); prmColor.g = tmp * prim[i_this->mArmorColorIndex].g; - tmp = (i_this->actor.tevStr.mColorK0.b / 255.0f); + tmp = (actor->tevStr.mColorK0.b / 255.0f); prmColor.b = tmp * prim[i_this->mArmorColorIndex].b; GXColor envColor; - tmp = (i_this->actor.tevStr.mColorK0.r / 255.0f); + tmp = (actor->tevStr.mColorK0.r / 255.0f); envColor.r = tmp * env[i_this->mArmorColorIndex].r; - tmp = (i_this->actor.tevStr.mColorK0.g / 255.0f); + tmp = (actor->tevStr.mColorK0.g / 255.0f); envColor.g = tmp * env[i_this->mArmorColorIndex].g; - tmp = (i_this->actor.tevStr.mColorK0.b / 255.0f); + tmp = (actor->tevStr.mColorK0.b / 255.0f); envColor.b = tmp * env[i_this->mArmorColorIndex].b; if (param_3 == 0) { @@ -2807,10 +2808,9 @@ static void yoroi_break(tn_class* i_this, cXyz* particlePos, u8 param_3) { /* 00008F9C-00009E2C .text damage_check__FP8tn_class */ static u8 damage_check(tn_class* i_this) { - /* Nonmatching */ fopAc_ac_c* actor = &i_this->actor; - s8 r26_2; s16 r3; + s8 r26_2; mant_class* mant_actor; csXyz local_a0; csXyz local_a8; @@ -2905,12 +2905,12 @@ static u8 damage_check(tn_class* i_this) { if (i_this->m0C34 != 0) { i_this->m0C38 = 2; } - if (i_this->mMantPcId != (u16)fpcM_ERROR_PROCESS_ID_e) { + if (i_this->mMantPcId != 0xFFFF) { mant_actor = (mant_class*)fopAcM_SearchByID(i_this->mMantPcId); if (mant_actor != NULL) { fopAcM_delete(mant_actor); } - i_this->mMantPcId = (u16)fpcM_ERROR_PROCESS_ID_e; + i_this->mMantPcId = 0xFFFF; } return 0; } @@ -2939,9 +2939,8 @@ static u8 damage_check(tn_class* i_this) { dScnPly_ply_c::setPauseTimer(REG0_S(7) + 6); fopAcM_seStart(actor, JA_SE_CM_TN_HELMET_OUT, 0); cXyz* particlePos = i_this->mTgCyl.GetTgHitPosP(); - local_74.setall(2.0f); - local_a0.z = 0; - local_a0.x = 0; + local_74.set(2.0f, 2.0f, 2.0f); + local_a0.x = local_a0.z = 0; local_a0.y = fopAcM_searchPlayerAngleY(actor); dComIfGp_particle_set(dPa_name::ID_AK_JN_OK, particlePos, &local_a0, &local_74); dComIfGp_particle_set(dPa_name::ID_AK_JN_CRITICALHITFLASH, particlePos); @@ -2954,12 +2953,11 @@ static u8 damage_check(tn_class* i_this) { r3 = -r3; } cXyz* particlePos = i_this->mTgCyl.GetTgHitPosP(); - local_80.setall(2.0f); - local_a8.z = 0; - local_a8.x = 0; + local_80.set(2.0f, 2.0f, 2.0f); + local_a8.x = local_a8.z = 0; local_a8.y = fopAcM_searchPlayerAngleY(actor); r26_2 = false; - if (i_this->mMantPcId != (u16)fpcM_ERROR_PROCESS_ID_e) { + if (i_this->mMantPcId != 0xFFFF) { mant_actor = (mant_class*)fopAcM_SearchByID(i_this->mMantPcId); if ((mant_actor != NULL) && (mant_actor->m2834 != 0 || (mant_actor->m2836 != 0))) { r26_2 = true; @@ -2976,12 +2974,12 @@ static u8 damage_check(tn_class* i_this) { mDoAud_bgmHitSound(atInfo.mHitSoundId); dComIfGp_particle_set(dPa_name::ID_AK_JN_OK, particlePos, &local_a8, &local_80); dComIfGp_particle_set(dPa_name::ID_AK_JN_CRITICALHITFLASH, particlePos); - if (i_this->mMantPcId != (u16)fpcM_ERROR_PROCESS_ID_e) { + if (i_this->mMantPcId != 0xFFFF) { mant_actor = (mant_class*)fopAcM_SearchByID(i_this->mMantPcId); if (mant_actor != NULL) { fopAcM_delete(mant_actor); } - i_this->mMantPcId = (u16)fpcM_ERROR_PROCESS_ID_e; + i_this->mMantPcId = 0xFFFF; } def_se_set(actor, atInfo.mpObj, 0x21); fopAcM_monsSeStart(actor, JA_SE_CV_TN_NO_DAMAGE, 0); @@ -3004,12 +3002,12 @@ static u8 damage_check(tn_class* i_this) { } else { actor->health = 10; } - if (i_this->mMantPcId != (u16)fpcM_ERROR_PROCESS_ID_e) { + if (i_this->mMantPcId != 0xFFFF) { mant_actor = (mant_class*)fopAcM_SearchByID(i_this->mMantPcId); if (mant_actor != NULL) { fopAcM_delete(mant_actor); } - i_this->mMantPcId = (u16)fpcM_ERROR_PROCESS_ID_e; + i_this->mMantPcId = 0xFFFF; } } } @@ -3153,7 +3151,6 @@ static s32 j_dt[] = {0x0000000A, 0x0000001C, 0x0000000F}; /* 00009E68-0000AC54 .text part_move__FP8tn_classi */ static void part_move(tn_class* i_this, int partIndex) { - /* Nonmatching */ fopAc_ac_c* actor = &i_this->actor; mant_class* mant_actor; J3DModel* model; @@ -3167,7 +3164,7 @@ static void part_move(tn_class* i_this, int partIndex) { daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); part = &i_this->mParts[partIndex]; dBgS_GndChk gndChk; - local_134.setall(0.0f); + local_134.set(0.0f, 0.0f, 0.0f); part->m42++; iVar12 = j_dt[partIndex]; if (part->m44 != 0) { @@ -3177,8 +3174,9 @@ static void part_move(tn_class* i_this, int partIndex) { case 0: MTXCopy(i_this->mpBodyMorf->getModel()->getAnmMtx(iVar12), *calc_mtx); MtxPosition(&local_134, &part->m0C); - if (((((i_this->m02DD & 1) != 0) && (partIndex == 0)) || ((i_this->m02DD & 2) != 0 && (partIndex == 1))) || - ((i_this->m02DD & 4) != 0 && (partIndex == 2))) + if (((i_this->m02DD & 1) != 0 && partIndex == 0) || + ((i_this->m02DD & 2) != 0 && partIndex == 1) || + ((i_this->m02DD & 4) != 0 && partIndex == 2)) { part->m08 = 1; if (partIndex == 0) { @@ -3276,12 +3274,8 @@ static void part_move(tn_class* i_this, int partIndex) { } part->m44 = 0x14; } else { - part->m24.z = 0.0f; - part->m24.y = 0.0f; - part->m24.x = 0.0f; - part->m36.z = 0; - part->m36.y = 0; - part->m36.x = 0; + part->m24.x = part->m24.y = part->m24.z = 0.0f; + part->m36.x = part->m36.y = part->m36.z = 0; cLib_addCalcAngleS2(&part->m30.x, 0, 1, 0xc00); cLib_addCalcAngleS2(&part->m30.z, 0x4000, 1, 0xc00); } @@ -3289,12 +3283,12 @@ static void part_move(tn_class* i_this, int partIndex) { if (part->m44 == 1) { part->m08 = -1; yoroi_break(i_this, &part->m0C, partIndex); - if ((partIndex == 0) && (i_this->mMantPcId != (u16)fpcM_ERROR_PROCESS_ID_e)) { + if ((partIndex == 0) && (i_this->mMantPcId != 0xFFFF)) { mant_actor = (mant_class*)fopAcM_SearchByID(i_this->mMantPcId); if (mant_actor != NULL) { fopAcM_delete(mant_actor); } - i_this->mMantPcId = (u16)fpcM_ERROR_PROCESS_ID_e; + i_this->mMantPcId = 0xFFFF; } } break; @@ -3331,7 +3325,7 @@ static void part_move(tn_class* i_this, int partIndex) { } if (partIndex == 0) { i_this->mpArmorMorf->calc(); - if (i_this->mMantPcId != (u16)fpcM_ERROR_PROCESS_ID_e) { + if (i_this->mMantPcId != 0xFFFF) { mant_actor = (mant_class*)fopAcM_SearchByID(i_this->mMantPcId); if (mant_actor != NULL) { MTXCopy(i_this->mpArmorMorf->getModel()->getAnmMtx(REG6_S(5) + 6), *calc_mtx); @@ -3433,13 +3427,9 @@ static void spin_blur_set(tn_class* i_this) { /* 0000AEA8-0000BCE4 .text daTn_Execute__FP8tn_class */ static BOOL daTn_Execute(tn_class* i_this) { /* Nonmatching - retail-only regalloc */ - fopEn_enemy_c* actor = &i_this->actor; + fopEn_enemy_c* actor = (fopEn_enemy_c*)&i_this->actor; mant_class* mant_actor; daBoko_c* boko_actor; - cXyz local_a8; - cXyz cStack_b4; - cXyz local_c0; - cXyz local_cc; daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); #if VERSION > VERSION_DEMO @@ -3526,7 +3516,7 @@ static BOOL daTn_Execute(tn_class* i_this) { MtxTrans(-10000.0f, -10000.0f, 0.0f, false); boko_actor->setMatrix(*calc_mtx); } - if (i_this->mMantPcId != (u16)fpcM_ERROR_PROCESS_ID_e) { + if (i_this->mMantPcId != 0xFFFF) { mant_actor = (mant_class*)fopAcM_SearchByID(i_this->mMantPcId); if (mant_actor != NULL) { mant_actor->m1BE0.x = -10000.0f; @@ -3632,15 +3622,17 @@ static BOOL daTn_Execute(tn_class* i_this) { enemy_fire(&i_this->mEnemyFire); MtxTrans(actor->current.pos.x, actor->current.pos.y, actor->current.pos.z, false); cMtx_YrotM(*calc_mtx, actor->current.angle.y); + cXyz local_a8; local_a8.x = 0.0f; local_a8.y = 0.0f; local_a8.z = 35.0f; + cXyz cStack_b4; MtxPosition(&local_a8, &cStack_b4); i_this->mCoCyl.SetC(cStack_b4); dComIfG_Ccsp()->Set(&i_this->mCoCyl); dComIfG_Ccsp()->SetMass(&i_this->mCoCyl, 3); - local_c0 = i_this->m1384; - local_cc = actor->current.pos; + cXyz local_c0 = i_this->m1384; + cXyz local_cc = actor->current.pos; if (i_this->m03F0 != 0) { local_c0.y -= 20000.0f; local_cc.y -= 20000.0f; @@ -3779,7 +3771,7 @@ static BOOL daTn_Delete(tn_class* i_this) { i_this->mpBodyMorf->stopZelAnime(); } #endif - if (i_this->mMantPcId != (u16)fpcM_ERROR_PROCESS_ID_e) { + if (i_this->mMantPcId != 0xFFFF) { fopAc_ac_c* mant_actor = fopAcM_SearchByID(i_this->mMantPcId); if (mant_actor != NULL) { fopAcM_delete(mant_actor); @@ -4239,8 +4231,7 @@ static cPhs_State daTn_Create(fopAc_ac_c* a_this) { #endif } i_this->mEquipmentType = (a_this->current.angle.x >> 5) & 7; - a_this->current.angle.z = 0; - a_this->current.angle.x = 0; + a_this->current.angle.x = a_this->current.angle.z = 0; if (i_this->mArmorColorIndex > 5) { i_this->mArmorColorIndex = 5; } @@ -4342,7 +4333,7 @@ static cPhs_State daTn_Create(fopAc_ac_c* a_this) { i_this->m140C = 1; i_this->m0C34 = 1; if (i_this->mEquipmentType < EQUIPMENT_SHIELD_AND_CAPE) { - i_this->mMantPcId = (u16)fpcM_ERROR_PROCESS_ID_e; + i_this->mMantPcId = 0xFFFF; } else { i_this->mMantPcId = fopAcM_create(fpcNm_MANT_e, mant_class::Type_DARKNUT_e, &a_this->current.pos, fopAcM_GetRoomNo(a_this)); } diff --git a/src/d/d_stage.cpp b/src/d/d_stage.cpp index 902decf0d..37d481ad6 100644 --- a/src/d/d_stage.cpp +++ b/src/d/d_stage.cpp @@ -1305,7 +1305,7 @@ void dStage_actorCreate(stage_actor_data_class* i_actorData, fopAcM_prm_class* i } else { i_actorPrm->argument = nameinf_p->argument; i_actorPrm->gbaName = nameinf_p->gbaName; - fopAcM_create(nameinf_p->procname, NULL, i_actorPrm); + fopAcM_Create(nameinf_p->procname, NULL, i_actorPrm); } }