diff --git a/configure.py b/configure.py index 82246e93c..1cc083b4b 100755 --- a/configure.py +++ b/configure.py @@ -1278,7 +1278,7 @@ config.libs = [ Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_asin.c"), Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_atan2.c"), Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_fmod.c"), - Object(NonMatching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_pow.c"), # Demo-only + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_pow.c"), # Demo-only Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_rem_pio2.c"), Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_cos.c"), Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_rem_pio2.c"), @@ -1568,7 +1568,7 @@ config.libs = [ ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_auction"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_bb"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_bdk"), - ActorRel(Matching, "d_a_bdkobj"), + ActorRel(Matching, "d_a_bdkobj"), ActorRel(NonMatching, "d_a_bgn"), ActorRel(NonMatching, "d_a_bgn2"), ActorRel(NonMatching, "d_a_bgn3"), @@ -1577,17 +1577,17 @@ config.libs = [ ActorRel(NonMatching, "d_a_bl"), ActorRel(Matching, "d_a_bmd"), ActorRel(NonMatching, "d_a_bmdfoot"), - ActorRel(MatchingFor("D44J01"), "d_a_bmdhand"), + ActorRel(Matching, "d_a_bmdhand"), ActorRel(NonMatching, "d_a_bo"), ActorRel(Matching, "d_a_boss_item"), ActorRel(NonMatching, "d_a_bpw"), ActorRel(NonMatching, "d_a_bst"), ActorRel(Matching, "d_a_btd"), ActorRel(Matching, "d_a_bwd"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_bwdg"), - ActorRel(Matching, "d_a_bwds"), - ActorRel(Matching, "d_a_daiocta"), - ActorRel(Matching, "d_a_daiocta_eye"), + ActorRel(Matching, "d_a_bwdg"), + ActorRel(Matching, "d_a_bwds"), + ActorRel(Matching, "d_a_daiocta"), + ActorRel(Matching, "d_a_daiocta_eye"), ActorRel(Matching, "d_a_deku_item"), ActorRel(NonMatching, "d_a_dk"), ActorRel(Matching, "d_a_dummy"), @@ -1631,7 +1631,7 @@ config.libs = [ ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_npc_bmsw"), ActorRel(MatchingFor("D44J01"), "d_a_npc_bs1"), # regalloc ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_npc_btsw"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_npc_btsw2"), + ActorRel(Matching, "d_a_npc_btsw2"), ActorRel(NonMatching, "d_a_npc_co1"), ActorRel(NonMatching, "d_a_npc_de1"), ActorRel(NonMatching, "d_a_npc_ds1"), diff --git a/include/d/actor/d_a_bpw.h b/include/d/actor/d_a_bpw.h index 0ea9d5e1a..0dba8e9fc 100644 --- a/include/d/actor/d_a_bpw.h +++ b/include/d/actor/d_a_bpw.h @@ -34,9 +34,7 @@ struct bpw_class { /* 0x3B8 */ cXyz m3B8; /* 0x3C4 */ cXyz m3C4; /* 0x3D0 */ csXyz mKanteraDousaRot; - /* 0x3D6 */ s16 m3D6; - /* 0x3D8 */ s16 m3D8; - /* 0x3DA */ u16 m3DA; + /* 0x3D6 */ csXyz m3D6; /* 0x3DC */ u8 mType; /* 0x3DD */ u8 mUnknownParam2; /* 0x3DE */ u8 mLightState; diff --git a/src/d/actor/d_a_bdk.cpp b/src/d/actor/d_a_bdk.cpp index f07becdfc..6d6545777 100644 --- a/src/d/actor/d_a_bdk.cpp +++ b/src/d/actor/d_a_bdk.cpp @@ -284,20 +284,21 @@ static BOOL nodeCallBack(J3DNode* node, int calcTiming) { /* 00000B4C-00001008 .text tail_control__FP9bdk_classP10bdk_tail_s */ void tail_control(bdk_class* i_this, bdk_tail_s* tail) { - cXyz vec1, vec2, vec3; - f32 fVar1, fVar2; + cXyz sp10; + cXyz sp28; + cXyz sp1C; - vec1 = tail->m0150[1] - tail->m0150[0]; - tail->m0168.y = cM_atan2s(vec1.x, vec1.z); - tail->m0168.x = -cM_atan2s(vec1.y, std::sqrtf(vec1.x * vec1.x + vec1.z * vec1.z)); + sp10 = tail->m0150[1] - tail->m0150[0]; + tail->m0168.y = cM_atan2s(sp10.x, sp10.z); + tail->m0168.x = -cM_atan2s(sp10.y, std::sqrtf(sp10.x * sp10.x + sp10.z * sp10.z)); - vec1.x = 0.0f; - vec1.y = 0.0f; - vec1.z = 30.0f; + sp10.x = 0.0f; + sp10.y = 0.0f; + sp10.z = 30.0f; cMtx_YrotS(*calc_mtx, tail->m0168.y); cMtx_XrotM(*calc_mtx, tail->m0168.x); - MtxPosition(&vec1, &tail->m0170); + MtxPosition(&sp10, &tail->m0170); tail->m024[0] = tail->m0150[1]; @@ -307,47 +308,47 @@ void tail_control(bdk_class* i_this, bdk_tail_s* tail) { csXyz* array_9c = &tail->m09C[1]; cXyz* array_d8 = &tail->m0D8[1]; - fVar2 = i_this->mAcch.GetGroundH() + 5.0f; + f32 div = 0.77000004f; + f32 fVar2 = i_this->mAcch.GetGroundH() + 5.0f; if (i_this->mAction == ACTION_START) { fVar2 = -30000.0f; } for(i = 1; i < (s32)ARRAY_SIZE(tail->m024); i++, array_24++, array_9c++, array_d8++) { - fVar1 = 1.0f - (i - 1) * 0.1f; - vec3.x = array_d8->x + tail->m0170.x * fVar1; - vec3.y = array_d8->y + tail->m0170.y * fVar1; - vec3.z = array_d8->z + tail->m0170.z * fVar1; + f32 fVar1 = 1.0f - (i - 1) * 0.1f; + sp1C.x = array_d8->x + tail->m0170.x * fVar1; + sp1C.y = array_d8->y + tail->m0170.y * fVar1; + sp1C.z = array_d8->z + tail->m0170.z * fVar1; - f32 fVar3 = array_24->y + vec3.y; + f32 fVar3 = array_24->y + sp1C.y; if (fVar3 < fVar2) { fVar3 = fVar2; } fVar1 = fVar3 - array_24[-1].y; - f32 dx = vec3.x + (array_24->x - array_24[-1].x); - f32 dz = vec3.z + (array_24->z - array_24[-1].z); + f32 dx = sp1C.x + (array_24->x - array_24[-1].x); + f32 dz = sp1C.z + (array_24->z - array_24[-1].z); sVar2 = (s16)cM_atan2s(dx, dz); sVar1 = -cM_atan2s(fVar1, std::sqrtf(dx * dx + dz * dz)); array_9c[-1].y = sVar2; array_9c[-1].x = sVar1; - vec1.x = 0.0f; - vec1.y = 0.0f; - vec1.z = 2.0f * (20.0f * (0.25f + 0.03f * i)) * l_HIO.m00C * l_HIO.m010; + sp10.x = 0.0f; + sp10.y = 0.0f; + sp10.z = 2.0f * (20.0f * (0.25f + 0.03f * i)) * l_HIO.m00C * l_HIO.m010; cMtx_YrotS(*calc_mtx, sVar2); cMtx_XrotM(*calc_mtx, sVar1); - MtxPosition(&vec1, &vec2); + MtxPosition(&sp10, &sp28); array_d8->x = array_24->x; array_d8->y = array_24->y; array_d8->z = array_24->z; - array_24->x = array_24[-1].x + vec2.x; - array_24->y = array_24[-1].y + vec2.y; - array_24->z = array_24[-1].z + vec2.z; + array_24->x = array_24[-1].x + sp28.x; + array_24->y = array_24[-1].y + sp28.y; + array_24->z = array_24[-1].z + sp28.z; - f32 div = 0.77000004f; array_d8->x = (array_24->x - array_d8->x) * div; array_d8->y = (array_24->y - array_d8->y) * div; array_d8->z = (array_24->z - array_d8->z) * div; @@ -3532,7 +3533,7 @@ static BOOL daBdk_IsDelete(bdk_class* i_this) { /* 0000BD7C-0000BF08 .text daBdk_Delete__FP9bdk_class */ static BOOL daBdk_Delete(bdk_class* i_this) { fopAc_ac_c* actor = &i_this->actor; - dComIfG_resDelete(&i_this->mPhase, "Bdk"); + dComIfG_resDeleteDemo(&i_this->mPhase, "Bdk"); mDoHIO_deleteChild(l_HIO.mNo); if (actor->heap) { dComIfG_Bgsp()->Release(i_this->pm_bgw); diff --git a/src/d/actor/d_a_bmdfoot.cpp b/src/d/actor/d_a_bmdfoot.cpp index 31dfd7d88..1c13334ee 100644 --- a/src/d/actor/d_a_bmdfoot.cpp +++ b/src/d/actor/d_a_bmdfoot.cpp @@ -42,7 +42,7 @@ static daBmdfoot_HIO_c l_HIO; static BOOL nodeCallBack(J3DNode* node, int calcTiming) { if (calcTiming == J3DNodeCBCalcTiming_In) { J3DJoint* joint = (J3DJoint*)node; - s32 jntNo = joint->getJntNo(); + int jntNo = joint->getJntNo(); J3DModel* model = j3dSys.getModel(); bmdfoot_class* i_this = (bmdfoot_class*)model->getUserArea(); if (i_this != NULL) { @@ -89,7 +89,7 @@ void anm_init(bmdfoot_class* i_this, int bckFileIdx, f32 morf, unsigned char loo /* 000003D8-00000440 .text housi_off__FP13bmdfoot_class */ void housi_off(bmdfoot_class* i_this) { - for (s32 i = 0; i < ARRAY_SSIZE(i_this->mAsiWaitFollowCB); i++) { + for (int i = 0; i < ARRAY_SSIZE(i_this->mAsiWaitFollowCB); i++) { if (i_this->mAsiWaitFollowCB[i].getEmitter() != NULL) { i_this->mAsiWaitFollowCB[i].getEmitter()->stopCreateParticle(); } @@ -103,12 +103,12 @@ void housi_off(bmdfoot_class* i_this) { void wait(bmdfoot_class* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; cXyz local_98; - static s32 eff_id[] = {0x0A, 0x0C, 0x11}; + static int eff_id[] = {0x0A, 0x0C, 0x11}; int frame = i_this->mpBodyVineMorf->getFrame(); local_98.setall(0.0f); - for (s32 i = 0; i < ARRAY_SSIZE(i_this->m3F8); i++) { + for (int i = 0; i < ARRAY_SSIZE(i_this->m3F8); i++) { MTXCopy(i_this->mpBodyVineMorf->getModel()->getAnmMtx(eff_id[i]), *calc_mtx); MtxPosition(&local_98, &i_this->m3F8[i]); if (i_this->m3F4 == 0) { @@ -127,8 +127,8 @@ void wait(bmdfoot_class* i_this) { switch (i_this->m2BC) { case -1: - for (s32 i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { - cLib_addCalc2(&i_this->m2CC[i].x, (s32)(0x10 - i) * (0.003f + REG12_F(3)), 0.1f, 0.008f + REG12_F(4)); + for (int i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { + cLib_addCalc2(&i_this->m2CC[i].x, (int)(0x10 - i) * (0.003f + REG12_F(3)), 0.1f, 0.008f + REG12_F(4)); i_this->m3A4[i] = 0.0f; } if (i_this->m2C0[2] == 0) { @@ -142,7 +142,7 @@ void wait(bmdfoot_class* i_this) { anm_init(i_this, BMDFOOT_BCK_ASI_WAIT, 50.0f, J3DFrameCtrl::EMode_LOOP, cM_rndF(0.2f) + 0.9f, -1); i_this->m2C0[0] = cM_rndF(150.0f) + 100.0f; i_this->m3EC = cM_rndFX(32768.0f); - for (s32 i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { + for (int i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { i_this->m3A4[i] = REG14_F(13) + (0.2f + cM_rndFX(0.1f)); } break; @@ -175,11 +175,10 @@ void wait(bmdfoot_class* i_this) { void attack_1(bmdfoot_class* i_this) { /* Nonmatching - retail-only regalloc */ fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; - s32 i; cXyz local_5c; cXyz cStack_68; - static s32 jno[] = {0x0A, 0x0C, 0x11}; - static s32 col_joint[] = {0x01, 0x03, 0x05, 0x07, 0x09}; + static int jno[] = {0x0A, 0x0C, 0x11}; + static int col_joint[] = {0x01, 0x03, 0x05, 0x07, 0x09}; bool bVar2 = false; local_5c.setall(0.0f); @@ -210,7 +209,7 @@ void attack_1(bmdfoot_class* i_this) { if (i_this->mBD0 == 0) { i_this->mBD0 = 0x1e; } - for (i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { + for (int i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { i_this->m3A4[i] = 0.0f; cLib_addCalc0(&i_this->m2CC[i].z, 0.1f, 0.05f); } @@ -225,7 +224,7 @@ void attack_1(bmdfoot_class* i_this) { bVar2 = true; if (i_this->m2C0[0] == 1) { mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_ATTACK, &i_this->mAE8, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); - for (s32 i = 0; i < ARRAY_SSIZE(jno); i++) { + for (int i = 0; i < ARRAY_SSIZE(jno); i++) { MTXCopy(i_this->mpBodyVineMorf->getModel()->getAnmMtx(jno[i]), *calc_mtx); MtxPosition(&local_5c, &cStack_68); dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_BKMSATTACKHOUSHI00, &cStack_68, 0xFF, g_whiteColor, g_whiteColor, 0); @@ -254,7 +253,7 @@ void attack_1(bmdfoot_class* i_this) { if (bVar2) { J3DModel* model = i_this->mpBodyVineMorf->getModel(); - for (i = 0; i < ARRAY_SSIZE(i_this->mSph); i++) { + for (int i = 0; i < ARRAY_SSIZE(i_this->mSph); i++) { MTXCopy(model->getAnmMtx((i_this->m2B8 & 7U) + col_joint[i]), *calc_mtx); MtxPosition(&local_5c, &cStack_68); i_this->mSph[i].SetC(cStack_68); @@ -267,7 +266,7 @@ void attack_1(bmdfoot_class* i_this) { } /* 00000D8C-00001180 .text ug_move__FP13bmdfoot_class */ -s32 ug_move(bmdfoot_class* i_this) { +int ug_move(bmdfoot_class* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; cXyz local_4c; cXyz cStack_58; @@ -332,7 +331,7 @@ void attack_2(bmdfoot_class* i_this) { J3DAnmTransform* pBck; cXyz local_3c; cXyz local_48; - static s32 col_joint[] = {0x11, 0x0F, 0x0C, 0x09}; + static int col_joint[] = {0x11, 0x0F, 0x0C, 0x09}; local_3c.z = 0.0f; local_3c.y = 0.0f; @@ -352,7 +351,7 @@ void attack_2(bmdfoot_class* i_this) { } break; case 2: - if ((s32)i_this->mpBodyVineMorf->getFrame() == 49) { + if ((int)i_this->mpBodyVineMorf->getFrame() == 49) { MTXCopy(i_this->mpBodyVineMorf->getModel()->getAnmMtx(0x11), *calc_mtx); MtxPosition(&local_3c, &local_48); dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_BKMSATTACKHOUSHI00, &local_48, 0xFF, g_whiteColor, g_whiteColor, 0); @@ -375,7 +374,7 @@ void attack_2(bmdfoot_class* i_this) { } break; case 4: - if ((s32)i_this->mpFloorVineMorf->getFrame() == 2) { + if ((int)i_this->mpFloorVineMorf->getFrame() == 2) { local_48 = i_this->mBAC; dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_BKMSATTACKHOUSHI00, &local_48, 0xFF, g_whiteColor, g_whiteColor, 0); dComIfGp_particle_setSimple(dPa_name::ID_AK_SN_O_BKMSATTACKSOIL00, &local_48, 0xFF, g_whiteColor, g_whiteColor, 0); @@ -393,7 +392,7 @@ void attack_2(bmdfoot_class* i_this) { case 5: ug_move(i_this); mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_L_ATK, &i_this->mBAC, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); - for (s32 i = 0; i < ARRAY_SSIZE(col_joint); i++) { + for (int i = 0; i < ARRAY_SSIZE(col_joint); i++) { MTXCopy(i_this->mpFloorVineMorf->getModel()->getAnmMtx(col_joint[i]), *calc_mtx); MtxPosition(&local_3c, &local_48); i_this->mSph[i].SetC(local_48); @@ -408,7 +407,7 @@ void attack_2(bmdfoot_class* i_this) { break; case 6: ug_move(i_this); - if ((s32)i_this->mpFloorVineMorf->getFrame() == 12) { + if ((int)i_this->mpFloorVineMorf->getFrame() == 12) { dComIfGp_particle_set(dPa_name::ID_AK_SN_BKMLATTACKHOUSHI00, &i_this->mBAC); dComIfGp_particle_set(dPa_name::ID_AK_SN_BKMLATTACKSOIL00, &i_this->mBAC); i_this->m498[0].x = i_this->mBAC.x; @@ -427,7 +426,7 @@ void attack_2(bmdfoot_class* i_this) { } break; case 7: - if ((s32)i_this->mpBodyVineMorf->getFrame() == 13) { + if ((int)i_this->mpBodyVineMorf->getFrame() == 13) { local_48 = actor->current.pos; local_48.y = i_this->mBAC.y; dComIfGp_particle_set(dPa_name::ID_AK_SN_BKMLATTACKHOUSHI00, &local_48); @@ -464,13 +463,13 @@ void damage(bmdfoot_class* i_this) { i_this->m2BC++; i_this->m2C0[0] = 0x1e; i_this->m3EC = cM_rndFX(32768.0f); - for (s32 i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { + for (int i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { i_this->m3A4[i] = (0.3f + cM_rndFX(0.2f)); } case 1: if (i_this->m2C0[0] != 0) { dVar5 = ((fopAcM_GetParam(actor) & 0xf) * 0.01f); - for (s32 i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { + for (int i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { cLib_addCalc2(&i_this->m2CC[i].x, -(dVar5 + (0.05f + ((i) * (0.03f + REG14_F(3))))), 0.1f, REG14_F(4) + 0.1f); } } @@ -487,7 +486,7 @@ void damage(bmdfoot_class* i_this) { void start(bmdfoot_class* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; - for (s32 i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { + for (int i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { i_this->m2CC[i].z = 0; i_this->m3A4[i] = 0; } @@ -513,7 +512,7 @@ void start(bmdfoot_class* i_this) { } break; case 3: - if ((s32)i_this->mpBodyVineMorf->getFrame() == 2) { + if ((int)i_this->mpBodyVineMorf->getFrame() == 2) { mDoAud_seStart(JA_SE_CM_BKM_ATKVINE_MOVE_1, &i_this->mAE8, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } if (boss->m332 == 7) { @@ -526,7 +525,7 @@ void start(bmdfoot_class* i_this) { /* 00001ED8-00001FB8 .text end__FP13bmdfoot_class */ void end(bmdfoot_class* i_this) { - for (s32 i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { + for (int i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { i_this->m2CC[i].z = 0; i_this->m3A4[i] = 0; } @@ -602,13 +601,12 @@ void* s_a_d_sub(void* search, void* param_2) { static BOOL daBmdfoot_Execute(bmdfoot_class* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; cXyz local_68; - s32 i; if (boss == NULL) { boss = (bmd_class*)fpcM_Search(s_a_d_sub, i_this); } i_this->m2B8++; - for (i = 0; i < ARRAY_SSIZE(i_this->m2C0); i++) { + for (int i = 0; i < ARRAY_SSIZE(i_this->m2C0); i++) { if (i_this->m2C0[i] != 0) { i_this->m2C0[i]--; } @@ -621,8 +619,8 @@ static BOOL daBmdfoot_Execute(bmdfoot_class* i_this) { cMtx_YrotM(*calc_mtx, actor->current.angle.y + i_this->m2BE); cMtx_XrotM(*calc_mtx, actor->current.angle.x); cMtx_ZrotM(*calc_mtx, actor->current.angle.z + i_this->m2BE * 2); - J3DModel* pJVar5 = i_this->mpBodyVineMorf->getModel(); - pJVar5->setBaseTRMtx(*calc_mtx); + J3DModel* model = i_this->mpBodyVineMorf->getModel(); + model->setBaseTRMtx(*calc_mtx); i_this->mpBodyVineMorf->play(NULL, 0, 0); i_this->mpBodyVineMorf->calc(); if (i_this->mBD0 != 0) { @@ -636,7 +634,7 @@ static BOOL daBmdfoot_Execute(bmdfoot_class* i_this) { sVar1 = sVar1 % 30; } i_this->btk->setFrame(sVar1); - MTXCopy(pJVar5->getAnmMtx(REG14_S(6) + 0x10), *calc_mtx); + MTXCopy(model->getAnmMtx(REG14_S(6) + 0x10), *calc_mtx); local_68.z = 0.0f; local_68.y = 0.0f; local_68.x = 0.0f; @@ -652,7 +650,7 @@ static BOOL daBmdfoot_Execute(bmdfoot_class* i_this) { sVar1_2 = REG0_S(4); } cLib_addCalcAngleS2(&actor->current.angle.x, sVar1_2, 0x10, 0x80); - for (i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { + for (int i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { f32 f1 = i_this->m3A4[i] * cM_ssin(i_this->m3EC + i * (REG0_S(6) + 9000)); cLib_addCalc2(&i_this->m2CC[i].z, f1, 0.05f, 0.01f + REG14_F(5)); cLib_addCalc0(&i_this->m2CC[i].x, 0.05f, 0.005f + REG14_F(5)); @@ -674,7 +672,7 @@ static BOOL daBmdfoot_Delete(bmdfoot_class* i_this) { } mDoAud_seDeleteObject(&i_this->mAE8); mDoAud_seDeleteObject(&i_this->mBAC); - for (s32 i = 0; i < ARRAY_SSIZE(i_this->mAsiWaitFollowCB); i++) { + for (int i = 0; i < ARRAY_SSIZE(i_this->mAsiWaitFollowCB); i++) { i_this->mAsiWaitFollowCB[i].remove(); } i_this->mLAttackSmoke00CB[0].remove(); @@ -685,7 +683,7 @@ static BOOL daBmdfoot_Delete(bmdfoot_class* i_this) { } /* 000026B0-000029B4 .text useHeapInit__FP13bmdfoot_class */ -s32 useHeapInit(bmdfoot_class* i_this) { +int useHeapInit(bmdfoot_class* i_this) { i_this->mpBodyVineMorf = new mDoExt_McaMorf( (J3DModelData*)dComIfG_getObjectRes("Bmdfoot", BMDFOOT_BMD_ASI), NULL, @@ -805,7 +803,7 @@ static cPhs_State daBmdfoot_Create(fopAc_ac_c* a_this) { i_this->m2B8 = cM_rndF(10000.0f); boss = NULL; i_this->mStts.Init(0xFF, 0, a_this); - for (s32 i = 0; i < ARRAY_SSIZE(i_this->mSph); i++) { + for (int i = 0; i < ARRAY_SSIZE(i_this->mSph); i++) { i_this->mSph[i].SetStts(&i_this->mStts); i_this->mSph[i].Set(cc_sph_src); } diff --git a/src/d/actor/d_a_bmdhand.cpp b/src/d/actor/d_a_bmdhand.cpp index ce6d5de1b..abd553dc9 100644 --- a/src/d/actor/d_a_bmdhand.cpp +++ b/src/d/actor/d_a_bmdhand.cpp @@ -36,7 +36,7 @@ static bmd_class* boss; static bool hio_set; static daBmdhand_HIO_c l_HIO; -static s32 boss_joint_d[] = {0x1C, 0x1C, 0x1C, 0x1C, 0x25, 0x25, 0x25, 0x25, 0x2E, 0x2E, 0x2E, 0x2E, 0x40, 0x40, 0x40, 0x40, 0x37, 0x37, 0x37, 0x37}; +static int boss_joint_d[] = {0x1C, 0x1C, 0x1C, 0x1C, 0x25, 0x25, 0x25, 0x25, 0x2E, 0x2E, 0x2E, 0x2E, 0x40, 0x40, 0x40, 0x40, 0x37, 0x37, 0x37, 0x37}; static f32 boss_joint_xad[] = {60.0f, 20.0f, -20.0f, -60.0f}; /* 00000118-000001CC .text hand_draw__FP13bmdhand_class */ @@ -83,11 +83,11 @@ void hand_mtx_set(bmdhand_class* i_this) { /* 00000310-00000388 .text control3__FP13bmdhand_class */ void control3(bmdhand_class* i_this) { hand_s* hand_i = &i_this->m324[0]; - for (s32 i = 0; i < ARRAY_SSIZE(i_this->m324); i++, hand_i++) { + for (int i = 0; i < ARRAY_SSIZE(i_this->m324); i++, hand_i++) { if (i < 10) { hand_i->m18 = 10.5f; } else { - hand_i->m18 = (15.0f - (s32)(i - 10)) * 0.7f; + hand_i->m18 = (15.0f - (int)(i - 10)) * 0.7f; } } } @@ -100,7 +100,7 @@ void control1(bmdhand_class* i_this) { f32 dVar7; i_this->m324[0].m00 = actor->current.pos; - s32 i = 1; + int i = 1; hand_s* hand_i = &i_this->m324[1]; cMtx_YrotS(*calc_mtx, actor->current.angle.y); cXyz local_94; @@ -144,7 +144,7 @@ void control2(bmdhand_class* i_this) { cLib_addCalc2(&i_this->m324[0x13].m00.y, (i_this->m2D8).y, 1.0f, i_this->m30C * 50.0f); cLib_addCalc2(&i_this->m324[0x13].m00.z, (i_this->m2D8).z, 1.0f, i_this->m30C * 50.0f); cLib_addCalc2(&i_this->m30C, 1.0f, 1.0f, 0.01f); - s32 i = 0x12; + int i = 0x12; s16 iVar4; int iVar3; hand_s* hand_i = &i_this->m324[0x12]; @@ -173,10 +173,10 @@ void control2(bmdhand_class* i_this) { /* 00000A1C-00000EFC .text cut_control__FP13bmdhand_class */ void cut_control(bmdhand_class* i_this) { - /* Nonmatching - retail-only regalloc */ fopAc_ac_c* actor = &i_this->actor; i_this->m324[0].m00 = actor->current.pos; + int i; hand_s* hand_i = &i_this->m324[1]; cXyz local_e8; cXyz cStack_f4; @@ -196,7 +196,7 @@ void cut_control(bmdhand_class* i_this) { dVar9 = (REG7_F(10) + 0.5f); cXyz local_100_scaled; cXyz local_124; - for (s32 i = 1; i < ARRAY_SSIZE(i_this->m324); i++, hand_i++) { + for (i = 1; i < ARRAY_SSIZE(i_this->m324); i++, hand_i++) { local_124.x = i_this->m31C * cM_ssin(i_this->m2B8 * (REG0_S(4) + 0xdac) + i * (REG0_S(5) + 4000)); local_124.y = i_this->m31C * cM_scos(i_this->m2B8 * (REG0_S(6) + 4000) + i * (REG0_S(7) + 4000)); local_124.z = i_this->m31C * cM_scos(i_this->m2B8 * (REG0_S(8) + 0xed8) + i * (REG0_S(9) + 4000)); @@ -233,11 +233,11 @@ void cut_control(bmdhand_class* i_this) { void cut_control3(bmdhand_class* i_this) { hand_s* hand_i = &i_this->m324[0]; - for (s32 i = 0; i < ARRAY_SSIZE(i_this->m324); i++, hand_i++) { + for (int i = 0; i < ARRAY_SSIZE(i_this->m324); i++, hand_i++) { if (i < 10) { hand_i->m18 = 10.5f; } else { - hand_i->m18 = (15.0f - (s32)(i - 10)) * 0.7f; + hand_i->m18 = (15.0f - (int)(i - 10)) * 0.7f; } } cLib_addCalc2(&i_this->m2F0.y, i_this->m2CC.y, 1.0f, 10.0f); @@ -256,7 +256,7 @@ void start_control1(bmdhand_class* i_this) { cXyz local_c4; i_this->m324[0].m00 = actor->current.pos; - s32 i = 1; + int i = 1; hand_s* hand_i = &i_this->m324[1]; cMtx_YrotS(*calc_mtx, actor->current.angle.y); local_94.x = 0.0f; @@ -293,7 +293,7 @@ void start_control2(bmdhand_class* i_this) { local_7c.y = 0.0f; local_7c.z = i_this->m310; i_this->m324[0x13].m00 = (i_this->m2D8); - s32 i = 0x12; + int i = 0x12; s16 iVar4; int iVar3; hand_s* hand_i = &i_this->m324[0x12]; @@ -629,7 +629,7 @@ void hand_move(bmdhand_class* i_this) { } cXyz* line_data = i_this->mLineMat.getPos(0); u8* line_size = i_this->mLineMat.getSize(0); - for (s32 i = 0; i < ARRAY_SSIZE(i_this->m324); i++, hand_i++, line_data++, line_size++) { + for (int i = 0; i < ARRAY_SSIZE(i_this->m324); i++, hand_i++, line_data++, line_size++) { *line_data = hand_i->m00; *line_size = hand_i->m18; @@ -639,7 +639,7 @@ void hand_move(bmdhand_class* i_this) { i_this->m5CC.SetC(actor->eyePos); dComIfG_Ccsp()->Set(&i_this->m5CC); } else { - s32 r0 = ((i_this->m2B8 & 3) * 4) + 3; + int r0 = ((i_this->m2B8 & 3) * 4) + 3; if (r0 == i) { i_this->m6F8.SetC(hand_i->m00); dComIfG_Ccsp()->Set(&i_this->m6F8); @@ -675,7 +675,7 @@ static BOOL daBmdhand_Execute(bmdhand_class* i_this) { boss = (bmd_class*)fpcM_Search(s_a_d_sub, i_this); } i_this->m2B8++; - for (s32 i = 0; i < ARRAY_SSIZE(i_this->m2C0); i++) { + for (int i = 0; i < ARRAY_SSIZE(i_this->m2C0); i++) { if (i_this->m2C0[i] != 0) { i_this->m2C0[i]--; } @@ -723,7 +723,7 @@ static BOOL daBmdhand_Delete(bmdhand_class* i_this) { } /* 000030C4-00003210 .text useHeapInit__FP13bmdhand_class */ -s32 useHeapInit(bmdhand_class* i_this) { +static BOOL useHeapInit(bmdhand_class* i_this) { i_this->mpMorf = new mDoExt_McaMorf( (J3DModelData*)dComIfG_getObjectRes("Bmdhand", BMDHAND_BMD_BKM_FOOK), NULL, diff --git a/src/d/actor/d_a_bpw.cpp b/src/d/actor/d_a_bpw.cpp index 4bd6aec94..34dc41c7d 100644 --- a/src/d/actor/d_a_bpw.cpp +++ b/src/d/actor/d_a_bpw.cpp @@ -156,9 +156,9 @@ void draw_SUB(bpw_class* i_this) { J3DModel* model = i_this->mpMorf->getModel(); model->setBaseScale(actor->scale); mDoMtx_stack_c::transS(actor->current.pos.x + i_this->m3AC.x, actor->current.pos.y + i_this->m3AC.y, actor->current.pos.z + i_this->m3AC.z); - mDoMtx_stack_c::YrotM(i_this->m3D8); - mDoMtx_stack_c::XrotM(i_this->m3D6); - mDoMtx_stack_c::YrotM(-i_this->m3D8); + mDoMtx_stack_c::YrotM(i_this->m3D6.y); + mDoMtx_stack_c::XrotM(i_this->m3D6.x); + mDoMtx_stack_c::YrotM(-i_this->m3D6.y); mDoMtx_stack_c::YrotM(actor->shape_angle.y); mDoMtx_stack_c::XrotM(actor->shape_angle.x); mDoMtx_stack_c::ZrotM(actor->shape_angle.z); @@ -597,7 +597,7 @@ void fuwafuwa_calc(bpw_class* i_this) { /* 000018EC-00001A50 .text kankyou_hendou__FP9bpw_class */ void kankyou_hendou(bpw_class* i_this) { - /* Nonmatching - missing "b" instruction */ + /* Nonmatching - missing "b" instruction for case 0; equivalent */ f32 fVar1; u8 bVar2; @@ -1026,8 +1026,6 @@ s32 kantera_pos_search(bpw_class* i_this) { f32 fVar1; f32 fVar2; fopAc_ac_c* pfVar3; - f32 dVar5; - f32 dVar6; cXyz local_44; cXyz local_50; @@ -1035,9 +1033,7 @@ s32 kantera_pos_search(bpw_class* i_this) { pfVar3 = fopAcM_SearchByID(i_this->m3FC); if (pfVar3 != NULL) { fVar1 = (pfVar3->current).pos.x - i_this->mBodyPos.x; - dVar6 = fVar1; fVar2 = (pfVar3->current).pos.z - i_this->mBodyPos.z; - dVar5 = fVar2; cMtx_YrotS(*calc_mtx, (s16)cM_atan2s(fVar1, fVar2)); local_44.x = -120.0f; local_44.y = -20.0f; @@ -1047,7 +1043,7 @@ s32 kantera_pos_search(bpw_class* i_this) { cLib_addCalc2(&actor->current.pos.x, local_50.x, 1.0f, 120.0f); cLib_addCalc2(&actor->current.pos.y, local_50.y, 1.0f, 120.0f); cLib_addCalc2(&actor->current.pos.z, local_50.z, 1.0f, 120.0f); - i_this->m476 = (s16)cM_atan2s(dVar6, dVar5); + i_this->m476 = (s16)cM_atan2s(fVar1, fVar2); f32 fVar_x = actor->current.pos.x - local_50.x; f32 fVar_y = actor->current.pos.y - local_50.y; f32 fVar_z = actor->current.pos.z - local_50.z; @@ -1062,11 +1058,10 @@ s32 kantera_pos_search(bpw_class* i_this) { /* 00002BA8-000035F8 .text action_dousa__FP9bpw_class */ void action_dousa(bpw_class* i_this) { - /* Nonmatching - regalloc */ + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); fopAc_ac_c* actor = &i_this->actor; cXyz local_c0; - daPy_py_c* player = daPy_getPlayerActorClass(); dBgS_LinChk linChk; switch (i_this->mActionState) { case 0: @@ -1914,7 +1909,7 @@ void action_damage(bpw_class* i_this) { i_this->m47A = 0; i_this->m3AC.y = 340.0f; if (REG8_S(3) != 0) { - i_this->m3D8 = player->shape_angle.y; + i_this->m3D6.y = player->shape_angle.y; actor->shape_angle.x = -0x4000; actor->shape_angle.z = 0; } else { @@ -1939,16 +1934,14 @@ void action_damage(bpw_class* i_this) { case ACTION_STATE_DAMAGE_THROWN: { fopAcM_seStart(actor, JA_SE_CM_BPW_ROLLING, 0); if (REG8_S(3) != 0) { - i_this->m3D6 = i_this->m3D6 + 5000; + i_this->m3D6.x += 5000; } else { actor->shape_angle.x = actor->shape_angle.x + 0x1000; } int r25 = wall_HIT_check(i_this); if (r25 != 0) { i_this->m3E5 = 0; - i_this->m3D6 = 0; - i_this->m3D8 = 0; - i_this->m3DA = 0; + i_this->m3D6.setall(0); dComIfGp_getCamera(0)->mCamera.ForceLockOff(fopAcM_GetID(i_this)); actor->current.angle.y = cM_atan2s(i_this->mBodyPos.x - actor->current.pos.x, i_this->mBodyPos.z - actor->current.pos.z); if (r25 == 2) { @@ -2065,17 +2058,12 @@ void action_bunri_dousa(bpw_class* i_this) { fopAc_ac_c* actor = &i_this->actor; f32 fVar2; pw_class* childPoe; - s8 hpAmountToEndPhaseAt; - f32 dVar7; - f32 dVar8; f32 fVar9; cXyz local_68; cXyz local_74; cXyz sp70; - s8 currHp; f32 f1; f32 f2; - s16 r5; daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); camera_class* camera = (camera_class*)dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); @@ -2140,7 +2128,8 @@ void action_bunri_dousa(bpw_class* i_this) { i_this->mSomeCountdownTimers[0] = DEMO_SELECT(0x186, 0x1A4); i_this->mActionState++; } - case ACTION_STATE_SEPARATE_BUNRI_DOUSA_EXECUTE: + case ACTION_STATE_SEPARATE_BUNRI_DOUSA_EXECUTE: { + s8 hpAmountToEndPhaseAt; switch (i_this->m3F6) { case 0: hpAmountToEndPhaseAt = 10; @@ -2152,8 +2141,7 @@ void action_bunri_dousa(bpw_class* i_this) { hpAmountToEndPhaseAt = 0; break; } - currHp = actor->health; - if (currHp <= 0) { + if (actor->health <= 0) { if (dComIfGp_getStartStageName()[0] == 'X') { dComIfGs_onEventBit(dSv_event_flag_c::JALHALLA_TRIALS_CLEAR); dComIfGs_onTmpBit(dSv_event_tmp_flag_c::UNK_0480); @@ -2168,13 +2156,14 @@ void action_bunri_dousa(bpw_class* i_this) { } break; } - if ((i_this->mSomeCountdownTimers[0] != 0) && (currHp > hpAmountToEndPhaseAt)) { + if ((i_this->mSomeCountdownTimers[0] != 0) && (actor->health > hpAmountToEndPhaseAt)) { break; } i_this->mBodyCoSph.OnCoSetBit(); fopAcM_OnStatus(actor, fopAcStts_UNK4000_e); i_this->mActionState++; // fallthrough + } case 0x70: for (s32 i = 0; i < actor->health; i++) { childPoe = (pw_class*)fopAcM_SearchByID(i_this->mChildPoeIds[i]); @@ -2228,9 +2217,7 @@ void action_bunri_dousa(bpw_class* i_this) { i_this->m476 = actor->shape_angle.y; cLib_addCalcAngleS2(&i_this->m47E, i_this->m480, 1, 0xf); cLib_addCalc2(&actor->scale.x, 1.0f, 1.0f, 0.1f); - fVar9 = actor->scale.x; - actor->scale.z = fVar9; - actor->scale.y = fVar9; + actor->scale.y = actor->scale.z = actor->scale.x; if ((i_this->m3E9 == 0) && (actor->scale.x > 0.9f)) { actor->scale.setall(1.0f); i_this->m3E9 = 1; @@ -2338,10 +2325,9 @@ void action_bunri_dousa(bpw_class* i_this) { dComIfGp_event_reset(); next_status_clear(i_this, 1); next_att_wait_check(i_this); - currHp = actor->health; - if (currHp <= 5) { + if (actor->health <= 5) { i_this->m3F6 = 2; - } else if (currHp <= 10) { + } else if (actor->health <= 10) { i_this->m3F6 = 1; } actor->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e; @@ -2390,7 +2376,7 @@ void action_bunri_dousa(bpw_class* i_this) { camera->mCamera.SetTrimSize(2); mDoAud_bgmStop(30); i_this->m474 = 1; - i_this->mSomeCountdownTimers[0] = (s16)(int)(REG20_F(0) + 135.0f); + i_this->mSomeCountdownTimers[0] = REG20_F(0) + 135.0f; i_this->mActionState++; childPoe = (pw_class*)fopAcM_SearchByID(i_this->mChildPoeIds[i_this->m462]); if (childPoe != NULL) { @@ -2418,7 +2404,7 @@ void action_bunri_dousa(bpw_class* i_this) { i_this->m40C.z = i_this->m424.z; cLib_addCalc2(&i_this->m40C.y, i_this->m424.y + 150.0f + REG12_F(17), 0.1f, 10.0f); #endif - cMtx_YrotS(*calc_mtx, (int)i_this->m464); + cMtx_YrotS(*calc_mtx, i_this->m464); local_68.x = 0.0f; local_68.y = 0.0f; local_68.z = 800.0f; @@ -2437,7 +2423,7 @@ void action_bunri_dousa(bpw_class* i_this) { i_this->m418.z = local_74.z; #endif if (i_this->mSomeCountdownTimers[0] == 0) { - i_this->mSomeCountdownTimers[0] = (s16)(int)(REG20_F(1) + 25.0f); + i_this->mSomeCountdownTimers[0] = REG20_F(1) + 25.0f; if (REG20_S(1) == 0) { REG20_S(0) = 1; } @@ -2491,9 +2477,9 @@ void action_bunri_dousa(bpw_class* i_this) { break; } actor->scale.setall(1.0f); - i_this->mSomeCountdownTimers[0] = (s16)(int)(REG20_F(9) + 10.0f); - i_this->mSomeCountdownTimers[1] = (s16)(int)(REG20_F(10) + 100.0f); - i_this->mSomeCountdownTimers[4] = (s16)(int)(REG12_F(12) + 30.0f); + i_this->mSomeCountdownTimers[0] = REG20_F(9) + 10.0f; + i_this->mSomeCountdownTimers[1] = REG20_F(10) + 100.0f; + i_this->mSomeCountdownTimers[4] = REG12_F(12) + 30.0f; i_this->mActionState++; #if VERSION > VERSION_DEMO i_this->m43C = 0.0f; @@ -2501,8 +2487,8 @@ void action_bunri_dousa(bpw_class* i_this) { // Fall-through case 0x7b: if (i_this->mSomeCountdownTimers[0] != 0) { - i_this->mSomeCountdownTimers[1] = (s16)(int)(REG20_F(10) + 100.0f); - i_this->mSomeCountdownTimers[4] = (s16)(int)(REG12_F(12) + 30.0f); + i_this->mSomeCountdownTimers[1] = REG20_F(10) + 100.0f; + i_this->mSomeCountdownTimers[4] = REG12_F(12) + 30.0f; break; } cLib_addCalc2(&i_this->m440, REG20_F(11) + 50.0f, 1.0f, 0.5f); @@ -2568,7 +2554,7 @@ void action_bunri_dousa(bpw_class* i_this) { if (!i_this->mpMorf->isStop()) { break; } - i_this->mSomeCountdownTimers[0] = (s16)(int)(REG19_F(0) + 60.0f); + i_this->mSomeCountdownTimers[0] = REG19_F(0) + 60.0f; i_this->mActionState++; // fallthrough case 0x7d: @@ -2596,7 +2582,7 @@ void action_bunri_dousa(bpw_class* i_this) { i_this->m43C = 0.0f; #endif // fallthrough - case 0x7e: + case 0x7e: { if (i_this->mSomeCountdownTimers[0] == 0) { fopAcM_seStart(actor, JA_SE_CM_BPW_MASK_RUN_AWAY, 0); } @@ -2624,8 +2610,8 @@ void action_bunri_dousa(bpw_class* i_this) { #endif cLib_addCalc2(&actor->current.pos.x, -1130.0f, 1.0f, REG19_F(13) + 20.0f); cLib_addCalc2(&actor->current.pos.z, 30.0f, 1.0f, REG19_F(13) + 20.0f); - dVar7 = actor->current.pos.x - -1130.0f; - dVar8 = actor->current.pos.z - 30.0f; + f32 dVar7 = actor->current.pos.x - -1130.0f; + f32 dVar8 = actor->current.pos.z - 30.0f; i_this->m476 = cM_atan2s(dVar7, dVar8) + 0x8000; sp70.x = -36.0f; sp70.y = player->current.pos.y; @@ -2644,8 +2630,8 @@ void action_bunri_dousa(bpw_class* i_this) { } REG20_S(0) = 0; i_this->m47C = 0; - i_this->mSomeCountdownTimers[0] = (s16)(int)(REG18_F(5) + 63.0f); - i_this->mSomeCountdownTimers[1] = (s16)(int)(REG18_F(6) + 75.0f); + i_this->mSomeCountdownTimers[0] = REG18_F(5) + 63.0f; + i_this->mSomeCountdownTimers[1] = REG18_F(6) + 75.0f; mDoAud_bgmStreamPrepare(JA_STRM_BOSS_CLEAR); i_this->mActionState++; #if VERSION > VERSION_DEMO @@ -2653,6 +2639,7 @@ void action_bunri_dousa(bpw_class* i_this) { #endif } break; + } case 0x7f: if (i_this->mSomeCountdownTimers[0] != 0) { fopAcM_seStart(actor, JA_SE_CM_BPW_MASK_RUN_AWAY, 0); @@ -2661,10 +2648,8 @@ void action_bunri_dousa(bpw_class* i_this) { mDoAud_bgmStreamPlay(); } i_this->m47C += REG18_F(2) + 700.0f; - dVar7 = cM_ssin((int)i_this->m47C); - i_this->m3AC.x = (f32)((REG18_F(3) + 30.0f) * dVar7); - dVar7 = cM_ssin((int)i_this->m47C); - i_this->m3AC.z = (f32)((REG18_F(4) + 30.0f) * dVar7); + i_this->m3AC.x = (REG18_F(3) + 30.0f) * cM_ssin(i_this->m47C); + i_this->m3AC.z = (REG18_F(4) + 30.0f) * cM_ssin(i_this->m47C); cLib_addCalcAngleS2(&i_this->m476, -0x8000, 1, 0x2000); actor->speed.y = REG19_F(14) + 30.0f; cLib_addCalc2(&i_this->m440, REG19_F(15) + 50.0f, 1.0f, 0.5f); @@ -2699,7 +2684,7 @@ void action_bunri_dousa(bpw_class* i_this) { REG20_S(0) = 0; i_this->m3F6 = 4; fopAcM_monsSeStart(actor, JA_SE_CV_BPW_DIE, 0); - i_this->mSomeCountdownTimers[0] = (s16)(int)(REG18_F(8) + 40.0f); + i_this->mSomeCountdownTimers[0] = REG18_F(8) + 40.0f; i_this->mActionState++; } break; @@ -2742,14 +2727,14 @@ void action_bunri_dousa(bpw_class* i_this) { i_this->m3E0 = 1; i_this->m47E = 0xFF; i_this->mpMorf->setPlaySpeed(0.0f); - i_this->mSomeCountdownTimers[0] = (s16)(int)(REG18_F(17) + 40.0f); + i_this->mSomeCountdownTimers[0] = REG18_F(17) + 40.0f; i_this->mActionState++; // fallthrough case 0x82: if (i_this->mSomeCountdownTimers[0] != 0) { break; } - i_this->mSomeCountdownTimers[0] = (s16)(int)(REG18_F(18) + 20.0f); + i_this->mSomeCountdownTimers[0] = REG18_F(18) + 20.0f; actor->gravity = -1.0f; i_this->mActionState++; // fallthrough @@ -2865,10 +2850,10 @@ void action_bunri_dousa(bpw_class* i_this) { fopAcM_seStart(actor, JA_SE_CM_BPW_MASK_BREAK, 0); actor->scale.setall(0.0f); i_this->mActionState++; - i_this->mSomeCountdownTimers[0] = (s16)(int)(REG12_F(16) + 120.0f); + i_this->mSomeCountdownTimers[0] = REG12_F(16) + 120.0f; // fallthrough } - case 0x87: + case 0x87: { if (i_this->mSomeCountdownTimers[0] != 0) { #if VERSION > VERSION_DEMO cLib_addCalc2(&i_this->m40C.y, REG12_F(13) + 186.0f, 0.3f, REG12_F(14) + 100.0f); @@ -2880,16 +2865,13 @@ void action_bunri_dousa(bpw_class* i_this) { sp70.x = -36.0f; sp70.y = player->current.pos.y; sp70.z = -777.0f; - r5 = cM_atan2s(f1, f2) + 0x8000; - player->setPlayerPosAndAngle(&sp70, r5); + player->setPlayerPosAndAngle(&sp70, cM_atan2s(f1, f2) + 0x8000); i_this->m40C.setall(0.0f); i_this->m3F0 = REG9_F(1) + 1400.0f; - i_this->m3F4 = (s16)(int)(REG9_F(2) + -15000.0f); - dVar7 = cM_ssin((int)i_this->m3F4); - i_this->m418.x = (f32)(i_this->m3F0 * dVar7); + i_this->m3F4 = REG9_F(2) + -15000.0f; + i_this->m418.x = (f32)(i_this->m3F0 * cM_ssin(i_this->m3F4)); i_this->m418.y = REG9_F(3) + 900.0f; - dVar7 = cM_scos((int)i_this->m3F4); - i_this->m418.z = (f32)(i_this->m3F0 * dVar7); + i_this->m418.z = (f32)(i_this->m3F0 * cM_scos(i_this->m3F4)); if (REG20_S(1) == 0) { REG20_S(0) = 1; } @@ -2901,19 +2883,19 @@ void action_bunri_dousa(bpw_class* i_this) { if (REG0_S(3) == 0) { dComIfGs_onStageBossEnemy(); } - i_this->mSomeCountdownTimers[1] = (s16)(int)(REG9_F(4) + 80.0f); - i_this->mSomeCountdownTimers[2] = (s16)(int)(REG9_F(5) + 470.0f); + i_this->mSomeCountdownTimers[1] = REG9_F(4) + 80.0f; + i_this->mSomeCountdownTimers[2] = REG9_F(5) + 470.0f; i_this->mSomeCountdownTimers[9] = 0; i_this->mActionState++; // fallthrough - case 0x88: + } + case 0x88: { f1 = player->current.pos.x - i_this->mBodyPos.x; f2 = player->current.pos.z - i_this->mBodyPos.z; sp70.x = -36.0f; sp70.y = player->current.pos.y; sp70.z = -777.0f; - r5 = cM_atan2s(f1, f2) + 0x8000; - player->setPlayerPosAndAngle(&sp70, r5); + player->setPlayerPosAndAngle(&sp70, cM_atan2s(f1, f2) + 0x8000); if (i_this->mSomeCountdownTimers[9] == 1) { i_this->m3EC = 0.0f; i_this->mKankyouHendouState = 6; @@ -2929,11 +2911,9 @@ void action_bunri_dousa(bpw_class* i_this) { i_this->m3F4 = 0; } cLib_addCalc2(&i_this->m3F0, REG9_F(8) + 600.0f, 1.0f, REG9_F(9) + 2.0f); - dVar7 = cM_ssin((int)i_this->m3F4); - i_this->m418.x = (f32)(i_this->m3F0 * dVar7); + i_this->m418.x = (f32)(i_this->m3F0 * cM_ssin(i_this->m3F4)); cLib_addCalc2(&i_this->m418.y, REG9_F(10) + 900.0f, 1.0f, REG9_F(11) + 10.0f); - dVar7 = cM_scos((int)i_this->m3F4); - i_this->m418.z = (f32)(i_this->m3F0 * dVar7); + i_this->m418.z = (f32)(i_this->m3F0 * cM_scos(i_this->m3F4)); break; } fVar2 = 0.0f; @@ -2962,7 +2942,8 @@ void action_bunri_dousa(bpw_class* i_this) { player->cancelOriginalDemo(); dComIfGp_event_reset(); fopAcM_delete(actor); - // fallthrough + break; + } } if (i_this->mActionState >= 0x78) { i_this->m3AC.y = 100.0f; @@ -4024,7 +4005,7 @@ void torituki_execute(bpw_class* i_this) { daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); if (((i_this->mSomeCountdownTimers[8] == 1 || (dComIfGp_getDetect().chk_light(&actor->current.pos))) || (dComIfGp_checkPlayerStatus1(0, daPyStts1_UNK2000_e))) || - ((s16)player->mDamageWaitTimer != 0 || (player->checkFairyUse()))) + (player->getDamageWaitTimer() != 0 || (player->checkFairyUse()))) { player->offConfuse(); i_this->mSomeCountdownTimers[8] = 0; @@ -4060,7 +4041,7 @@ void torituki_execute(bpw_class* i_this) { /* 0000C154-0000C5C0 .text daBPW_Execute__FP9bpw_class */ static BOOL daBPW_Execute(bpw_class* i_this) { - /* Nonmatching - retail-only regalloc */ + /* Nonmatching - retail-only fpr regalloc */ fopAc_ac_c* actor = &i_this->actor; cXyz local_1c; cXyz local_28; @@ -4139,9 +4120,13 @@ static BOOL daBPW_Execute(bpw_class* i_this) { } else if (vec1.z < -1.0f) { vec1.z = -1.0f; } - JGeometry::TVec3 dir(vec1.x, 0.1f, vec1.z); + JGeometry::TVec3 dir; + dir.x = vec1.x; + dir.y = 0.1f; + dir.z = vec1.z; emitter->setDirection(dir); - JGeometry::TVec3 vel = actor->current.pos - actor->old.pos; + JGeometry::TVec3 vel; + vel = actor->current.pos - actor->old.pos; Vec vec2; vec2.x = 1.0f; vec2.y = 1.0f + std::sqrtf(SQUARE(vel.x) + SQUARE(vel.y) + SQUARE(vel.z)) * 0.05f; diff --git a/src/d/actor/d_a_bst.cpp b/src/d/actor/d_a_bst.cpp index dfe73d74a..50c1ed0f2 100644 --- a/src/d/actor/d_a_bst.cpp +++ b/src/d/actor/d_a_bst.cpp @@ -129,7 +129,8 @@ static BOOL nodeCallBackHead(J3DNode* node, int calcTiming) { J3DModel* model = j3dSys.getModel(); bst_class* i_this = (bst_class*)model->getUserArea(); if (i_this != NULL) { - cMtx_copy(model->getAnmMtx(jnt_no), *calc_mtx); + MtxP mtx = model->getAnmMtx(jnt_no); + cMtx_copy(mtx, *calc_mtx); if (jnt_no == 9) { cMtx_YrotM(*calc_mtx, -i_this->m2E78[1]); } else if (jnt_no == 12) { @@ -178,7 +179,8 @@ static BOOL daBst_Draw(bst_class* i_this) { for (u16 i = 0; i < model_2B8->getModelData()->getWEvlpMtxNum(); i++) { model_388->setWeightAnmMtx(i, model_2B8->getWeightAnmMtx(i)); } - cMtx_copy(i_this->m02B8->getModel()->getAnmMtx(0), *calc_mtx); + MtxP mtx = i_this->m02B8->getModel()->getAnmMtx(0); + cMtx_copy(mtx, *calc_mtx); temp.setall(0.0f); MtxPosition(&temp, &shadow_pos); shadow_pos.y += REG0_F(1) * 10.0f; @@ -190,6 +192,7 @@ static BOOL daBst_Draw(bst_class* i_this) { g_env_light.setLightTevColorType(model_2C8, &i_this->mEnvLight); mDoExt_modelUpdateDL(model_2C8); if (i_this->mBstPartType == bst_class::Type_HEAD_e) { +#if VERSION > VERSION_DEMO if (i_this->m2E98 > 1) { mDoGph_gInf_c::setBlureRate(i_this->m2E98); mDoGph_gInf_c::onBlure(); @@ -197,8 +200,8 @@ static BOOL daBst_Draw(bst_class* i_this) { i_this->m2E98 = 0; mDoGph_gInf_c::offBlure(); } +#endif beam_draw(i_this); - // yup, this is a static var. static cXyz center_pos(0.0f, 0.0f, 0.0f); g_env_light.settingTevStruct(TEV_TYPE_BG0, ¢er_pos, &i_this->m2F20); g_env_light.setLightTevColorType(i_this->m2FDC, &i_this->m2F20); @@ -244,7 +247,9 @@ static void stay(bst_class* i_this) { fopAc_ac_c* actor = &i_this->actor; fopAcM_OffStatus(actor, 0); actor->attention_info.flags = 0; +#if VERSION > VERSION_DEMO i_this->mState = 10; +#endif switch (i_this->mDamage) { case 0: anm_init(i_this, set_bck_d[i_this->mBstPartType], 2.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); @@ -280,7 +285,8 @@ static void stay(bst_class* i_this) { case 5: if (i_this->mBstPartType != bst_class::Type_HEAD_e && i_this->m10FC[3] != 0) { for (s32 i = 2; i <= 16; i++) { - cMtx_copy(i_this->m02B8->getModel()->getAnmMtx(i), *calc_mtx); + MtxP mtx = i_this->m02B8->getModel()->getAnmMtx(i); + cMtx_copy(mtx, *calc_mtx); cXyz pos_vec; cXyz vec(0.0f, 0.0f, 0.0f); MtxPosition(&vec, &pos_vec); @@ -922,7 +928,8 @@ static void beam_set(bst_class* i_this) { continue; } i_this->m04E4[i] = 1; - cMtx_copy(i_this->m02B8->getModel()->getAnmMtx(REG0_S(5) + 3), *calc_mtx); + MtxP mtx = i_this->m02B8->getModel()->getAnmMtx(REG0_S(5) + 3); + cMtx_copy(mtx, *calc_mtx); cXyz vec(0.0f, 0.0f, 0.0f); MtxPosition(&vec, &i_this->m03B8[i]); i_this->m04A8[i] = actor->shape_angle; @@ -1300,15 +1307,20 @@ static void col_set(bst_class* i_this) { cXyz vec; cXyz pos_vec; if (i_this->mBstPartType == bst_class::Type_HEAD_e) { - cMtx_copy(i_this->m02B8->getModel()->getAnmMtx(8), *calc_mtx); - vec.set(REG0_F(0) + (-30.0f), REG0_F(1), REG0_F(2) + (-100.0f)); + MtxP mtx = i_this->m02B8->getModel()->getAnmMtx(8); + cMtx_copy(mtx, *calc_mtx); + vec.x = REG0_F(0) + (-30.0f); + vec.y = REG0_F(1); + vec.z = REG0_F(2) + (-100.0f); MtxPosition(&vec, &pos_vec); i_this->mHeadHurtCyl.SetC(pos_vec); i_this->mHeadHurtCyl.SetH(REG0_F(3) + 600.0f); i_this->mHeadHurtCyl.SetR(REG0_F(4) + 180.0f); dComIfG_Ccsp()->Set(&i_this->mHeadHurtCyl); i_this->mHandHurtCyl.OffTgSetBit(); - vec.set(REG0_F(5) + 150.0f, REG0_F(6), REG0_F(7) + 70.0f); + vec.x = REG0_F(5) + 150.0f; + vec.y = REG0_F(6); + vec.z = REG0_F(7) + 70.0f; MtxPosition(&vec, &pos_vec); i_this->mHandHurtCyl.SetC(pos_vec); i_this->mHandHurtCyl.SetH(REG0_F(8) + 100.0f); @@ -1318,7 +1330,8 @@ static void col_set(bst_class* i_this) { MtxPosition(&vec, &actor->eyePos); vec.setall(0.0f); for (s32 i = 0; i < 2; i++) { - cMtx_copy(i_this->m02B8->getModel()->getAnmMtx(i + 4), *calc_mtx); + MtxP mtx = i_this->m02B8->getModel()->getAnmMtx(i + 4); + cMtx_copy(mtx, *calc_mtx); MtxPosition(&vec, &pos_vec); s16 unk = i_this->m2E74[i]; if (unk != 0 || i_this->mEyeHealth[i] <= 0) { @@ -1341,13 +1354,15 @@ static void col_set(bst_class* i_this) { radius = REG0_F(16) + 50.0f; } for (s32 i = 0; i < 15; i++) { - cMtx_copy(i_this->m02B8->getModel()->getAnmMtx(i + 2), *calc_mtx); + MtxP mtx = i_this->m02B8->getModel()->getAnmMtx(i + 2); + cMtx_copy(mtx, *calc_mtx); MtxPosition(&vec, &pos_vec); i_this->mFingerSphs[i].SetC(pos_vec); i_this->mFingerSphs[i].SetR(REG0_F(14) + 50.0f + radius); dComIfG_Ccsp()->Set(&i_this->mFingerSphs[i]); } - cMtx_copy(i_this->m02B8->getModel()->getAnmMtx(17), *calc_mtx); + MtxP mtx = i_this->m02B8->getModel()->getAnmMtx(17); + cMtx_copy(mtx, *calc_mtx); static f32 te_x[4] = {70.0f, 70.0f, 70.0f, 70.0f}; static f32 te_y[4] = {70.0f, -70.0f, 70.0f, -70.0f}; static f32 te_z[4] = {90.0f, 90.0f, -30.0f, -30.0f}; @@ -1364,14 +1379,22 @@ static void col_set(bst_class* i_this) { dComIfG_Ccsp()->Set(&i_this->mFingerSphs[i + 15]); } if (i_this->mBstPartType == bst_class::Type_RIGHT_HAND_e) { - vec.set(-(REG0_F(15) + 100.0f), REG0_F(16), -(REG0_F(17) + 40.0f)); + vec.x = -(REG0_F(15) + 100.0f); + vec.y = REG0_F(16); + vec.z = -(REG0_F(17) + 40.0f); MtxPosition(&vec, &pos_vec); - vec.set(-(REG0_F(15) + 100.0f), REG0_F(16), REG0_F(18) + 10.0f); + vec.x = -(REG0_F(15) + 100.0f); + vec.y = REG0_F(16); + vec.z = REG0_F(18) + 10.0f; MtxPosition(&vec, &actor->eyePos); } else { - vec.set(REG0_F(15) + 100.0f, REG0_F(16), REG0_F(17) + 40.0f); + vec.x = REG0_F(15) + 100.0f; + vec.y = REG0_F(16); + vec.z = REG0_F(17) + 40.0f; MtxPosition(&vec, &pos_vec); - vec.set(REG0_F(15) + 100.0f, REG0_F(16), -(REG0_F(18) + 10.0f)); + vec.x = REG0_F(15) + 100.0f; + vec.y = REG0_F(16); + vec.z = -(REG0_F(18) + 10.0f); MtxPosition(&vec, &actor->eyePos); } i_this->mHandHurtCyl.SetC(pos_vec); @@ -1550,11 +1573,13 @@ static void hana_demo(bst_class* i_this) { int itemNo; if (dComIfGs_getArrowNum() == 0) { itemNo = dItem_ARROW_10_e; - cMtx_copy(i_this->m02B8->getModel()->getAnmMtx(6), *calc_mtx); + MtxP mtx = i_this->m02B8->getModel()->getAnmMtx(6); + cMtx_copy(mtx, *calc_mtx); i_this->m2E9E = 0; } else { itemNo = dItem_BOMB_5_e; - cMtx_copy(i_this->m02B8->getModel()->getAnmMtx(7), *calc_mtx); + MtxP mtx = i_this->m02B8->getModel()->getAnmMtx(7); + cMtx_copy(mtx, *calc_mtx); i_this->m2E9E = 1; } vec.set(REG0_F(2) + 60.0f, REG0_F(3), REG0_F(4)); @@ -1564,7 +1589,8 @@ static void hana_demo(bst_class* i_this) { MtxPosition(&vec, &pos_vec); i_this->mCreatedItemId = fopAcM_createItem(&pos_vec, itemNo, -1, fopAcM_GetRoomNo(actor), 0, NULL, 0xB, NULL); mDoAud_seStart(JA_SE_CM_BST_ITEM_OUT_NOSE, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); - cMtx_copy(i_this->m02B8->getModel()->getAnmMtx(0), *calc_mtx); + MtxP mtx = i_this->m02B8->getModel()->getAnmMtx(0); + cMtx_copy(mtx, *calc_mtx); vec.setall(0.0f); MtxPosition(&vec, &pos_vec); dComIfGp_particle_setToon( @@ -1921,10 +1947,7 @@ static BOOL beam_wall_check(cXyz* pos_1, cXyz* pos_2) { /* 00007740-00007B58 .text beam_move__FP9bst_class */ static void beam_move(bst_class* i_this) { - /* Nonmatching - regalloc */ fopAc_ac_c* actor = &i_this->actor; - cXyz* pos1; - cXyz* pos2; J3DModel* model; s8 beam_set; dBgS_GndChk gndChk; @@ -1932,9 +1955,7 @@ static void beam_move(bst_class* i_this) { if (i_this->m04E4[i] == 0) { continue; } - pos1 = &i_this->m03B8[i]; - pos2 = &i_this->m0430[i]; - VECAdd(pos1, pos2, pos1); + VECAdd(&i_this->m03B8[i], &i_this->m0430[i], &i_this->m03B8[i]); model = i_this->m0390[i]; mDoMtx_stack_c::transS(i_this->m03B8[i]); mDoMtx_stack_c::YrotM(i_this->m04A8[i].y); @@ -1943,16 +1964,20 @@ static void beam_move(bst_class* i_this) { model->setBaseTRMtx(mDoMtx_stack_c::now); cLib_addCalc2(&i_this->m10A8[i], REG0_F(4) + 5.0f, 1.0f, REG0_F(5) + 0.5f); beam_set = FALSE; - f32 fVar1 = 500.0f; - gndChk.m_pos.set(i_this->m03B8[i].x, i_this->m03B8[i].z + fVar1, i_this->m03B8[i].y); + Vec temp; + temp.x = i_this->m03B8[i].x; + temp.y = i_this->m03B8[i].y; + temp.z = i_this->m03B8[i].z; + temp.y += 500.0f; + gndChk.m_pos.set(temp); f32 ground_cross = dComIfG_Bgsp()->GroundCross(&gndChk); - if (ground_cross >= i_this->m03B8[i].y) { + if (i_this->m03B8[i].y <= ground_cross) { i_this->m03B8[i].y = ground_cross; - beam_eff_set(pos1, 0, 0); + beam_eff_set(&i_this->m03B8[i], 0, 0); beam_set = TRUE; } else { - if (beam_wall_check(pos1, pos2)) { - beam_eff_set(pos1, i_this->m04A8[i].y, 1); + if (beam_wall_check(&i_this->m03B8[i], &i_this->m0430[i])) { + beam_eff_set(&i_this->m03B8[i], i_this->m04A8[i].y, 1); beam_set = TRUE; } } @@ -1962,13 +1987,13 @@ static void beam_move(bst_class* i_this) { if (beam_set) { i_this->m04E4[i] = 0; dComIfGp_getVibration().StartShock(REG0_S(2) + 3, -0x21, cXyz(0.0f, 1.0f, 0.0f)); - mDoAud_seStart(JA_SE_CM_BST_BEAM_BOMB, pos1, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + mDoAud_seStart(JA_SE_CM_BST_BEAM_BOMB, &i_this->m03B8[i], 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } if (i_this->m04E4[i] == 1) { - i_this->mCcD_beams[i].StartCAt(*pos1); + i_this->mCcD_beams[i].StartCAt(i_this->m03B8[i]); i_this->m04E4[i]++; } else { - i_this->mCcD_beams[i].MoveCAt(*pos1); + i_this->mCcD_beams[i].MoveCAt(i_this->m03B8[i]); } dComIfG_Ccsp()->Set(&i_this->mCcD_beams[i]); } @@ -2012,9 +2037,8 @@ void demo_camera(bst_class* i_this) { J3DAnmTevRegKey* pJVar7; J3DAnmTextureSRTKey* pJVar8; JPABaseEmitter* pJVar9; - cXyz local_40; - cXyz local_4c; - cXyz local_58; + cXyz spB0; // offset + cXyz spA4; daPy_py_c* player = daPy_getPlayerActorClass(); camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); s8 bVar2 = true; @@ -2043,20 +2067,20 @@ void demo_camera(bst_class* i_this) { } cMtx_YrotS(*calc_mtx, actor->shape_angle.y + (REG0_S(1) + 0xAF0)); if (i_this->m2E9E != 0) { - local_40.x = REG0_F(9) + -100.0f; + spB0.x = REG0_F(9) + -100.0f; } else { - local_40.x = REG0_F(10); + spB0.x = REG0_F(10); } - local_40.y = REG0_F(0xb) + i_this->m2EC4; - local_40.z = REG0_F(0xc); - MtxPosition(&local_40, &local_4c); - i_this->m2EAC = actor->eyePos + local_4c; + spB0.y = REG0_F(0xb) + i_this->m2EC4; + spB0.z = REG0_F(0xc); + MtxPosition(&spB0, &spA4); + i_this->m2EAC = actor->eyePos + spA4; cMtx_XrotM(*calc_mtx, REG0_S(2) + 4000); - local_40.x = 0.0f; - local_40.y = REG0_F(7); - local_40.z = REG0_F(8) + 850.0f; - MtxPosition(&local_40, &local_4c); - i_this->m2EA0 = actor->current.pos + local_4c; + spB0.x = 0.0f; + spB0.y = REG0_F(7); + spB0.z = REG0_F(8) + 850.0f; + MtxPosition(&spB0, &spA4); + i_this->m2EA0 = actor->current.pos + spA4; if (0x50 < i_this->msFrameCount) { i_this->mActionType = bst_class::ACTION_FLY_e; i_this->mDamage = 0; @@ -2091,10 +2115,10 @@ void demo_camera(bst_class* i_this) { i_this->m2E98 = 0x78; // fallthrough case 11: - local_4c.x = -635.0f; - local_4c.y = 0.0f; - local_4c.z = 0.0f; - player->setPlayerPosAndAngle(&local_4c, 0x4000); + spA4.x = -635.0f; + spA4.y = 0.0f; + spA4.z = 0.0f; + player->setPlayerPosAndAngle(&spA4, 0x4000); cLib_addCalc2(&i_this->m2EA0.z, boss->actor.current.pos.z + REG0_F(3) + 300.0f, 0.02f, 1.4f); if (i_this->msFrameCount == 0x3c) { message_set(i_this, 0x170d); @@ -2277,8 +2301,8 @@ void demo_camera(bst_class* i_this) { i_this->m2EA0.y += REG0_F(2) + 100.0f; cLib_addCalc2(&i_this->m2EC8, 55.0f, 0.1f, 0.4f); if (i_this->msFrameCount == 200) { - local_58.setall(0.0f); - pJVar9 = dComIfGp_particle_set(dPa_name::ID_AK_SN_BSTSTAGEEFFECT00, &local_58); + cXyz sp98(0.0f, 0.0f, 0.0f); + pJVar9 = dComIfGp_particle_set(dPa_name::ID_AK_SN_BSTSTAGEEFFECT00, &sp98); i_this->m2EF8 = pJVar9; JAIZelBasic::zel_basic->field_0x1dd4 = 1; } @@ -2321,10 +2345,10 @@ void demo_camera(bst_class* i_this) { i_this->m2E98 = 0x96; // fallthrough case 51: - local_4c.x = REG0_F(1) + -300.0f; - local_4c.y = 0.0f; - local_4c.z = 0.0f; - player[0].setPlayerPosAndAngle(&local_4c, 0x4000); + spA4.x = REG0_F(1) + -300.0f; + spA4.y = 0.0f; + spA4.z = 0.0f; + player[0].setPlayerPosAndAngle(&spA4, 0x4000); actor->current.pos.x = 300.0f; actor->current.pos.z = 0.0f; actor->shape_angle.y = -0x4000; @@ -2376,7 +2400,7 @@ void demo_camera(bst_class* i_this) { message_set(i_this, 0x1713); } iVar13 = i_this->msFrameCount; - iVar14 = (int)REG0_S(4) * 2 + 0x1cc; + iVar14 = (int)REG0_S(4) + REG0_S(4) + 0x1cc; if ((int)iVar13 == REG0_S(4) + iVar14 + 0xaa) { msg_end = 1; } @@ -2426,10 +2450,10 @@ void demo_camera(bst_class* i_this) { i_this->mRoomState = 4; i_this->m2ED0 = 1.0f; dComIfGs_onStageBossEnemy(); - local_40.x = 0.0f; - local_40.y = 0.0f; - local_40.z = 0.0f; - fopAcM_createWarpFlower(&local_40, 0, fopAcM_GetRoomNo(actor), 0); + spB0.x = 0.0f; + spB0.y = 0.0f; + spB0.z = 0.0f; + fopAcM_createWarpFlower(&spB0, 0, fopAcM_GetRoomNo(actor), 0); // fallthrough case 54: if ((int)i_this->msFrameCount == REG0_S(4) + 0x16) { @@ -2457,8 +2481,8 @@ void demo_camera(bst_class* i_this) { i_this->m2EA0.x = i_this->m2EA0.x - (REG0_F(0xb) + 1300.0f); i_this->m2EA0.y = i_this->m2EA0.y - (REG0_F(0xc) + 450.0f); i_this->m2EA0.z = i_this->m2EA0.z - (REG0_F(0xd) + 500.0f); - local_40 = actor->home.pos - actor->current.pos; - if (local_40.abs() < 10.0f) { + spB0 = actor->home.pos - actor->current.pos; + if (spB0.abs() < 10.0f) { dComIfGp_particle_setToon( start_smoke_name[i_this->mBstPartType], &actor->current.pos, @@ -2485,20 +2509,19 @@ void demo_camera(bst_class* i_this) { i_this->m2E98 = 1; } if ((s32)i_this->m02B8->getFrame() == 26) { - cXyz boss_pos; cMtx_copy(i_this->m02B8->getModel()->getAnmMtx(7), *calc_mtx); - cXyz offset(REG0_F(2) + 60.0f, REG0_F(3), REG0_F(4)); + spB0.set(REG0_F(2) + 60.0f, REG0_F(3), REG0_F(4)); mDoAud_seStart(JA_SE_OBJ_BOMB_EXPLODE, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); - MtxPosition(&offset, &boss_pos); + MtxPosition(&spB0, &spA4); cXyz item_scale(1.0f, 1.0f, 1.0f); csXyz item_angle = actor->shape_angle; item_angle.y += (s16)(REG0_S(7) + -300); - i_this->mCreatedItemId = fopAcM_createItemForBoss(&boss_pos, 0, fopAcM_GetRoomNo(actor), &item_angle, &item_scale, 1); + i_this->mCreatedItemId = fopAcM_createItemForBoss(&spA4, 0, fopAcM_GetRoomNo(actor), &item_angle, &item_scale, 1); mDoAud_seStart(JA_SE_CM_BST_ITEM_OUT_NOSE, &actor->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); cMtx_copy(i_this->m02B8->getModel()->getAnmMtx(0), *calc_mtx); - cXyz vec(0.0f, 0.0f, 0.0f); - MtxPosition(&vec, &boss_pos); - dComIfGp_particle_set(item_smoke_name[1], &boss_pos, &actor->shape_angle, NULL, 0xB9, &i_this->mPa_smokeEcallBack, fopAcM_GetRoomNo(actor)); + spB0.set(0.0f, 0.0f, 0.0f); + MtxPosition(&spB0, &spA4); + dComIfGp_particle_setToon(item_smoke_name[1], &spA4, &actor->shape_angle, NULL, 0xB9, &i_this->mPa_smokeEcallBack, fopAcM_GetRoomNo(actor)); } if ((s32)i_this->m02B8->getFrame() > 26) { fopAc_ac_c* actor = fopAcM_SearchByID(i_this->mCreatedItemId); @@ -2540,7 +2563,7 @@ void demo_camera(bst_class* i_this) { camera_eye.x = i_this->m2EAC.x - x; camera_eye.y = i_this->m2EAC.y - y; camera_eye.z = i_this->m2EAC.z - z; - s16 bank = 7.5f * i_this->m2ECC * cM_scos(i_this->mUpdateLastFacingDirIfMultipleOf32 * 0x1C00); + s16 bank = 7.5f * (i_this->m2ECC * cM_scos(i_this->mUpdateLastFacingDirIfMultipleOf32 * 0x1C00)); camera->mCamera.Set(camera_eye, camera_center, bank, i_this->m2EC8); cLib_addCalc0(&i_this->m2ECC, 1.0f, 1.0f); JUTReport(410, 430, "K SUB COUNT %d", i_this->msFrameCount); @@ -2681,7 +2704,8 @@ static BOOL daBst_Execute(bst_class* i_this) { vec2.y = i_this->m10EC.z * cM_ssin(i_this->mUpdateLastFacingDirIfMultipleOf32 * (REG0_S(6) + 750)); vec2.z = i_this->m10EC.z * cM_scos(i_this->mUpdateLastFacingDirIfMultipleOf32 * (REG0_S(6) + 720)); cLib_addCalc0(&i_this->m10EC.z, 1.0f, 1.0f); - i_this->m02B8->getModel()->setBaseScale(actor->scale); + J3DModel* model = i_this->m02B8->getModel(); + model->setBaseScale(actor->scale); mDoMtx_stack_c::transS(actor->current.pos.x + vec2.x, actor->current.pos.y + vec2.y, actor->current.pos.z + vec2.z); s16 hurtAng = i_this->mHeadHurtAngle; s16 faceDir = i_this->mUpdateLastFacingDirIfMultipleOf32; @@ -2690,7 +2714,8 @@ static BOOL daBst_Execute(bst_class* i_this) { s16 bossFaceDir = boss->mUpdateLastFacingDirIfMultipleOf32; s16 unk6 = i_this->m112A * (REG0_F(14) + 150.0f) * cM_ssin(bossFaceDir * 0x3600); s16 unk7 = i_this->m112A * (REG0_F(14) + 150.0f) * cM_scos(bossFaceDir * 0x4300); - s16 unk8 = i_this->m112C * (REG0_F(14) + 100.0f) * cM_scos(bossFaceDir * 0x3A00); + f32 f3 = cM_scos(bossFaceDir * 0x3A00); + s16 unk8 = i_this->m112C * (REG0_F(14) + 100.0f) * f3; cLib_addCalc0(&i_this->m10F8, 1.0f, REG0_F(3) + 30.0f); mDoMtx_stack_c::YrotM(actor->shape_angle.y + unk4 + unk6); mDoMtx_stack_c::XrotM(actor->shape_angle.x + unk5 + unk7 + unk8); @@ -2699,7 +2724,7 @@ static BOOL daBst_Execute(bst_class* i_this) { cLib_addCalc0(&i_this->m1110, 1.0f, 5.0f); cLib_addCalc0(&i_this->m1114, 1.0f, 10.0f); cLib_addCalc0(&i_this->m1118, 1.0f, 5.0f); - i_this->m02B8->getModel()->setBaseTRMtx(mDoMtx_stack_c::now); + model->setBaseTRMtx(mDoMtx_stack_c::now); i_this->m0388->setBaseTRMtx(mDoMtx_stack_c::now); i_this->m02B8->calc(); MtxTrans(actor->home.pos.x, actor->home.pos.y, actor->home.pos.z, FALSE); diff --git a/src/d/actor/d_a_bwdg.cpp b/src/d/actor/d_a_bwdg.cpp index 9fa3a50eb..330762a8c 100644 --- a/src/d/actor/d_a_bwdg.cpp +++ b/src/d/actor/d_a_bwdg.cpp @@ -208,9 +208,11 @@ static BOOL useHeapInit(fopAc_ac_c* i_actor) { return FALSE; } - u16* r30 = (u16*)dComIfG_getObjectRes("Bwdg", BWDG_DAT_GRIDIDX); - cBgD_t* r3 = (cBgD_t*)dComIfG_getObjectRes("Bwdg", BWDG_DZB_HSAND1); - if (!i_this->mpBgW->Set(r3, r30, 130.0f, 0x40, 0x40, 0)) { + if (!i_this->mpBgW->Set( + (cBgD_t*)dComIfG_getObjectRes("Bwdg", BWDG_DZB_HSAND1), + (u16*)dComIfG_getObjectRes("Bwdg", BWDG_DAT_GRIDIDX), + 130.0f, 0x40, 0x40, 0 + )) { return TRUE; } else { return FALSE; diff --git a/src/d/actor/d_a_npc_btsw2.cpp b/src/d/actor/d_a_npc_btsw2.cpp index 2e82970cd..29a37d1ac 100644 --- a/src/d/actor/d_a_npc_btsw2.cpp +++ b/src/d/actor/d_a_npc_btsw2.cpp @@ -41,7 +41,7 @@ static dCcD_SrcCyl l_cyl_src = { /* SrcObjAt Type */ 0, /* SrcObjAt Atp */ 0, /* SrcObjAt SPrm */ 0, - /* SrcObjTg Type */ ~(AT_TYPE_BOOMERANG), + /* SrcObjTg Type */ DEMO_SELECT(AT_TYPE_ALL, ~(AT_TYPE_BOOMERANG)), /* SrcObjTg SPrm */ cCcD_TgSPrm_Set_e | cCcD_TgSPrm_IsEnemy_e, /* SrcObjCo SPrm */ cCcD_CoSPrm_Set_e | cCcD_CoSPrm_IsPlayer_e | cCcD_CoSPrm_VsGrpAll_e, /* SrcGObjAt Se */ 0,