diff --git a/include/c/c_damagereaction.h b/include/c/c_damagereaction.h index e6e184a7d..5370a60da 100644 --- a/include/c/c_damagereaction.h +++ b/include/c/c_damagereaction.h @@ -178,16 +178,18 @@ public: /* 0x772 */ u8 m772[0x774 - 0x772]; /* 0x774 */ dPa_smokeEcallBack mParticleCallBack; /* 0x794 */ s16 m794; - /* 0x796 */ u8 m796[0x7A0 - 0x796]; + /* 0x796 */ u8 m796[0x798 - 0x796]; + /* 0x798 */ f32 m798; + /* 0x79C */ cXyz* m79C; /* 0x7A0 */ cXyz m7A0; /* 0x7AC */ u8 m7AC[0x7AE - 0x7AC]; /* 0x7AE */ s16 m7AE; /* 0x7B0 */ u8 m7B0[0x7B2 - 0x7B0]; /* 0x7B2 */ s16 m7B2; - /* 0x7B4 */ u8 m7B4[0x7B6 - 0x7B4]; + /* 0x7B4 */ s16 m7B4; /* 0x7B6 */ u8 m7B6; /* 0x7B7 */ u8 m7B7[0x7B8 - 0x7B7]; - /* 0x7B8 */ int m7B8; + /* 0x7B8 */ fpc_ProcID m7B8; }; // Size: 0x7BC // STATIC_ASSERT(sizeof(damagereaction) == 0x7BC); diff --git a/include/d/actor/d_a_bk.h b/include/d/actor/d_a_bk.h index 6e17c9f82..6b528d057 100644 --- a/include/d/actor/d_a_bk.h +++ b/include/d/actor/d_a_bk.h @@ -8,6 +8,7 @@ class dPath; namespace daObj_Search { class Act_c; }; +struct br_s; class bk_class : public fopEn_enemy_c { public: @@ -69,7 +70,7 @@ public: /* 0x034F */ u8 m034F; /* 0x0350 */ dPa_smokeEcallBack m0350; /* 0x0370 */ damagereaction dr; - /* 0x0B2C */ u8 m0B2C[0x0B30 - 0x0B2C]; + /* 0x0B2C */ br_s* m0B2C; /* 0x0B30 */ int m0B30; /* 0x0B34 */ int m0B34; /* 0x0B38 */ u8 m0B38[0x0B44 - 0x0B38]; diff --git a/include/d/actor/d_a_bridge.h b/include/d/actor/d_a_bridge.h index b2c5cddbd..1123628a8 100644 --- a/include/d/actor/d_a_bridge.h +++ b/include/d/actor/d_a_bridge.h @@ -36,13 +36,16 @@ struct br_s { /* 0x3F4 */ f32 m3F4; /* 0x3F8 */ u8 m3F8[0x3FC - 0x3F8]; /* 0x3FC */ f32 m3FC; - /* 0x400 */ u8 m400[0x408 - 0x400]; + /* 0x400 */ s16 m400; + /* 0x402 */ u8 m402[0x406 - 0x402]; + /* 0x406 */ u8 m406; + /* 0x407 */ u8 m407[0x408 - 0x407]; /* 0x408 */ u8 m408; /* 0x409 */ u8 m409[0x40C - 0x409]; /* 0x40C */ cXyz mScale; /* 0x418 */ s16 m418; /* 0x41A */ u8 m41A[0x41C - 0x41A]; -}; +}; // Size: 0x41C class bridge_class : public fopAc_ac_c { public: diff --git a/include/d/d_cc_s.h b/include/d/d_cc_s.h index e94582143..18cadda84 100644 --- a/include/d/d_cc_s.h +++ b/include/d/d_cc_s.h @@ -63,4 +63,4 @@ public: STATIC_ASSERT(sizeof(dCcS) == 0x29F4); -#endif /* D_CC_D_CC_S_H */ \ No newline at end of file +#endif /* D_CC_D_CC_S_H */ diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index 726d70587..f45903923 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -474,6 +474,10 @@ inline fpc_ProcID fopAcM_create(s16 i_procName, createFunc i_createFunc, void* p 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); +} + void* fopAcM_fastCreate(s16 procName, u32 parameter, cXyz* p_pos = NULL, int roomNo = -1, csXyz* p_angle = NULL, cXyz* p_scale = NULL, s8 subType = -1, createFunc p_createFunc = NULL, void* p_createFuncData = NULL); diff --git a/src/d/actor/d_a_bk.cpp b/src/d/actor/d_a_bk.cpp index 0e677ad6d..9b5021806 100644 --- a/src/d/actor/d_a_bk.cpp +++ b/src/d/actor/d_a_bk.cpp @@ -7,9 +7,11 @@ #include "d/d_bg_s_gnd_chk.h" #include "d/res/res_bk.h" #include "f_op/f_op_actor_mng.h" +#include "f_op/f_op_camera.h" #include "d/d_procname.h" #include "d/d_com_inf_game.h" #include "d/actor/d_a_obj_search.h" +#include "d/actor/d_a_bridge.h" #include "d/actor/d_a_item.h" #include "d/d_item_data.h" #include "d/actor/d_a_boko.h" @@ -113,13 +115,13 @@ static void yari_off_check(bk_class* i_this) { } boko->current.angle.y = player->shape_angle.y; + cXyz offset; dBgS_LinChk linChk; linChk.Set(&i_this->eyePos, &boko->current.pos, i_this); if (dComIfG_Bgsp()->LineCross(&linChk)) { MtxP mtx = i_this->mpMorf->getModel()->getAnmMtx(0x10); // mune (chest) joint MTXCopy(mtx, *calc_mtx); boko->setMatrix(*calc_mtx); - cXyz offset; offset.set(0.0f, 0.0f, 0.0f); MtxPosition(&offset, &boko->current.pos); } @@ -848,9 +850,11 @@ static BOOL daBk_bomb_check(bk_class* i_this) { static BOOL daBk_player_bg_check(bk_class* i_this, cXyz* r22) { fopAc_ac_c* i_actor = i_this; daPy_py_c* player = daPy_getPlayerActorClass(); - if (search_sp != 0 || i_this->mType == 0xA) { - return FALSE; - } +#if VERSION != VERSION_USA + if (search_sp != 0) { return FALSE; } +#else + if (search_sp != 0 || i_this->mType == 0xA) { return FALSE; } +#endif if (i_this->dr.m713 == 0 && std::fabsf(player->speedF) < 0.1f && player->checkGrabWear()) { return TRUE; } @@ -871,9 +875,11 @@ static BOOL daBk_player_bg_check(bk_class* i_this, cXyz* r22) { /* 0000385C-00003A18 .text daBk_player_view_check__FP8bk_classP4cXyzss */ static BOOL daBk_player_view_check(bk_class* i_this, cXyz* r30, s16 r27, s16 r31) { daPy_py_c* player = daPy_getPlayerActorClass(); - if (search_sp != 0 || i_this->mType == 0xA) { - return TRUE; - } +#if VERSION != VERSION_USA + if (search_sp != 0) { return TRUE; } +#else + if (search_sp != 0 || i_this->mType == 0xA) { return TRUE; } +#endif if (daBk_player_bg_check(i_this, r30)) { return FALSE; } @@ -894,7 +900,7 @@ static BOOL daBk_player_view_check(bk_class* i_this, cXyz* r30, s16 r27, s16 r31 sp14.y = r30->y - i_this->current.pos.y; sp14.z = r30->z - i_this->current.pos.z; cXyz sp08; - MtxPosition(& sp14, &sp08); + MtxPosition(&sp14, &sp08); if (std::fabsf(sp08.x) < l_bkHIO.m03C && std::fabsf(sp08.y) < l_bkHIO.m040 && sp08.z > l_bkHIO.m048 && @@ -964,7 +970,7 @@ static void path_check(bk_class* i_this, u8 r19) { return; } - u8 sp90[0x108]; + u8 sp90[0x100]; dBgS_LinChk linChk; cXyz sp18; sp18.set(i_this->current.pos); @@ -1064,7 +1070,7 @@ static void jyunkai(bk_class* i_this) { } if ((i_this->ppd->mNextPathId & 0xFFFF) != 0xFFFF) { i_this->ppd = dPath_GetRoomPath(i_this->ppd->mNextPathId, fopAcM_GetRoomNo(i_this)); - JUT_ASSERT(2924, i_this->ppd != NULL); + JUT_ASSERT(VERSION_SELECT(2907, 2924, 2924), i_this->ppd != NULL); } } else if (i_this->m1216 < 0) { i_this->m1217 = 1; @@ -2122,7 +2128,7 @@ static fopAc_ac_c* yari_hit_check(bk_class* i_this) { if (i_this->m02D5 != 0) { // Using the dComIfG_Ccsp inline here breaks the match. // dComIfG_Ccsp()->SetMass(&i_this->m1040, 3); - g_dComIfG_gameInfo.play.mCcS.SetMass(&i_this->m1040, 3); + dComIfG_Ccsp()->mMass_Mng.Set(&i_this->m1040, 3); } if (i_this->m1040.ChkAtHit()) { i_this->m0B78 = 5; @@ -2992,17 +2998,250 @@ static void d_mahi(bk_class* i_this) { /* 00009F1C-0000A350 .text tubo_wait__FP8bk_class */ static void tubo_wait(bk_class* i_this) { - /* Nonmatching */ + fopAc_ac_c* actor = i_this; + + bool r29 = false; + bool r28 = false; + cLib_addCalc2(&actor->scale.x, 1.0f, 1.0f, 0.1f); + actor->scale.y = actor->scale.z = actor->scale.x; + + switch (i_this->dr.m004) { + case 0: + if (i_this->m0300[0] != 0) { + i_this->m0300[0] = REG0_S(3) + 30; + anm_init(i_this, BK_BCK_BK_SUWARI, 0.0f, J3DFrameCtrl::EMode_NONE, 0.01f, BK_BAS_BK_SUWARI); + i_this->dr.m004 = 20; + } else { + if (i_this->mType == 3) { + anm_init(i_this, BK_BCK_BK_JATTACK1, 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->dr.m004 = 1; + actor->speed.y = REG0_F(8) + 120.0f; + actor->speedF = REG0_F(9) + 40.0f; + } else { + anm_init(i_this, BK_BCK_BK_JUMP1, 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, BK_BAS_BK_JUMP1); + i_this->dr.m004 = 10; + actor->speed.y = REG8_F(8) + 120.0f; + actor->speedF = REG8_F(9) + 40.0f; + } + + actor->current.angle.y = fopAcM_searchPlayerAngleY(actor); + + fopAcM_monsSeStart(actor, JA_SE_CV_BK_SURPRISE, 0); + i_this->m0300[0] = 10; + r29 = true; + } + break; + case 1: + if (i_this->dr.mAcch.ChkGroundHit()) { + i_this->dr.m004 = 2; + anm_init(i_this, BK_BCK_BK_JATTACK2, 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, BK_BAS_BK_JATTACK2); + fopAcM_monsSeStart(actor, JA_SE_CV_BK_ATTACK_L, 0); + } + break; + case 2: + r28 = true; + if (i_this->mpMorf->isStop()) { + i_this->dr.m004 = 11; + anm_init(i_this, BK_BCK_BK_JATTACK3, 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, BK_BAS_BK_JATTACK3); + } + break; + case 10: + if (i_this->m0300[0] == 0 && i_this->dr.mAcch.ChkGroundHit()) { + anm_init(i_this, BK_BCK_BK_JUMP2, 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, BK_BAS_BK_JUMP2); + i_this->dr.m004 = 11; + i_this->m034C = l_bkHIO.m00C + 6; + i_this->m034E = 3; + } + break; + case 11: + cLib_addCalc0(&i_this->speedF, 1.0f, 20.0f); + if (i_this->mpMorf->isStop()) { + i_this->dr.mState = 0; + i_this->dr.m004 = 0; + } + break; + case 20: + if (i_this->m0300[0] != 0) { + if (i_this->m0300[0] == 1) { + anm_init(i_this, BK_BCK_BK_SUWARI, 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, BK_BAS_BK_SUWARI); + } + } else if (i_this->mpMorf->isStop()) { + i_this->dr.mState = 0; + i_this->dr.m004 = 0; + } + break; + } + + if (r29) { + i_this->m1040.SetC(actor->current.pos); + i_this->m1040.SetR(20.0f); + dComIfG_Ccsp()->Set(&i_this->m1040); + } else if (r28) { + i_this->m1040.SetC(i_this->m1178); + i_this->m1040.SetR(60.0f); + dComIfG_Ccsp()->Set(&i_this->m1040); + } } /* 0000A350-0000A630 .text z_demo_1__FP8bk_class */ static void z_demo_1(bk_class* i_this) { - /* Nonmatching */ + fopAc_ac_c* actor = i_this; + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + + fopAcM_OffStatus(i_this, 0); + i_this->attention_info.flags = 0; + i_this->m030E = 10; + + switch (i_this->dr.m004) { + case 0: + if (i_this->m0300[0] == 0) { + f32 f1 = cM_rndF(1.0f); + if (f1 < 0.5f) { + i_this->m0300[0] = 72; + } else { + i_this->m0300[0] = 90; + } + i_this->dr.m004 = 1; + anm_init(i_this, BK_BCK_BK_TUTUKU1, 5.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, BK_BAS_BK_TUTUKU1); + } + break; + case 1: + if ( + i_this->m0300[0] == 87 || + i_this->m0300[0] == 69 || + i_this->m0300[0] == 51 || + i_this->m0300[0] == 33 || + i_this->m0300[0] == 15 + ) { + fopAcM_monsSeStart(actor, JA_SE_CV_BK_JUMP, 0); + } + if (i_this->m0300[0] == 0) { + f32 f1 = cM_rndF(1.0f); + if (f1 < 0.5f) { + i_this->m0300[0] = 120; + } else { + i_this->m0300[0] = 180; + } + i_this->dr.m004 = 2; + anm_init(i_this, BK_BCK_BK_TUTUKU2, 5.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + } + break; + case 2: + if (i_this->m0300[0] == 0) { + f32 f1 = cM_rndF(1.0f); + if (f1 < 0.5f) { + i_this->m0300[0] = 100; + } else { + i_this->m0300[0] = 150; + } + i_this->dr.m004 = 0; + anm_init(i_this, BK_BCK_BK_TUTUKU3, 5.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); + } + break; + } + + f32 f1; + if (i_this->m02B5 != 0xFF) { + f1 = i_this->m02B5 * 10.0f; + } else { + f1 = 500.0f; + } + if ( + i_this->mPlayerDistance < f1 + && std::fabsf(player->current.pos.y - actor->current.pos.y) < 250.0f + ) { + i_this->mType = 0; + i_this->dr.mState = 1; + i_this->dr.m004 = 20; + anm_init(i_this, BK_BCK_BK_BIKKURI, 3.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + i_this->m0300[1] = 30; + fopAcM_monsSeStart(actor, JA_SE_CV_BK_FOUND_LINK, 0); + } } /* 0000A630-0000A9BC .text b_hang__FP8bk_class */ static void b_hang(bk_class* i_this) { - /* Nonmatching */ + fopAc_ac_c* actor = i_this; + + bool r30 = false; + bridge_class* r29; + if (i_this->dr.m7B8 != fpcM_ERROR_PROCESS_ID_e) { + r29 = (bridge_class*)fopAcM_SearchByID(i_this->dr.m7B8); + if (r29 == NULL) { + i_this->dr.mState = 4; + i_this->dr.m004 = 0; + return; + } + } + + i_this->m0B88.OffCoSetBit(); + i_this->dr.m71E = 5; + switch (i_this->dr.m004) { + case 0: + anm_init(i_this, BK_BCK_BK_OTISOU1, REG12_F(9) + 10.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, BK_BAS_BK_OTISOU1); + i_this->dr.m004 = 1; + i_this->dr.m798 = 0.0f; + i_this->m0300[0] = 100; + if (i_this->m0B30 != 0) { + i_this->m0B34 = 1; + } + fopAcM_monsSeStart(actor, JA_SE_CV_BK_LOST_BOKO, 0); + break; + case 1: + if ((i_this->m0300[0] & 0x1F) == 0) { + i_this->m0336 = 2; + } + if (i_this->m0300[0] == 0) { + anm_init(i_this, BK_BCK_BK_OTISOU2, 3.0f, J3DFrameCtrl::EMode_NONE, 1.0f, BK_BAS_BK_OTISOU2); + i_this->dr.m004 = 2; + } + break; + case 2: + if (i_this->mpMorf->isStop()) { + r30 = true; + } + break; + } + + actor->speed.z = 0.0f; + actor->speed.x = 0.0f; + actor->speedF = 0.0f; + actor->speed.y = 0.0f; + cMtx_YrotS(*calc_mtx, i_this->dr.m7AE); + cXyz sp18; + sp18.x = 0.0f; + sp18.y = REG12_F(10) + 25.0f; + sp18.z = REG12_F(11) + 50.0f; + cXyz sp0C; + MtxPosition(&sp18, &sp0C); + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->dr.m7AE, 1, 0x1000); + if (i_this->dr.m7B8 != fpcM_ERROR_PROCESS_ID_e) { + cLib_addCalc2(&actor->current.pos.x, i_this->dr.m79C->x + sp0C.x, 1.0f, i_this->dr.m798); + cLib_addCalc2(&actor->current.pos.y, i_this->dr.m79C->y + sp0C.y, 1.0f, i_this->dr.m798); + cLib_addCalc2(&actor->current.pos.z, i_this->dr.m79C->z + sp0C.z, 1.0f, i_this->dr.m798); + cLib_addCalc2(&i_this->dr.m798, 100.0f, 1.0f, 20.0f); + + br_s* r3 = i_this->m0B2C; + r3->m406 = 1; + r3->m400 = i_this->dr.m7B4; + r3->m3F4 = REG14_F(12) + -25.0f; + + if (r29->mMoveProcMode >= 4) { + r30 = true; + } + } else { + cLib_addCalc2(&actor->current.pos.x, i_this->dr.m7A0.x + sp0C.x, 1.0f, i_this->dr.m798); + cLib_addCalc2(&actor->current.pos.y, i_this->dr.m7A0.y, 1.0f, i_this->dr.m798); + cLib_addCalc2(&actor->current.pos.z, i_this->dr.m7A0.z + sp0C.z, 1.0f, i_this->dr.m798); + cLib_addCalc2(&i_this->dr.m798, 100.0f, 1.0f, 20.0f); + } + + if (r30) { + i_this->dr.mState = 4; + i_this->dr.m004 = 0; + i_this->dr.m71E = 0; + i_this->dr.mSpawnY = actor->current.pos.y; + } } /* 0000A9BC-0000AC6C .text rope_on__FP8bk_class */ @@ -3071,7 +3310,183 @@ static BOOL search_target(bk_class* i_this) { /* 0000AC84-0000B25C .text Bk_move__FP8bk_class */ static void Bk_move(bk_class* i_this) { - /* Nonmatching */ + fopAc_ac_c* actor = i_this; + cXyz sp28; + + i_this->m0334 = 0; + i_this->dr.m710 = 0; + i_this->dr.m711 = 0; + cLib_addCalcAngleS2(&i_this->m11F4, 0, 2, 0x800); + + if (i_this->dr.m004 <= -100) { + i_this->m030E = 5; + if (std::fabsf(i_this->dr.m478) > 40.0f && !i_this->dr.mAcch.ChkGroundHit()) { + i_this->m1040.SetC(i_this->dr.m100[12]); + i_this->m1040.SetR(40.0f); + i_this->m1040.OffAtVsPlayerBit(); + i_this->m1040.SetAtSpl(dCcG_At_Spl_UNK1); + dComIfG_Ccsp()->Set(&i_this->m1040); + // Using the dComIfG_Ccsp inline here breaks the match. + // dComIfG_Ccsp()->SetMass(&i_this->m1040, 3); + dComIfG_Ccsp()->mMass_Mng.Set(&i_this->m1040, 3); + + if (i_this->m1040.ChkAtHit() && actor->speed.y < -50.0f) { + actor->speed.y = 0.0f; + i_this->dr.m474 = 8000.0f; + } + i_this->m0B88.OffCoSetBit(); + } + } else { + i_this->m1040.OnAtVsPlayerBit(); + if (i_this->m02DE == 0) { + i_this->m0B88.OnCoSetBit(); + } else { + i_this->m0B88.OffCoSetBit(); + } + + if (i_this->dr.m48A != 0 && i_this->dr.m488 == 0) { + if (i_this->dr.m48A == 1) { + i_this->dr.mState = 4; + i_this->dr.m004 = 0; + i_this->m0300[1] = 0; + } else { + i_this->dr.m4D0 = i_this->m0332; + actor->speedF = -30.0f; + i_this->m034C = l_bkHIO.m00C + 3; + i_this->m034E = 4; + } + } else { + search_target(i_this); + + sp28.x = i_this->dr.m714->current.pos.x - actor->current.pos.x; + sp28.z = i_this->dr.m714->current.pos.z - actor->current.pos.z; + i_this->mPlayerDistance = std::sqrtf(sp28.x*sp28.x + sp28.z*sp28.z); + + i_this->m0332 = cM_atan2s(sp28.x, sp28.z); + + if (i_this->m122C != 0) { + i_this->m122C--; + if (i_this->m122C == 0) { + i_this->dr.mState = 18; + i_this->dr.m004 = 0; + } + } + + switch (i_this->dr.mState) { + case 0: + jyunkai(i_this); + break; + case 1: + stand(i_this); + break; + case 2: + stand2(i_this); + break; + case 3: + path_run(i_this); + break; + case 4: + fight_run(i_this); + break; + case 5: + fight(i_this); + break; + case 10: + defence(i_this); + break; + case 7: + oshi(i_this); + break; + case 8: + p_lost(i_this); + break; + case 9: + b_nige(i_this); + break; + case 11: + hukki(i_this); + break; + case 12: + wepon_search(i_this); + break; + case 14: + aite_miru(i_this); + break; + case 20: + fail(i_this); + break; + case 21: + yogan_fail(i_this); + break; + case 22: + water_fail(i_this); + break; + case 15: + tubo_wait(i_this); + break; + case 19: + b_hang(i_this); + break; + case 16: + rope_on(i_this); + break; + case 23: + d_dozou(i_this); + break; + case 30: + carry(i_this); + break; + case 31: + carry_drop(i_this); + break; + case 18: + d_mahi(i_this); + break; + case 29: + z_demo_1(i_this); + break; + } + } + + if ((i_this->mType == 4 || i_this->mType == 10 || i_this->mType == 6) && i_this->dr.mState == 4) { + sp28 = actor->home.pos - actor->current.pos; + + f32 f31; + if (i_this->m02B5 != 0xFF) { + f31 = i_this->m02B5 * 10.0f * 1.5f; + } else { + f31 = 750.0f; + } + + if (sp28.abs() > f31) { + if (i_this->mType == 4 || i_this->mType == 10) { + i_this->dr.mState = 1; + } + if (i_this->mType == 6) { + i_this->dr.mState = 2; + } + i_this->dr.m004 = 51; + i_this->m0300[1] = 0; + i_this->m0300[2] = 60; + } + } + + if (i_this->dr.mState != 30) { + sp28.x = 0.0f; + sp28.y = 0.0f; + sp28.z = actor->speedF; + if (i_this->dr.mState != 11 && i_this->dr.mState != 20 && i_this->dr.m48A == 0) { + i_this->dr.m482 = actor->current.angle.y; + cMtx_YrotS(*calc_mtx, actor->current.angle.y + i_this->m0334); + } else { + cMtx_YrotS(*calc_mtx, i_this->dr.m4D0); + } + cXyz sp1C; + MtxPosition(&sp28, &sp1C); + actor->speed.x = sp1C.x; + actor->speed.z = sp1C.z; + } + } } /* 0000B25C-0000B324 .text bk_eye_tex_anm__FP8bk_class */ @@ -3092,7 +3507,266 @@ static void bk_eye_tex_anm(bk_class* i_this) { /* 0000B324-0000BC98 .text damage_check__FP8bk_class */ static void damage_check(bk_class* i_this) { - /* Nonmatching */ + fopAc_ac_c* actor = i_this; + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + + CcAtInfo atInfo; + atInfo.pParticlePos = NULL; + cXyz sp38; + u8 r28 = 0; + u8 r27 = 0; + bool r26 = false; + + i_this->dr.mStts.Move(); + dComIfG_Ccsp()->Set(&i_this->m0F14); + i_this->m0F14.SetC(i_this->m11D8); + i_this->m11D8.y = -10000.0f; + i_this->m0F14.SetR(-200.0f); + + if (i_this->m0F14.ChkTgHit()) { + cCcD_Obj* hitObj = i_this->m0F14.GetTgHitObj(); + def_se_set(actor, hitObj, 0x41); + r26 = true; + cMtx_YrotS(*calc_mtx, actor->shape_angle.y); + + sp38.x = 0.0f; + sp38.y = 0.0f; + sp38.z = -10.0f; + MtxPosition(&sp38, &i_this->dr.m42C); + + i_this->dr.m4D4 = REG0_F(9) + -20.0f; + + csXyz sp18(player->shape_angle); + sp18.y += 0x8000; + JPABaseEmitter* emitter = dComIfGp_particle_set( + dPa_name::ID_COMMON_002B, &i_this->m11CC, &sp18, + NULL, 0xFF, NULL, -1, + &actor->tevStr.mColorK0, &actor->tevStr.mColorK0 + ); + if (emitter != NULL) { + emitter->setRate(10.0f); + emitter->setMaxFrame(1); + emitter->setSpread(0.2f); + emitter->setVolumeSweep(0.15f); + JGeometry::TVec3 scale; + scale.x = scale.y = scale.z = REG14_F(16) + 0.85f; + emitter->setGlobalParticleScale(scale); + } + } + + if (i_this->m030E == 0 && (i_this->m0DE8.ChkTgHit() || i_this->m0CB8.ChkTgHit())) { + i_this->m02FC = 0; + i_this->m030E = REG0_S(7) + 5; + + if (i_this->m0DE8.ChkTgHit() != 0) { + r28 = 1; + atInfo.mpObj = i_this->m0DE8.GetTgHitObj(); + atInfo.pParticlePos = i_this->m0DE8.GetTgHitPosP(); + } else { + if (i_this->m0CB8.ChkTgHit() != 0) { + r28 = 2; + atInfo.mpObj = i_this->m0CB8.GetTgHitObj(); + atInfo.pParticlePos = i_this->m0CB8.GetTgHitPosP(); + } + } + + at_power_check(&atInfo); + if (atInfo.mDamage < 4) { + if (r26 || (i_this->dr.mState == 15 && i_this->m0310 != 0)) { + return; + } + } + + if (atInfo.mpObj->ChkAtType(AT_TYPE_ICE_ARROW | AT_TYPE_LIGHT_ARROW)) { + if (atInfo.mpObj->ChkAtType(AT_TYPE_ICE_ARROW)) { + i_this->mEnemyIce.mFreezeDuration = REG0_S(3) + 300; + i_this->dr.mState = 0; + i_this->dr.m004 = 0; + path_check(i_this, 0); + } else { + i_this->mEnemyIce.mLightShrinkTimer = 1; + } + enemy_fire_remove(&i_this->mEnemyFire); + i_this->m034C = 0; + i_this->m0350.remove(); + if (i_this->m0B30 == 0) { + return; + } + i_this->m0B34 = 2; + return; + } + + if (atInfo.mpObj->ChkAtType(AT_TYPE_FIRE | AT_TYPE_FIRE_ARROW)) { + i_this->mEnemyFire.mFireDuration = REG0_S(2) + 100; + i_this->m030E = 50; + } + + i_this->m0310 = 25; + + s8 r26 = actor->health; + at_power_check(&atInfo); + if (atInfo.mResultingAttackType == 10 || atInfo.mResultingAttackType == 14) { + actor->health = 20; + } + atInfo.mpActor = cc_at_check(actor, &atInfo); + if (atInfo.mResultingAttackType == 10 || atInfo.mResultingAttackType == 14) { + actor->health = r26; + } + + dKy_Sound_set(actor->current.pos, 100, fopAcM_GetID(actor), 5); + + if (l_bkHIO.m007 != 0) { + actor->health = 10; + } + + i_this->m1208 |= atInfo.mPlCutBit; + + if (atInfo.mResultingAttackType == 10) { + i_this->m122C = REG13_S(3) + 8; + atInfo.mDamage = 1; + } else { + i_this->m122C = 0; + } + + if (atInfo.mResultingAttackType == 1) { + s16 r3 = i_this->m0332 - actor->current.angle.y; + if (r3 < 0) { + r3 = -r3; + } + if (player->getCutType() == 5) { + r27 = 2; + } else if ((u16)r3 > 0x4000) { + if (atInfo.mbDead) { + r27 = 1; + } else { + r27 = 3; + } + } else { + if (atInfo.mbDead) { + r27 = 1; + } else if (r28 == 1) { + r27 = 4; + } else { + r27 = 5; + } + } + } else if (atInfo.mResultingAttackType == 9 && player->getCutType() == 17) { + r27 = 7; + cMtx_YrotS(*calc_mtx, player->shape_angle.y + 0x4000); + } else if (atInfo.mResultingAttackType == 2) { + r27 = 7; + cMtx_YrotS(*calc_mtx, atInfo.m0C.y); + } else { + if (atInfo.mbDead) { + r27 = 7; + } else { + r27 = 4; + } + cMtx_YrotS(*calc_mtx, atInfo.m0C.y); + } + } + + if (another_hit != 0) { + r27 = 1; + i_this->m0332 = actor->shape_angle.y + 0x8000; + i_this->m030E = REG0_S(7) + 5; + i_this->dr.mInvincibleTimer = 0; + } + + switch ((u8)r27) { + case 1: + i_this->dr.m424 |= 0x10; + i_this->dr.m428 = 26.0f; + cMtx_YrotS(*calc_mtx, i_this->m0332); + break; + case 2: + i_this->dr.m424 |= 0x40; + cMtx_YrotS(*calc_mtx, actor->current.angle.y + 0x8000); + i_this->dr.m428 = 26.0f; + break; + case 3: + i_this->dr.m424 |= 0x40; + i_this->dr.m428 = 26.0f; + cMtx_YrotS(*calc_mtx, i_this->m0332); + break; + case 4: + i_this->dr.m424 |= 0x10; + i_this->dr.m428 = 23.0f; + cMtx_YrotS(*calc_mtx, i_this->m0332); + break; + case 5: + i_this->dr.m424 |= 0x20; + i_this->dr.m428 = 23.0f; + cMtx_YrotS(*calc_mtx, i_this->m0332); + anm_init(i_this, BK_BCK_BK_AOMUKE, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, BK_BAS_BK_AOMUKE); + i_this->dr.m48A = 10; + i_this->dr.m474 = REG0_F(14) + 5000.0f; + i_this->dr.m70E = 7; + if (i_this->m0336 == 0) { + i_this->m0336 = 3; + i_this->m0344.x = 0; + } + break; + case 7: + i_this->dr.m424 |= 0x10; + i_this->dr.m428 = 26.0f; + break; + case 8: + i_this->dr.m424 |= 0x10; + i_this->dr.m428 = 23.0f; + break; + } + + if (i_this->dr.m424 != 0) { + if (i_this->dr.mState == 19) { + i_this->dr.m004 = -100; + i_this->dr.m488 = 1; + i_this->dr.m486 = -0x4000; + i_this->dr.m71E = 20; + i_this->dr.m482 = actor->shape_angle.y; + i_this->dr.m478 = 0.0f; + i_this->dr.m47C = 1; + i_this->dr.m70C = 0; + i_this->dr.m48A = 0; + cMtx_YrotS(*calc_mtx, actor->current.angle.y); + + sp38.x = 0.0f; + sp38.y = 0.0f; + sp38.z = REG14_F(2) + -80.0f; + MtxPosition(&sp38, &actor->speed); + + fopAcM_monsSeStart(actor, JA_SE_CV_BK_FAINTED, 0); + return; + } + + cXyz sp2C; + sp2C.x = 0.0f; + sp2C.y = 0.0f; + sp2C.z = -10.0f; + MtxPosition(&sp2C, &i_this->dr.m42C); + + if (i_this->dr.m428 < 25.0f) { + i_this->dr.m4D4 = -l_bkHIO.m010; + } else { + i_this->dr.m428 = cM_rndF(10.0f) + 90.0f; + } + } + + if (r27 != 0) { + if (atInfo.mbDead) { + if (actor->health <= 0) { + fopAcM_monsSeStart(actor, JA_SE_CV_BK_FAINTED, 0); + if (i_this->mType == 10) { + i_this->m1234 = 50; + fopAcM_OnStatus(actor, fopAcStts_UNK4000_e); + } + } else { + fopAcM_monsSeStart(actor, JA_SE_CV_BK_DAMAGE_L, 0); + } + } else { + fopAcM_monsSeStart(actor, JA_SE_CV_BK_DAMAGE_S, 0); + } + } } /* 0000BCD4-0000BD30 .text s_s2_sub__FPvPv */ @@ -3107,13 +3781,317 @@ static void* s_s2_sub(void* param_1, void*) { /* 0000BD30-0000C2D0 .text waki_set__FP8bk_class */ static void waki_set(bk_class* i_this) { - /* Nonmatching */ + fopAc_ac_c* actor = i_this; + + bool r30 = false; + i_this->mpSearchLight = (daObj_Search::Act_c*)fpcM_Search(&s_s2_sub, i_this); + switch (i_this->dr.m004) { + case 0: + if (i_this->mpSearchLight != NULL) { + i_this->dr.m004 = 1; + i_this->m0300[0] = 1000; + } + break; + case 1: + if (i_this->m0300[0] != 0) { + if (i_this->m1212 < 5 && (i_this->m0300[0] & 7) == 0) { + r30 = true; + } + } else { + daObj_Search::Act_c::setFindFlag(false); + mDoAud_seStop(JA_SE_MAJUTOU_ALERM, 30); + i_this->dr.m004 = 0; + i_this->m1212 = 0; + } + break; + } + + if (!r30) { + return; + } + + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + camera_class* camera = (camera_class*)dComIfGp_getCamera(0); + + cXyz sp2C; + u8 sp38[0x100]; + dPath__Point* pnt; + int i; + int pnt_idx; + + sp2C = camera->mLookat.mCenter - camera->mLookat.mEye; + cXyz sp20; + s16 r27_1 = cM_atan2s(sp2C.x, sp2C.z); + pnt = i_this->ppd->mpPnt; + for (int i = 0; i < i_this->ppd->m_num; i++, pnt++) { + sp2C.x = pnt->mPos.x - camera->mLookat.mEye.x; + sp2C.y = pnt->mPos.y - camera->mLookat.mEye.y; + sp2C.z = pnt->mPos.z - camera->mLookat.mEye.z; + cMtx_YrotS(*calc_mtx, -r27_1); + MtxPosition(&sp2C, &sp20); + if (sp20.z < 0.0f) { + sp38[i] = 1; + } else { + sp38[i] = 0; + } + } + + f32 f29 = REG0_F(3) + 100.0f; + bool r23 = false; + int r27 = -1; + int r24 = 0; + for (; r24 < 100; r24++, f29 += 100.0f) { + pnt = i_this->ppd->mpPnt; + for (pnt_idx = 0; pnt_idx < i_this->ppd->m_num; pnt_idx++, pnt++) { + if (sp38[pnt_idx] == 0) { continue; } + sp2C.x = player->current.pos.x - pnt->mPos.x; + sp2C.y = player->current.pos.y - pnt->mPos.y; + sp2C.z = player->current.pos.z - pnt->mPos.z; + if (sp2C.abs() < f29) { + r27 = pnt_idx; + r23 = true; + break; + } + } + if (r23) { + break; + } + } + + f29 = REG0_F(4) + 1000.0f; + r23 = false; + r24 = 0; + for (; r24 < 100; r24++, f29 += 100.0f) { + pnt = i_this->ppd->mpPnt; + for (pnt_idx = 0; pnt_idx < i_this->ppd->m_num; pnt_idx++, pnt++) { + if (sp38[pnt_idx] == 0) { continue; } + sp2C.x = player->current.pos.x - pnt->mPos.x; + sp2C.y = player->current.pos.y - pnt->mPos.y; + sp2C.z = player->current.pos.z - pnt->mPos.z; + if (sp2C.abs() > f29 && sp2C.abs() < f29 + 200.0f && r27 != pnt_idx) { + r23 = true; + break; + } + } + if (r23) { + break; + } + } + + if (r23 && r27 >= 0) { + fopAcM_prm_class* params = fopAcM_CreateAppend(); + params->mPos = pnt->mPos; + params->mAngle.x = 0; + params->mAngle.z = pnt_idx; + if (r27 > pnt_idx) { + params->mAngle.y = 1; + } else { + params->mAngle.y = -1; + } + if (cM_rndF(1.0f) < 0.5f) { + params->mParameter = (i_this->m02B6 << 0x10) | 0xFF00FF19; // TODO clean up parameters + } else { + params->mParameter = (i_this->m02B6 << 0x10) | 0xFF00FF39; // TODO clean up parameters + } + params->mRoomNo = actor->current.roomNo; + fopAcM_Create(PROC_BK, NULL, params); + i_this->m1212++; + } } /* 0000C2D0-0000CC68 .text demo_camera__FP8bk_class */ static void demo_camera(bk_class* i_this) { - /* Nonmatching */ - JUTReport(410, 430, "K SUB COUNT %d"); + fopAc_ac_c* actor = i_this; + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); + + s8 r28 = true; + cXyz sp8C; + cXyz sp80; + cXyz sp44; + cXyz sp38; + camera_class* r3; + switch (i_this->m1234) { + case 0: + break; + case 1: + if (!i_this->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, dEvtFlag_STAFF_ALL_e, 0xFFFF, 0); + i_this->eventInfo.onCondition(dEvtCnd_UNK2_e); + r28 = false; + break; + } + i_this->m1234++; + camera->mCamera.Stop(); + camera->mCamera.SetTrimSize(2); + i_this->m1236 = 0; + // Fall-through + case 2: + sp80.x = 1884.0f; + sp80.y = player->current.pos.y; + sp80.z = -4100.0f; + player->setPlayerPosAndAngle(&sp80, REG8_S(4) + 0x61A8); + i_this->m1244 = player->current.pos; + i_this->m1244.y += REG13_F(6) + 100.0f; + cMtx_YrotS(*calc_mtx, player->shape_angle.y); + sp8C.x = 0.0f; + sp8C.y = REG13_F(7) + 50.0f; + sp8C.z = REG13_F(8) + 150.0f; + MtxPosition(&sp8C, &sp80); + i_this->m1238 = player->current.pos + sp80; + i_this->m1260 = REG13_F(9) + 45.0f; + if (i_this->m1236 == 30) { + player->changeOriginalDemo(); + player->changeDemoMode(50); + } + if (i_this->m1236 != 50) { + break; + } + i_this->m1234 = 3; + i_this->m1236 = 0; + i_this->m1260 = REG8_F(5) + 35.0f; + // Fall-through + case 3: + cMtx_YrotS(*calc_mtx, REG8_S(4) + 0x61A8); + sp8C.x = 0.0f; + sp8C.y = 100.0f; + sp8C.z = REG8_F(18) + 30.0f; + MtxPosition(&sp8C, &sp80); + i_this->m1238 = player->current.pos + sp80; + i_this->m1244 = ken->current.pos; + i_this->m1244.y += REG8_F(4); + if (i_this->m1236 > 10) { + cLib_addCalc2(&i_this->m1260, REG8_F(5) + 15.0f, 0.8f, REG0_F(14) + 3.0f); + } + if (i_this->m1236 > 60) { + i_this->m1234 = 4; + i_this->m1236 = 0; + } + break; + case 4: + if (i_this->m1236 == 5) { + player->changeDemoMode(29); + player->voiceStart(0x1F); + } + i_this->m1244 = player->current.pos; + i_this->m1244.y += REG8_F(6) + 90.0f; + cMtx_YrotS(*calc_mtx, player->shape_angle.y); + sp8C.x = 0.0f; + sp8C.y = REG8_F(7) + 50.0f; + sp8C.z = REG8_F(8) + 200.0f; + MtxPosition(&sp8C, &sp80); + i_this->m1238 = player->current.pos + sp80; + i_this->m1260 = REG8_F(9) + 55.0f; + + if (i_this->m1236 == 30) { + dComIfGs_onSwitch(0xE0, actor->current.roomNo); + mDoAud_bgmAllMute(30); + } + if (i_this->m1236 == 50) { + player->changeDemoMode(25); + player->voiceStart(27); + } + if (i_this->m1236 == 70) { + i_this->m1234 = 5; + i_this->m1236 = 0; + } + break; + case 5: + if (i_this->m1236 < 35) { + i_this->m1244 = actor->current.pos; + i_this->m1244.y += REG8_F(10) + 100.0f; + cMtx_YrotS(*calc_mtx, actor->shape_angle.y); + sp8C.x = REG8_F(11) + 200.0f; + sp8C.y = REG8_F(12) + 50.0f; + sp8C.z = REG8_F(13) + 250.0f; + MtxPosition(&sp8C, &sp80); + i_this->m1238 = actor->current.pos + sp80; + i_this->m1260 = REG8_F(14) + 55.0f; + } + + if (i_this->m1236 == 5) { + anm_init(i_this, BK_BCK_BK_BIKKURI, 3.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); + } + + if (i_this->m1236 >= 35) { + i_this->dr.m710 = 1; + } + + if (i_this->m1236 == 45) { + i_this->m02B5 = 200; + i_this->dr.mState = 4; + i_this->m0300[1] = 0; + i_this->dr.m004 = 0; + } + + if (i_this->m1236 > 55) { + i_this->m1234 = 0; + camera->mCamera.Reset(i_this->m1244, i_this->m1238); + camera->mCamera.Start(); + camera->mCamera.SetTrimSize(0); + dComIfGp_event_reset(); + fopAcM_OffStatus(actor, fopAcStts_UNK4000_e); + mDoAud_subBgmStart(JA_BGM_MBOSS); + } + break; + case 10: + if (!i_this->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, dEvtFlag_STAFF_ALL_e, 0xFFFF, 0); + i_this->eventInfo.onCondition(dEvtCnd_UNK2_e); + r28 = false; + break; + } + i_this->m1234++; + camera->mCamera.Stop(); + camera->mCamera.SetTrimSize(2); + i_this->m1236 = 30; + // Fall-through + case 11: + if (i_this->m1236 == 30) { + i_this->m1234 = 0; + camera->mCamera.Reset(i_this->m1244, i_this->m1238); + camera->mCamera.Start(); + camera->mCamera.SetTrimSize(0); + dComIfGp_event_reset(); + dComIfGs_onSwitch(0xE1, actor->current.roomNo); + } + break; + case 50: + if (!i_this->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, dEvtFlag_STAFF_ALL_e, 0xFFFF, 0); + i_this->eventInfo.onCondition(dEvtCnd_UNK2_e); + r28 = false; + break; + } + camera->mCamera.Stop(); + camera->mCamera.SetTrimSize(1); + i_this->m1234 = 51; + r3 = dComIfGp_getCamera(0); + i_this->m1238 = r3->mLookat.mEye; + i_this->m1244 = r3->mLookat.mCenter; + i_this->m1260 = 55.0f; + i_this->m1236 = 0; + // Fall-through + case 51: + cLib_addCalc2(&i_this->m1260, REG0_F(13) + 30.0f, 0.2f, REG0_F(14) + 0.4f); + if (i_this->m02DE == 0) { + cLib_addCalc2(&i_this->m1244.x, actor->current.pos.x, 0.1f, 100.0f); + cLib_addCalc2(&i_this->m1244.y, actor->current.pos.y + 190.0f + REG0_F(12), 0.1f, 100.0f); + cLib_addCalc2(&i_this->m1244.z, actor->current.pos.z, 0.1f, 100.0f); + } + + if (i_this->m1236 > 150) { + i_this->m1234 = 11; + i_this->m1236 = 0; + } + break; + } + + if (i_this->m1234 != 0 && r28) { + camera->mCamera.Set(i_this->m1244, i_this->m1238, i_this->m1260, 0); + JUTReport(410, 430, "K SUB COUNT %d", i_this->m1236); + i_this->m1236++; + } } /* 0000CC68-0000CD00 .text tate_mtx_set__FP8bk_class */ @@ -3587,7 +4565,7 @@ static BOOL useHeapInit(fopAc_ac_c* i_actor) { J3DModelData* modelData; modelData = (J3DModelData*)dComIfG_getObjectRes("Bk", BK_BMD_BK_KB); - JUT_ASSERT(9418, modelData != NULL); + JUT_ASSERT(VERSION_SELECT(9398, 9418, 9418), modelData != NULL); if (i_this->m02D5 & 0x40) { J3DMaterialTable* bmt = (J3DMaterialTable*)dComIfG_getObjectRes("Bk", BK_BMT_BK_KEN); modelData->setMaterialTable(bmt, J3DMatCopyFlag_Material); @@ -3606,13 +4584,13 @@ static BOOL useHeapInit(fopAc_ac_c* i_actor) { if (i_this->m02D4 != 0) { modelData = (J3DModelData*)dComIfG_getObjectRes("Bk", BK_BMD_BK_TATE); i_this->m02D0 = mDoExt_J3DModel__create(modelData, 0, 0x11020203); - JUT_ASSERT(9445, modelData != NULL); + JUT_ASSERT(VERSION_SELECT(9425, 9445, 9445), modelData != NULL); } if (i_this->m02DC != 0) { modelData = (J3DModelData*)dComIfG_getObjectRes("Bk", BK_BDL_BOUEN); i_this->m02D8 = mDoExt_J3DModel__create(modelData, 0, 0x11020203); - JUT_ASSERT(9454, modelData != NULL); + JUT_ASSERT(VERSION_SELECT(9434, 9454, 9454), modelData != NULL); } static Vec hip_offset[] = { @@ -3750,7 +4728,6 @@ static BOOL useHeapInit(fopAc_ac_c* i_actor) { /* 0000E310-0000EA2C .text daBk_Create__FP10fopAc_ac_c */ static cPhs_State daBk_Create(fopAc_ac_c* i_actor) { - /* Nonmatching - data */ fopAcM_SetupActor(i_actor, bk_class); bk_class* i_this = (bk_class*)i_actor; @@ -3779,8 +4756,7 @@ static cPhs_State daBk_Create(fopAc_ac_c* i_actor) { i_this->m02B6 = fopAcM_GetParam(i_this) >> 16 & 0xFF; i_this->m02B7 = fopAcM_GetParam(i_this) >> 24 & 0xFF; i_this->m02B8 = i_this->current.angle.z; - i_this->current.angle.z = 0; - i_this->current.angle.x = 0; + i_this->current.angle.x = i_this->current.angle.z = 0; if (i_this->m02B8 == 0xFF) { i_this->m02B8 = 0; } @@ -3839,6 +4815,9 @@ static cPhs_State daBk_Create(fopAc_ac_c* i_actor) { if (i_this->mType == 0xA) { i_this->dr.m004 = -20; fopAcM_OnStatus(i_this, fopAcStts_BOSS_e); +#if VERSION != VERSION_USA + search_sp = 1; +#endif } else { i_this->dr.m004 = -1; } diff --git a/src/d/actor/d_a_fganon.cpp b/src/d/actor/d_a_fganon.cpp index aa981225b..ce3f97c42 100644 --- a/src/d/actor/d_a_fganon.cpp +++ b/src/d/actor/d_a_fganon.cpp @@ -2239,9 +2239,9 @@ void energy_ball_move(fganon_class* i_this) { csXyz local_7c(0,0,0); local_7c.y = (short)cM_atan2s(i_this->m3F8.x, i_this->m3F8.z); dComIfGp_particle_set(dPa_name::ID_SCENE_81F0, &i_this->m3E0, &local_7c); - #if VERSION == VERSION_USA - mDoAud_seStart(JA_SE_LK_PG_BOMB_STRIKE, &i_this->m3E0, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(a_this))); - #endif +#if VERSION == VERSION_USA + mDoAud_seStart(JA_SE_LK_PG_BOMB_STRIKE, &i_this->m3E0, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(a_this))); +#endif PSVECAdd(&i_this->m3E0, &i_this->m3F8, &i_this->m3E0); i_this->m40A = 5; } diff --git a/src/d/actor/d_a_npc_md.cpp b/src/d/actor/d_a_npc_md.cpp index 834fa692d..30786732a 100644 --- a/src/d/actor/d_a_npc_md.cpp +++ b/src/d/actor/d_a_npc_md.cpp @@ -2744,7 +2744,7 @@ void daNpc_Md_c::eventOrder() { break; case 10: mCurEvent = 6; - dComIfGp_event_order(dEvtType_OTHER_e, 0xFF, 1, 0xFFFF, dComIfGp_getPlayer(0), this, mEventIdxTable[mCurEvent]); + dComIfGp_event_order(dEvtType_OTHER_e, 0xFF, dEvtFlag_NOPARTNER_e, 0xFFFF, dComIfGp_getPlayer(0), this, mEventIdxTable[mCurEvent]); return; case 11: mCurEvent = 7; diff --git a/src/d/actor/d_a_npc_nz_cut.inc b/src/d/actor/d_a_npc_nz_cut.inc index 74870c288..cce01c2c0 100644 --- a/src/d/actor/d_a_npc_nz_cut.inc +++ b/src/d/actor/d_a_npc_nz_cut.inc @@ -365,7 +365,7 @@ void daNpc_Nz_c::cutGoHomeProc() { /* 000044D4-00004520 .text cutChkGetItemStart__10daNpc_Nz_cFv */ void daNpc_Nz_c::cutChkGetItemStart() { if(field_0x8F8 >= 3) { - fopAcM_orderChangeEventId(dComIfGp_getPlayer(0), this, field_0x8FA, 1, 0xFFFF); + fopAcM_orderChangeEventId(dComIfGp_getPlayer(0), this, field_0x8FA, dEvtFlag_NOPARTNER_e, 0xFFFF); } } diff --git a/src/d/actor/d_a_npc_people.cpp b/src/d/actor/d_a_npc_people.cpp index ba7812d95..00d07baea 100644 --- a/src/d/actor/d_a_npc_people.cpp +++ b/src/d/actor/d_a_npc_people.cpp @@ -5610,7 +5610,7 @@ void daNpcPeople_c::eventOrder() { fopAcM_orderChangeEventId(dComIfGp_getPlayer(0), this, m766[0], 0, 0xFFFF); } else if(m78D == 0xB) { - fopAcM_orderChangeEventId(dComIfGp_getPlayer(0), this, m766[0], 8, 0xFFFF); + fopAcM_orderChangeEventId(dComIfGp_getPlayer(0), this, m766[0], dEvtFlag_UNK8_e, 0xFFFF); } else if(m78D == 0xC) { fopAcM_orderChangeEventId(dComIfGp_getPlayer(0), this, m766[1], 0, 0xFFFF); diff --git a/src/d/d_cc_mass_s.cpp b/src/d/d_cc_mass_s.cpp index c2e322079..3b2005bf1 100644 --- a/src/d/d_cc_mass_s.cpp +++ b/src/d/d_cc_mass_s.cpp @@ -210,7 +210,7 @@ void dCcMassS_Mng::Clear() { /* 800AD234-800AD310 .text Set__12dCcMassS_MngFP8cCcD_ObjUc */ void dCcMassS_Mng::Set(cCcD_Obj* i_obj, u8 i_priority) { - if (mMassObjCount >= 5) { + if (mMassObjCount >= (s32)ARRAY_SIZE(mMassObjs)) { for (int i = 0; i < (s32)ARRAY_SIZE(mMassObjs); i++) { int priority = mMassObjs[i].GetPriority(); if (priority > i_priority || (priority == i_priority && cM_rndF(1.0f) < 0.5f)) { diff --git a/src/d/d_snap.cpp b/src/d/d_snap.cpp index 53b56c124..e1a0a3a9d 100644 --- a/src/d/d_snap.cpp +++ b/src/d/d_snap.cpp @@ -43,7 +43,6 @@ struct CharaData { }; // Size: 0x12 static const CharaData l_CharaData[] = { - { // 0x00 /* offset */ {0, 10, 0}, /* radius */ 25, diff --git a/src/m_Do/m_Do_mtx.cpp b/src/m_Do/m_Do_mtx.cpp index 3eb8a5452..bc2bc98e5 100644 --- a/src/m_Do/m_Do_mtx.cpp +++ b/src/m_Do/m_Do_mtx.cpp @@ -11,6 +11,22 @@ #include "weak_bss_3569.h" // IWYU pragma: keep +Mtx mDoMtx_stack_c::now; +Mtx mDoMtx_stack_c::buffer[16]; + +Mtx* mDoMtx_stack_c::next = mDoMtx_stack_c::buffer; +Mtx* mDoMtx_stack_c::end = mDoMtx_stack_c::buffer + ARRAY_SIZE(mDoMtx_stack_c::buffer); + +mDoMtx_stack_c mDoMtx_stack; + +mDoMtx_quatStack_c mDoMtx_quatStack; + +Mtx g_mDoMtx_identity = { + {1.0f, 0.0f, 0.0f, 0.0f}, + {0.0f, 1.0f, 0.0f, 0.0f}, + {0.0f, 0.0f, 1.0f, 0.0f}, +}; + /* 8000CB48-8000CBEC .text mDoMtx_XYZrotM__FPA4_fsss */ void mDoMtx_XYZrotM(Mtx mtx, s16 x, s16 y, s16 z) { Mtx tmp; @@ -281,12 +297,6 @@ void mDoMtx_MtxToRot(const Mtx m, csXyz* o_rot) { } } -Mtx mDoMtx_stack_c::now; -Mtx mDoMtx_stack_c::buffer[16]; - -Mtx* mDoMtx_stack_c::next = mDoMtx_stack_c::buffer; -Mtx* mDoMtx_stack_c::end = mDoMtx_stack_c::buffer + ARRAY_SIZE(mDoMtx_stack_c::buffer); - /* 8000D74C-8000D7CC .text push__14mDoMtx_stack_cFv */ bool mDoMtx_stack_c::push() { if (next >= end) { @@ -343,13 +353,3 @@ void mDoMtx_stack_c::quatM(const Quaternion* param_0) { mDoMtx_quat(tmp, param_0); mDoMtx_concat(now, tmp, now); } - -mDoMtx_stack_c mDoMtx_stack; - -mDoMtx_quatStack_c mDoMtx_quatStack; - -Mtx g_mDoMtx_identity = { - {1.0f, 0.0f, 0.0f, 0.0f}, - {0.0f, 1.0f, 0.0f, 0.0f}, - {0.0f, 0.0f, 1.0f, 0.0f}, -};