From a9e1527253b702e04c60cb296c13f0a83e08f8cb Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Wed, 12 Mar 2025 22:30:10 -0400 Subject: [PATCH] Work on d_a_bk, c_damagereaction --- include/c/c_damagereaction.h | 4 +- include/d/d_com_inf_game.h | 6 +- include/f_op/f_op_kankyo_mng.h | 1 + src/c/c_damagereaction.cpp | 94 +++++- src/d/actor/d_a_agbsw0.cpp | 12 +- src/d/actor/d_a_am.cpp | 81 +++--- src/d/actor/d_a_am2.cpp | 76 ++--- src/d/actor/d_a_arrow_lighteff.cpp | 2 +- src/d/actor/d_a_auction.cpp | 52 ++-- src/d/actor/d_a_bk.cpp | 448 ++++++++++++++++++++++------- src/d/actor/d_a_demo_item.cpp | 4 +- src/d/actor/d_a_disappear.cpp | 1 + src/d/actor/d_a_ghostship.cpp | 2 +- src/d/actor/d_a_item.cpp | 7 +- src/d/actor/d_a_lamp.cpp | 2 +- src/d/actor/d_a_npc_ji1.cpp | 47 +-- src/d/actor/d_a_pw.cpp | 60 ++-- src/d/actor/d_a_spc_item01.cpp | 2 +- src/d/actor/d_a_swhit0.cpp | 6 +- src/d/actor/d_a_syan.cpp | 2 +- src/d/d_com_static.cpp | 4 +- src/d/d_event_manager.cpp | 10 +- src/d/d_npc_event_cut.inc | 2 +- 23 files changed, 654 insertions(+), 271 deletions(-) diff --git a/include/c/c_damagereaction.h b/include/c/c_damagereaction.h index 6e7075e18..e6e184a7d 100644 --- a/include/c/c_damagereaction.h +++ b/include/c/c_damagereaction.h @@ -79,7 +79,7 @@ public: /* 0x000 */ fopEn_enemy_c* mpEnemy; /* 0x004 */ s16 m004; /* 0x006 */ s16 mState; - /* 0x008 */ u16 mEnemyType; + /* 0x008 */ s16 mEnemyType; /* 0x00A */ u8 m00A[0x00C - 0x00A]; /* 0x00C */ int mTimer; /* 0x010 */ csXyz m010[20]; @@ -197,7 +197,7 @@ BOOL enemy_ice(enemyice*); void enemy_fire(enemyfire*); void enemy_fire_remove(enemyfire*); void enemy_piyo_set(fopAc_ac_c*); -void wall_angle_get(fopAc_ac_c*, s16); +s16 wall_angle_get(fopAc_ac_c*, s16); void dr_body_bg_check(damagereaction*); void dr_joint_bg_check(damagereaction*); void kado_check(damagereaction*); diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 24625bdaa..8ae4465a4 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -3380,8 +3380,10 @@ inline void dComIfGp_particle_setStripes(u16 particleID, const cXyz* pos, const pParticle->setNormalStripes(particleID, pos, angle, scale, param_4, param_5); } -inline void dComIfGp_particle_setSimple(u16 particleID, cXyz* pos, u8 alpha, GXColor& prmColor, - GXColor& envColor, int param_6) { +inline void dComIfGp_particle_setSimple(u16 particleID, cXyz* pos, u8 alpha = 0xFF, + GXColor& prmColor = g_whiteColor, + GXColor& envColor = g_whiteColor, + int param_6 = 0) { dPa_control_c* pParticle = g_dComIfG_gameInfo.play.getParticle(); pParticle->setSimple(particleID, pos, alpha, prmColor, envColor, param_6); } diff --git a/include/f_op/f_op_kankyo_mng.h b/include/f_op/f_op_kankyo_mng.h index 2fa42b2e6..f73fb0f2e 100644 --- a/include/f_op/f_op_kankyo_mng.h +++ b/include/f_op/f_op_kankyo_mng.h @@ -22,6 +22,7 @@ kankyo_class* fopKyM_SearchByID(fpc_ProcID id); base_process_class* fopKyM_fastCreate(s16 param_0, int param_1, cXyz* param_2, cXyz* param_3, fopKyM_CreateFunc); fpc_ProcID fopKyM_createWpillar(cXyz const* i_pos, f32 scaleXZ, f32 scaleY, int i_param); +int fopKyM_createMpillar(cXyz const* i_pos, f32 i_size); inline void* fopKyM_GetAppend(void* param_0) { return fpcM_GetAppend(param_0); diff --git a/src/c/c_damagereaction.cpp b/src/c/c_damagereaction.cpp index e7034c9f5..2a584ac79 100644 --- a/src/c/c_damagereaction.cpp +++ b/src/c/c_damagereaction.cpp @@ -7,10 +7,13 @@ #include "dolphin/types.h" #include "d/d_com_inf_game.h" #include "d/actor/d_a_sea.h" +#include "d/actor/d_a_bk.h" #include "d/d_s_play.h" #include "f_op/f_op_actor_mng.h" +#include "f_op/f_op_kankyo_mng.h" #include "m_Do/m_Do_mtx.h" #include "d/d_cc_uty.h" +#include "d/d_bg_s_lin_chk.h" #include "d/d_procname.h" cXyz non_pos(-20000.0f, -20000.0f, 20000.0f); @@ -594,13 +597,98 @@ void enemy_piyo_set(fopAc_ac_c* enemy) { } /* 8001D48C-8001D890 .text wall_angle_get__FP10fopAc_ac_cs */ -void wall_angle_get(fopAc_ac_c*, s16) { - /* Nonmatching */ +s16 wall_angle_get(fopAc_ac_c* actor, s16 angle_y) { + dBgS_LinChk linChk; + cMtx_YrotS(*calc_mtx, angle_y); + cXyz sp20(0.0f, 0.0f, 100.0f); + cXyz sp14; + MtxPosition(&sp20, &sp14); + sp14 += actor->current.pos; + cXyz sp2C[2]; + sp20.set(10.0f, 0.0f, -300.0f); + for (int i = 0; i < 2; i++) { + MtxPosition(&sp20, &sp2C[i]); + sp20.x *= -1.0f; + sp2C[i] += sp14; + linChk.Set(&sp14, &sp2C[i], actor); + if (dComIfG_Bgsp()->LineCross(&linChk)) { + sp2C[i] = linChk.GetCross(); + } else { + return 1; + } + } + sp20 = sp2C[1] - sp2C[0]; + return cM_atan2s(sp20.x, sp20.z) + 0x4000; } /* 8001DCC8-8001E244 .text dr_body_bg_check__FP14damagereaction */ void dr_body_bg_check(damagereaction* dr) { - /* Nonmatching */ + cXyz sp20; + + f32 f31 = dr->m488 == 1 ? 12.5f : 0.0f; + if (dr->m71E == 0) { + dr->mpEnemy->current.pos.y -= dr->m44C.y + f31; + dr->mpEnemy->old.pos.y -= dr->m44C.y + f31; + dr->mpEnemy->speed.y /= 4.0f; + dr->mAcch.CrrPos(*dComIfG_Bgsp()); + dr->mpEnemy->speed.y *= 4.0f; + dr->mpEnemy->current.pos.y += dr->m44C.y + f31; + dr->mpEnemy->old.pos.y += dr->m44C.y + f31; + dr->m6E8 = dr->mpEnemy->old.pos; + dr->m6E8.y = dr->mSpawnY; + dr->mSpawnY = dr->mAcch.GetGroundH(); + } else { + dr->m71E--; + } + + if (dr->mState != 21 && dr->mState != 22) { + dBgS_ObjGndChk_Spl gndChk; + f32 x = dr->mpEnemy->current.pos.x; + f32 y = dr->mpEnemy->current.pos.y; + f32 z = dr->mpEnemy->current.pos.z; + y += 1000.0f; + Vec temp; + temp.x = x; + temp.y = y; + temp.z = z; + gndChk.SetPos(&temp); + f32 floor_y = dComIfG_Bgsp()->GroundCross(&gndChk); + if (floor_y != C_BG_MIN_HEIGHT && dr->mpEnemy->current.pos.y <= floor_y) { + dr->mpEnemy->current.pos.y = floor_y + REG0_F(13); + dr->m004 = 0; + dr->m47C = 0; + if (dComIfG_Bgsp()->ChkGrpInf(gndChk, 0x100)) { + dr->mState = 22; + cXyz sp14(x, floor_y, z); + fopKyM_createWpillar(&sp14, REG0_F(9) + 1.0f, REG0_F(10) + 1.0f, 0); + } else { + dr->mState = 21; + cXyz sp08(x, floor_y, z); + fopKyM_createMpillar(&sp08, REG0_F(14) + 0.5f); + } + } + } + + if (dr->mEnemyType == 2 && daSea_ChkArea(dr->mpEnemy->current.pos.x, dr->mpEnemy->current.pos.z)) { + f32 sea_y = daSea_calcWave(dr->mpEnemy->current.pos.x, dr->mpEnemy->current.pos.z); + sea_y -= 40.0f; + sea_y = REG0_F(13) + sea_y; + sea_y = dr->m44C.y + sea_y; + if (dr->mpEnemy->current.pos.y <= sea_y) { + dr->mpEnemy->current.pos.y = sea_y; + sp20 = dr->mpEnemy->current.pos; + sp20.y = sea_y; + fopKyM_createWpillar(&sp20, REG0_F(9) + 1.0f, REG0_F(10) + 1.0f, 0); + fopAcM_seStart(dr->mpEnemy, JA_SE_OBJ_FALL_WATER_S, 0); + fopAcM_delete(dr->mpEnemy); + bk_class* bk = (bk_class*)dr->mpEnemy; + u8 switch_no = bk->m02B8; + if (switch_no != 0) { + s8 roomNo = fopAcM_GetRoomNo(bk); + dComIfGs_onSwitch(switch_no, roomNo); + } + } + } } /* 8001E684-8001F6A0 .text dr_joint_bg_check__FP14damagereaction */ diff --git a/src/d/actor/d_a_agbsw0.cpp b/src/d/actor/d_a_agbsw0.cpp index 7f18674b3..1e3482088 100644 --- a/src/d/actor/d_a_agbsw0.cpp +++ b/src/d/actor/d_a_agbsw0.cpp @@ -698,15 +698,9 @@ BOOL daAgbsw0_c::ExeSubF2() { agb->onFree(); agb->onHold(); - f32 x = current.pos.x; - agb->current.pos.x = x; - agb->home.pos.x = x; - f32 y = current.pos.y + 50.0f; - agb->current.pos.y = y; - agb->home.pos.y = y; - f32 z = current.pos.z; - agb->current.pos.z = z; - agb->home.pos.z = z; + agb->home.pos.x = agb->current.pos.x = current.pos.x; + agb->home.pos.y = agb->current.pos.y = current.pos.y + 50.0f; + agb->home.pos.z = agb->current.pos.z = current.pos.z; agb->shape_angle.x = 0x3FFF; agb->field_0x67f = true; mOrigScaleX = scale.x; diff --git a/src/d/actor/d_a_am.cpp b/src/d/actor/d_a_am.cpp index 7e40dee72..7e6757b97 100644 --- a/src/d/actor/d_a_am.cpp +++ b/src/d/actor/d_a_am.cpp @@ -28,10 +28,23 @@ #include "weak_data_1811.h" // IWYU pragma: keep enum Action { - ACTION_DOUSA = 0x0, - ACTION_MODORU_MOVE = 0x1, - ACTION_HANDOU_MOVE = 0x2, - ACTION_ITAI_MOVE = 0x3, + ACTION_DOUSA = 0, + ACTION_MODORU_MOVE = 1, + ACTION_HANDOU_MOVE = 2, + ACTION_ITAI_MOVE = 3, +}; + +enum State { + STATE_DOUSA_INIT = 0, + STATE_DOUSA_OKIRU = 2, + STATE_DOUSA_SLEEP_INIT = 9, + STATE_DOUSA_SLEEP_MAIN = 10, + STATE_MODORU_MOVE_INIT = 20, + STATE_MODORU_MOVE_MAIN = 21, + STATE_MODORU_MOVE_END = 22, + STATE_HANDOU_MOVE_INIT = 30, + STATE_HANDOU_MOVE_MAIN = 31, + STATE_ITAI_MOVE_INIT = 40, }; /* 00000078-0000021C .text nodeCallBack__FP7J3DNodei */ @@ -182,7 +195,7 @@ static void body_atari_check(am_class* i_this) { return; } i_this->mAction = ACTION_HANDOU_MOVE; - i_this->mState = 0x1E; + i_this->mState = STATE_HANDOU_MOVE_INIT; i_this->mHugeKnockback = 0; if (player->getCutType() == 0x11) { // If the player hits the Armos Knight with the Skull Hammer's side swing, knock it back much farther than normal. @@ -271,14 +284,14 @@ static BOOL medama_atari_check(am_class* i_this) { i_this->mNeedleCyl.OnAtSPrmBit(cCcD_AtSPrm_Set_e); i_this->mNeedleCyl.OnAtHitBit(); i_this->mAction = ACTION_DOUSA; - i_this->mState = 2; + i_this->mState = STATE_DOUSA_OKIRU; } else { dComIfGp_particle_set(dPa_name::ID_COMMON_0010, &i_this->mEyeballPos, &player->shape_angle); // fopAcM_seStart(i_this, JA_SE_CM_AM_EYE_DAMAGE, 0); mDoAud_seStart(JA_SE_CM_AM_EYE_DAMAGE, &i_this->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); fopAcM_monsSeStart(i_this, JA_SE_CV_AM_EYE_DAMAGE, 0x42); i_this->mAction = ACTION_ITAI_MOVE; - i_this->mState = 0x28; + i_this->mState = STATE_ITAI_MOVE_INIT; } break; default: @@ -381,7 +394,7 @@ static BOOL bomb_nomi_check(am_class* i_this) { bomb->setBombNoHit(); bomb_move_set(i_this, 0); i_this->mAction = ACTION_ITAI_MOVE; - i_this->mState = 0x2C; + i_this->mState = 44; return TRUE; } } @@ -396,7 +409,7 @@ static BOOL bomb_nomi_check(am_class* i_this) { bomb2->set_no_hit(); bomb_move_set(i_this, 0); i_this->mAction = ACTION_ITAI_MOVE; - i_this->mState = 0x2C; + i_this->mState = 44; return TRUE; } } @@ -469,7 +482,7 @@ static void medama_move(am_class* i_this) { static void action_dousa(am_class* i_this) { daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); switch (i_this->mState) { - case 0: + case STATE_DOUSA_INIT: for (int i = 0; i < ARRAY_SIZE(i_this->mCountUpTimers); i++) { i_this->mCountUpTimers[i] = 0; } @@ -493,11 +506,11 @@ static void action_dousa(am_class* i_this) { i_this->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e; i_this->mNeedleCyl.OnAtSetBit(); i_this->mNeedleCyl.OnAtHitBit(); - i_this->mState += 1; + i_this->mState += 1; // STATE_DOUSA_OKIRU } } break; - case 2: + case STATE_DOUSA_OKIRU: if (!i_this->mpMorf->isStop()) { break; } @@ -531,18 +544,18 @@ static void action_dousa(am_class* i_this) { f32 xzDist = std::sqrtf(xDist*xDist + zDist*zDist); if (xzDist > i_this->mAreaRadius) { i_this->mAction = ACTION_MODORU_MOVE; - i_this->mState = 0x14; + i_this->mState = STATE_MODORU_MOVE_INIT; return; } } else { if (fopAcM_searchPlayerDistance(i_this) > 2000.0f) { - i_this->mState = 9; + i_this->mState = STATE_DOUSA_SLEEP_INIT; break; } f32 yDist = player->current.pos.y - i_this->current.pos.y; yDist = std::sqrtf(yDist*yDist); // ??? if (yDist > 300.0f) { - i_this->mState = 9; + i_this->mState = STATE_DOUSA_SLEEP_INIT; break; } } @@ -625,7 +638,7 @@ static void action_dousa(am_class* i_this) { i_this->mState = 3; } break; - case 9: + case STATE_DOUSA_SLEEP_INIT: anm_init(i_this, AM_BCK_SLEEP, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); fopAcM_seStart(i_this, JA_SE_CM_AM_NEEDLE_IN, 0); i_this->mNeedleCyl.OffAtSetBit(); @@ -633,7 +646,7 @@ static void action_dousa(am_class* i_this) { i_this->attention_info.flags = 0; i_this->mState += 1; break; - case 10: + case STATE_DOUSA_SLEEP_MAIN: if (i_this->mpMorf->isStop()) { i_this->mState = 0; } @@ -652,7 +665,7 @@ static void action_dousa(am_class* i_this) { /* 00002564-000028C4 .text action_modoru_move__FP8am_class */ static void action_modoru_move(am_class* i_this) { switch (i_this->mState) { - case 0x14: { + case STATE_MODORU_MOVE_INIT: { anm_init(i_this, AM_BCK_CLOSE_LOOP, 1.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, -1); i_this->mNeedleCyl.OnAtSetBit(); i_this->mNeedleCyl.OnAtHitBit(); @@ -667,7 +680,7 @@ static void action_modoru_move(am_class* i_this) { i_this->mState += 1; break; } - case 0x15: { + case STATE_MODORU_MOVE_MAIN: { f32 xDistToSpawn = i_this->mSpawnPos.x - i_this->current.pos.x; f32 zDistToSpawn = i_this->mSpawnPos.z - i_this->current.pos.z; if (i_this->mAcch.ChkGroundHit()) { @@ -696,14 +709,14 @@ static void action_modoru_move(am_class* i_this) { } break; } - case 0x16: { + case STATE_MODORU_MOVE_END: { s16 angleDiff = cLib_distanceAngleS(i_this->shape_angle.y, i_this->mTargetAngleY); if (angleDiff < 0x100) { i_this->mNeedleCyl.OffAtSetBit(); i_this->mNeedleCyl.OffAtSetBit(); i_this->attention_info.flags = 0; i_this->mAction = ACTION_DOUSA; - i_this->mState = 0; + i_this->mState = STATE_DOUSA_INIT; } break; } @@ -714,7 +727,7 @@ static void action_modoru_move(am_class* i_this) { static void action_handou_move(am_class* i_this) { daPy_py_c* player = daPy_getPlayerActorClass(); switch (i_this->mState) { - case 0x1E: { + case STATE_HANDOU_MOVE_INIT: { i_this->speedF = 20.0f; s16 angleToPlayer = fopAcM_searchPlayerAngleY(i_this); i_this->current.angle.y = angleToPlayer + 0x8000; @@ -733,7 +746,7 @@ static void action_handou_move(am_class* i_this) { i_this->mState += 1; // Fall-through } - case 0x1F: { + case STATE_HANDOU_MOVE_MAIN: { cLib_addCalc0(&i_this->speedF, 0.8f, 2.0f); if (i_this->speedF < 0.1f) { i_this->speedF = 0.0f; @@ -750,7 +763,7 @@ static void action_handou_move(am_class* i_this) { /* 00002A6C-000034F4 .text action_itai_move__FP8am_class */ static void action_itai_move(am_class* i_this) { switch (i_this->mState) { - case 0x28: + case STATE_ITAI_MOVE_INIT: i_this->mEyeRot.setall(0); i_this->mNeedleCyl.OffAtSetBit(); i_this->mNeedleCyl.OffAtSetBit(); @@ -761,7 +774,7 @@ static void action_itai_move(am_class* i_this) { anm_init(i_this, AM_BCK_DAMAGE, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); i_this->mState += 1; // Fall-through - case 0x29: + case 41: cLib_addCalc0(&i_this->speedF, 0.8f, 2.0f); if (!i_this->mpMorf->isStop()) { break; @@ -771,7 +784,7 @@ static void action_itai_move(am_class* i_this) { anm_init(i_this, AM_BCK_DAMAGE_LOOP, 1.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, -1); i_this->mState += 1; break; - case 0x2A: + case 42: if (i_this->mCountDownTimers[0] != 0) { break; } @@ -782,7 +795,7 @@ static void action_itai_move(am_class* i_this) { mDoAud_seStart(JA_SE_CM_AM_MOUTH_CLOSE, &i_this->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); i_this->mState += 1; break; - case 0x2B: + case 43: if (!i_this->mpMorf->isStop()) { break; } @@ -792,7 +805,7 @@ static void action_itai_move(am_class* i_this) { i_this->mAction = ACTION_DOUSA; i_this->mState = 3; break; - case 0x2C: + case 44: i_this->mSmokeCbs[3].end(); i_this->mStts.SetWeight(0xFF); dComIfGp_particle_setToon( @@ -808,7 +821,7 @@ static void action_itai_move(am_class* i_this) { i_this->mCountDownTimers[1] = 10; i_this->mState += 1; // Fall-through - case 0x2D: + case 45: bomb_move_set(i_this, 0); if (i_this->mpMorf->checkFrame(3.0f)) { // The fopAcM_seStart inline makes the codegen not match. @@ -835,7 +848,7 @@ static void action_itai_move(am_class* i_this) { i_this->mTargetAngleY = fopAcM_searchPlayerAngleY(i_this); i_this->mState += 1; break; - case 0x2E: + case 46: bomb_move_set(i_this, 1); i_this->shape_angle.y += 0x1000; if (i_this->mAcch.ChkGroundHit()) { @@ -878,7 +891,7 @@ static void action_itai_move(am_class* i_this) { i_this->speedF = 0.0f; i_this->mState += 1; break; - case 0x2F: + case 47: bomb_move_set(i_this, 1); if (!i_this->mpMorf->isStop()) { break; @@ -917,7 +930,7 @@ static void action_itai_move(am_class* i_this) { i_this->m0340->setGlobalRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(2)); } - if (i_this->mState == 0x29 || i_this->mState == 0x2A) { + if (i_this->mState == 41 || i_this->mState == 42) { bomb_nomi_check(i_this); } } @@ -974,11 +987,11 @@ static BOOL daAM_Execute(am_class* i_this) { i_this->speedF = 0.0f; i_this->mAction = ACTION_ITAI_MOVE; - i_this->mState = 0x2F; + i_this->mState = 47; } cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY, 1, 0x500); - if (i_this->mState != 0x2E && i_this->mState != 0x2F && i_this->mState != 0x1F) { + if (i_this->mState != 46 && i_this->mState != 47 && i_this->mState != 31) { cLib_addCalcAngleS2(&i_this->shape_angle.y, i_this->current.angle.y, 1, 0x500); } diff --git a/src/d/actor/d_a_am2.cpp b/src/d/actor/d_a_am2.cpp index ea63cc8c3..9cb03061f 100644 --- a/src/d/actor/d_a_am2.cpp +++ b/src/d/actor/d_a_am2.cpp @@ -294,7 +294,7 @@ static BOOL week_atari_check(am2_class* i_this) { } i_this->mAction = ACTION_ITAI; - i_this->mState = 0x14; + i_this->mState = 20; if (i_this->m2CE == 7 || i_this->m2CE == 8) { actor->health = 0; } @@ -341,7 +341,7 @@ static BOOL body_atari_check(am2_class* i_this) { break; } i_this->mAction = ACTION_HANDOU_MOVE; - i_this->mState = 0x1E; + i_this->mState = 30; i_this->m2CE = 7; if (player->getCutType() == 0x11) { i_this->m2CE = 8; @@ -598,7 +598,7 @@ static void action_dousa(am2_class* i_this) { fopAcM_delete(i_this); } else { i_this->mAction = ACTION_MODORU_MOVE; - i_this->mState = 0x28; + i_this->mState = 40; } } else if (!medama_atari_check(i_this)) { if (i_this->mState < 3 || !week_atari_check(i_this)) { @@ -613,7 +613,7 @@ static void action_mahi(am2_class* i_this) { fopAc_ac_c* actor = i_this; // Fixes regswaps switch (i_this->mState) { - case 0xA: + case 10: for (int i = 0; i < ARRAY_SIZE(i_this->mCountUpTimers); i++) { i_this->mCountUpTimers[i] = 0; } @@ -633,7 +633,7 @@ static void action_mahi(am2_class* i_this) { i_this->mState++; break; - case 0xB: + case 11: cLib_addCalc0(&actor->speedF, 0.5f, 1.0f); if (actor->speedF < 0.2f) { if (i_this->mpMorf->isStop()) { @@ -644,7 +644,7 @@ static void action_mahi(am2_class* i_this) { } } break; - case 0xC: + case 12: if (i_this->mCountDownTimers[3] == 0 || i_this->mCountDownTimers[3] > 3) { cLib_onBit(actor->attention_info.flags, fopAc_Attn_ACTION_CARRY_e); } @@ -653,7 +653,7 @@ static void action_mahi(am2_class* i_this) { fopAcM_delete(actor); } else { i_this->mAction = ACTION_MODORU_MOVE; - i_this->mState = 0x28; + i_this->mState = 40; } } else { if (i_this->mCountUpTimers[1] != 0 && i_this->mAcch.ChkGroundHit()) { @@ -676,7 +676,7 @@ static void action_mahi(am2_class* i_this) { } } break; - case 0xD: + case 13: actor->current.angle.y = player->shape_angle.y; if (actor->home.roomNo != actor->current.roomNo) { i_this->mbNotInHomeRoom = true; @@ -692,15 +692,15 @@ static void action_mahi(am2_class* i_this) { actor->speed.y = 25.0f; actor->speedF = 35.0f; i_this->mAcch.OnLineCheck(); - i_this->mState = 0xE; + i_this->mState = 14; } else { actor->gravity = -3.0f; i_this->mCountUpTimers[1] = 1; - i_this->mState = 0xC; + i_this->mState = 12; } } break; - case 0xE: + case 14: if (i_this->mAcch.ChkWallHit()) { actor->speedF = 0.0f; } @@ -710,7 +710,7 @@ static void action_mahi(am2_class* i_this) { } else { i_this->mAcch.OffLineCheck(); i_this->mAction = ACTION_MODORU_MOVE; - i_this->mState = 0x28; + i_this->mState = 40; } } else { if (i_this->mAcch.ChkGroundHit()) { @@ -740,20 +740,20 @@ static void action_mahi(am2_class* i_this) { } else { actor->speedF = 0.0f; i_this->mCountUpTimers[0] = 0; - i_this->mState = 0xC; + i_this->mState = 12; } } cLib_addCalc0(&actor->speedF, 0.5f, 1.0f); } break; - case 0xF: + case 15: if (naraku_check(i_this)) { if (i_this->mbNotInHomeRoom) { fopAcM_delete(actor); } else { i_this->mAction = ACTION_MODORU_MOVE; - i_this->mState = 0x28; + i_this->mState = 40; return; } } @@ -771,7 +771,7 @@ static void action_mahi(am2_class* i_this) { i_this->mTargetAngleY = actor->current.angle.y; - if (i_this->mState >= 0xC && i_this->mState != 0xF) { + if (i_this->mState >= 12 && i_this->mState != 15) { if (i_this->mStartsInactive == 1 && i_this->mSwitch != 0xFF) { if (!dComIfGs_isSwitch(i_this->mSwitch, dComIfGp_roomControl_getStayNo())) { i_this->mCountDownTimers[2] = 20*30; @@ -811,12 +811,12 @@ static void action_mahi(am2_class* i_this) { actor->gravity = -4.0f; actor->speed.y = 20.0f; i_this->mBodyCyl.OnCoSetBit(); - i_this->mState = 0xF; + i_this->mState = 15; } } } - if (fopAcM_CheckStatus(actor, fopAcStts_CARRY_e) || i_this->mState == 0xF || !week_atari_check(i_this)) { + if (fopAcM_CheckStatus(actor, fopAcStts_CARRY_e) || i_this->mState == 15 || !week_atari_check(i_this)) { body_atari_check(i_this); } } @@ -824,7 +824,7 @@ static void action_mahi(am2_class* i_this) { /* 00002B08-000032AC .text action_itai__FP9am2_class */ static void action_itai(am2_class* i_this) { switch (i_this->mState) { - case 0x14: + case 20: for (int i = 0; i < ARRAY_SIZE(i_this->mCountUpTimers); i++) { i_this->mCountUpTimers[i] = 0; } @@ -847,10 +847,10 @@ static void action_itai(am2_class* i_this) { } i_this->mState++; } else { - i_this->mState = 0x16; + i_this->mState = 22; } break; - case 0x15: + case 21: cLib_addCalc0(&i_this->speedF, 0.5f, 1.0f); if (i_this->speedF < 0.2f) { i_this->speedF = 0.0f; @@ -861,11 +861,11 @@ static void action_itai(am2_class* i_this) { } else { anm_init(i_this, AM2_BCK_MAHI, 1.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, -1); i_this->mAction = ACTION_MAHI; - i_this->mState = 0xC; + i_this->mState = 12; } } break; - case 0x16: + case 22: i_this->mEyeSph.OffTgSetBit(); i_this->mWeakSph.OffTgSetBit(); i_this->mEyeSph.ClrTgHit(); @@ -873,7 +873,7 @@ static void action_itai(am2_class* i_this) { anm_init(i_this, AM2_BCK_DEAD1, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); i_this->mState++; break; - case 0x17: + case 23: if (!i_this->mpMorf->isStop()) { break; } @@ -887,7 +887,7 @@ static void action_itai(am2_class* i_this) { anm_init(i_this, AM2_BCK_DEAD2, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); i_this->mState++; // Fall-through - case 0x18: + case 24: if (i_this->speed.y > 0.0f && i_this->mCountUpTimers[1] == 0) { fopAcM_monsSeStart(i_this, JA_SE_CV_AM2_JUMP, 0x42); i_this->mCountUpTimers[1] = 1; @@ -924,7 +924,7 @@ static void action_itai(am2_class* i_this) { i_this->mState++; } break; - case 0x19: + case 25: if (!i_this->mpMorf->isStop()) { break; } @@ -942,15 +942,15 @@ static void action_itai(am2_class* i_this) { if (naraku_check(i_this)) { if (i_this->mbNotInHomeRoom || i_this->health <= 0) { - if (i_this->mState != 0x19) { + if (i_this->mState != 25) { anm_init(i_this, AM2_BCK_DEAD3, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); fopAcM_seStart(i_this, JA_SE_CM_AM2_BEF_EXPLODE, 0); i_this->speedF = 0.0f; - i_this->mState = 0x19; + i_this->mState = 25; } } else { i_this->mAction = ACTION_MODORU_MOVE; - i_this->mState = 0x28; + i_this->mState = 40; } } } @@ -959,7 +959,7 @@ static void action_itai(am2_class* i_this) { static void action_handou_move(am2_class* i_this) { daPy_py_c* player = daPy_getPlayerActorClass(); switch (i_this->mState) { - case 0x1E: { + case 30: { i_this->speedF = 40.0f; s16 angleToPlayer = fopAcM_searchPlayerAngleY(i_this); i_this->current.angle.y = angleToPlayer + 0x8000; @@ -975,7 +975,7 @@ static void action_handou_move(am2_class* i_this) { i_this->mState++; // Fall-through } - case 0x1F: + case 31: fopAcM_seStart(i_this, JA_SE_CM_AM2_SLIP, 0); cLib_addCalc0(&i_this->speedF, 0.8f, 2.0f); if (i_this->speedF < 0.1f) { @@ -987,7 +987,7 @@ static void action_handou_move(am2_class* i_this) { i_this->attention_info.flags = 0; i_this->mCountDownTimers[2] = 20*30; i_this->mAction = ACTION_MAHI; - i_this->mState = 0xC; + i_this->mState = 12; } } } @@ -997,7 +997,7 @@ static void action_handou_move(am2_class* i_this) { fopAcM_delete(i_this); } else { i_this->mAction = ACTION_MODORU_MOVE; - i_this->mState = 0x28; + i_this->mState = 40; } } } @@ -1006,7 +1006,7 @@ static void action_handou_move(am2_class* i_this) { static void action_modoru_move(am2_class* i_this) { // Respawns the Armos back at its spawn point after it falls into an abyss. switch (i_this->mState) { - case 0x28: + case 40: dCam_getBody()->ForceLockOff(fopAcM_GetID(i_this)); i_this->mInAbyssTimer = 0; i_this->mbMadeWaterSplash = false; @@ -1015,7 +1015,7 @@ static void action_modoru_move(am2_class* i_this) { fopAcM_seStart(i_this, JA_SE_CM_AM2_WTR_RECOVER, 0); i_this->mState++; // Fall-through - case 0x29: + case 41: cLib_addCalc0(&i_this->scale.x, 1.0f, 0.1f); i_this->scale.y = i_this->scale.z = i_this->scale.x; @@ -1037,7 +1037,7 @@ static void action_modoru_move(am2_class* i_this) { i_this->mState++; } break; - case 0x2A: + case 42: i_this->shape_angle.y = i_this->mSpawnRotY; i_this->current.angle.y = i_this->shape_angle.y; i_this->current.pos = i_this->mSpawnPos; @@ -1062,7 +1062,7 @@ static void action_modoru_move(am2_class* i_this) { i_this->attention_info.flags = 0; i_this->mCountDownTimers[2] = 20*30; i_this->mAction = ACTION_MAHI; - i_this->mState = 0xC; + i_this->mState = 12; } } break; @@ -1456,7 +1456,7 @@ static s32 daAM2_Create(fopAc_ac_c* i_actor) { i_this->attention_info.flags = 0; i_this->mCountDownTimers[2] = 20*30; i_this->mAction = ACTION_MAHI; - i_this->mState = 0xC; + i_this->mState = 12; } i_this->mAcchRadius = 40.0f + REG8_F(10); diff --git a/src/d/actor/d_a_arrow_lighteff.cpp b/src/d/actor/d_a_arrow_lighteff.cpp index af1e534e7..d3d9bcf2f 100644 --- a/src/d/actor/d_a_arrow_lighteff.cpp +++ b/src/d/actor/d_a_arrow_lighteff.cpp @@ -363,7 +363,7 @@ bool daArrow_Lighteff_c::_execute() { if(field_0x2E8 == 1) { fopAcM_seStartCurrent(this, JA_SE_OBJ_FIRE_ARROW_AMB, 0); if(!dComIfGp_checkCameraAttentionStatus(cam, 0x20)) { - dComIfGp_particle_setSimple(dPa_name::ID_COMMON_4004, &field_0x29C, 0xFF, g_whiteColor, g_whiteColor, 0); + dComIfGp_particle_setSimple(dPa_name::ID_COMMON_4004, &field_0x29C); } } else if(field_0x2E8 == 2) { diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index bb976814f..cf8e7df6c 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -492,6 +492,19 @@ void daAuction_c::privateCut() { "END", "CAMERA_TEST", }; + enum { + ACT_MES_SET, + ACT_MES_END, + ACT_START, + ACT_MAIN, + ACT_GET_ITEM, + ACT_CAMERA_OFF, + ACT_GET_ITEM_NPC, + ACT_GET_ITEM_MES, + ACT_CAMERA_OFF_NPC, + ACT_END, + ACT_CAMERA_TEST, + }; int staffIdx = dComIfGp_evmng_getMyStaffId("Auction"); @@ -508,31 +521,31 @@ void daAuction_c::privateCut() { if (dComIfGp_evmng_getIsAddvance(staffIdx)) { switch (mAction) { - case 0: + case ACT_MES_SET: eventTalkInit(staffIdx); break; - case 2: + case ACT_START: eventStartInit(); break; - case 3: + case ACT_MAIN: eventMainInit(); break; - case 4: + case ACT_GET_ITEM: eventGetItemInit(); break; - case 5: + case ACT_CAMERA_OFF: eventCameraOffInit(); break; - case 6: + case ACT_GET_ITEM_NPC: eventGetItemNpcInit(staffIdx); break; - case 7: + case ACT_GET_ITEM_MES: eventGetItemMesInit(); break; - case 9: + case ACT_END: eventEndInit(); break; - case 10: + case ACT_CAMERA_TEST: eventCameraTestInit(); break; } @@ -540,31 +553,32 @@ void daAuction_c::privateCut() { bool evtRes; switch (mAction) { - case 0: + case ACT_MES_SET: evtRes = eventMesSet(); break; - case 1: + case ACT_MES_END: evtRes = eventMesEnd(); break; - case 2: + case ACT_START: evtRes = eventStart(); break; - case 3: + case ACT_MAIN: evtRes = eventMain(); break; - case 4: + case ACT_GET_ITEM: evtRes = eventGetItem(); break; - case 7: - evtRes = &daAuction_c::eventMesSet != NULL; + case ACT_GET_ITEM_MES: + // @bug They probably meant to call this function + evtRes = eventMesSet; break; - case 8: + case ACT_CAMERA_OFF_NPC: evtRes = eventCameraOffNpc(); break; - case 9: + case ACT_END: evtRes = eventEnd(); break; - case 10: + case ACT_CAMERA_TEST: evtRes = eventCameraTest(); break; default: diff --git a/src/d/actor/d_a_bk.cpp b/src/d/actor/d_a_bk.cpp index fd42d11ec..e7fc0c4bc 100644 --- a/src/d/actor/d_a_bk.cpp +++ b/src/d/actor/d_a_bk.cpp @@ -14,7 +14,6 @@ #include "d/d_item_data.h" #include "d/actor/d_a_boko.h" #include "d/actor/d_a_bomb.h" -#include "d/actor/d_a_obj_search.h" #include "d/d_bg_s_lin_chk.h" #include "m_Do/m_Do_mtx.h" #include "m_Do/m_Do_controller_pad.h" @@ -81,7 +80,7 @@ static s8 joint_check[] = { /* 000000EC-00000234 .text anm_init__FP8bk_classifUcfi */ static void anm_init(bk_class* i_this, int bckFileIdx, f32 morf, u8 loopMode, f32 speed, int soundFileIdx) { - if (i_this->dr.mState == 0x13 && bckFileIdx != BK_BCK_BK_OTISOU1 && bckFileIdx != BK_BCK_BK_OTISOU2) { + if (i_this->dr.mState == 19 && bckFileIdx != BK_BCK_BK_OTISOU1 && bckFileIdx != BK_BCK_BK_OTISOU2) { return; } if (soundFileIdx >= 0) { @@ -1169,7 +1168,7 @@ static void jyunkai(bk_class* i_this) { } if (i_this->m0B30 == 0 && daBk_wepon_view_check(i_this)) { - i_this->dr.mState = 0xC; + i_this->dr.mState = 12; i_this->dr.m004 = -1; } @@ -1201,33 +1200,33 @@ static void stand(bk_class* i_this) { cXyz sp28; switch (i_this->dr.m004) { - case -0x14: + case -20: fopAcM_OnStatus(i_this, fopAcStts_UNK4000_e); anm_init(i_this, BK_BCK_BK_WAIT, 10.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, BK_BAS_BK_WAIT); - i_this->dr.m004 = -0x13; + i_this->dr.m004 = -19; i_this->m0300[1] = 20; i_this->m02B5 = 0; // Fall-through - case -0x13: + case -19: if (i_this->m0300[1] == 0) { ken = (fopAc_ac_c*)fpcM_Search(ken_s_sub, i_this); if (ken) { sp28 = player->current.pos - ken->current.pos; if (sp28.abs() < 800.0f) { i_this->m1234 = 1; - i_this->dr.m004 = -0x12; + i_this->dr.m004 = -18; } } else { - i_this->dr.m004 = 0x01; + i_this->dr.m004 = 1; break; } } r27 = true; break; - case 0x00: + case 0: i_this->m0300[1] = l_bkHIO.m104 + cM_rndF(l_bkHIO.m106 - l_bkHIO.m104); // Fall-through - case -0x01: + case -1: i_this->dr.m004 = 1; if (i_this->m02DC != 0) { if (cM_rndF(1.0f) < 0.5f) { @@ -1242,7 +1241,7 @@ static void stand(bk_class* i_this) { } i_this->m121E++; // Fall-through - case 0x01: + case 1: cLib_addCalc2(&i_this->current.pos.x, i_this->home.pos.x, 0.5f, i_this->speed.x * 0.25f); cLib_addCalc2(&i_this->current.pos.z, i_this->home.pos.z, 0.5f, i_this->speed.z * 0.25f); cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->home.angle.y, 2, 0x800); @@ -1258,14 +1257,14 @@ static void stand(bk_class* i_this) { } } break; - case 0x02: + case 2: r28 = true; i_this->m02CA = 2; if (i_this->mpMorf->isStop()) { i_this->dr.m004 = 0; } break; - case 0x03: + case 3: r28 = true; i_this->m02CA = 2; if (i_this->mpMorf->isStop()) { @@ -1274,7 +1273,7 @@ static void stand(bk_class* i_this) { i_this->dr.m004 += 1; } break; - case 0x04: + case 4: r28 = true; i_this->m02CA = 2; if (i_this->m0300[1] == 0) { @@ -1283,22 +1282,22 @@ static void stand(bk_class* i_this) { i_this->dr.m004 = 2; } break; - case 0x0A: + case 10: if (i_this->m0300[1] == 30) { anm_init(i_this, BK_BCK_BK_BIKKURI, 3.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); } if (i_this->m0300[1] == 0) { anm_init(i_this, BK_BCK_BK_KYORO2, 10.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, BK_BAS_BK_KYORO2); - i_this->dr.m004 = 0xB; + i_this->dr.m004 = 11; i_this->m0300[3] = 30.0f + cM_rndF(30.0f); } break; - case 0x0B: + case 11: if (i_this->m0300[3] == 0) { i_this->dr.m004 = 0; } break; - case 0x14: + case 20: if (i_this->m0300[1] < 10) { i_this->dr.m710 = 1; } @@ -1309,12 +1308,12 @@ static void stand(bk_class* i_this) { return; } break; - case 0x32: + case 50: anm_init(i_this, BK_BCK_BK_KYORO1, 10.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, BK_BAS_BK_KYORO1); i_this->dr.m004 += 1; i_this->m0300[1] = 50; // Fall-through - case 0x33: + case 51: i_this->speedF = 0.0f; if (i_this->m0300[1] > 25) { r28 = true; @@ -1325,7 +1324,7 @@ static void stand(bk_class* i_this) { i_this->m0300[2] = 60; } break; - case 0x34: + case 52: sp28 = i_this->home.pos - i_this->current.pos; i_this->dr.m4D0 = cM_atan2s(sp28.x, sp28.z); if (std::sqrtf(sp28.x*sp28.x + sp28.z*sp28.z) < l_bkHIO.m054 * 0.25f * 5.0f) { @@ -1336,7 +1335,7 @@ static void stand(bk_class* i_this) { if (i_this->dr.mAcch.ChkGroundHit() && i_this->dr.mAcch.ChkWallHit()) { if (i_this->m02DC != 0) { - i_this->dr.m004 = 0x3C; + i_this->dr.m004 = 60; i_this->m0300[2] = 20; break; } @@ -1344,11 +1343,11 @@ static void stand(bk_class* i_this) { i_this->speed.y = 100.0f + REG0_F(16); anm_init(i_this, BK_BCK_BK_JUMP1, 2.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, BK_BAS_BK_JUMP1); fopAcM_monsSeStart(i_this, JA_SE_CV_BK_JUMP, 0); - i_this->dr.m004 = 0x35; + i_this->dr.m004 = 53; } break; - case 0x35: + case 53: i_this->speedF = 0.5f * l_bkHIO.m054; if (!i_this->dr.mAcch.ChkGroundHit()) { break; @@ -1356,17 +1355,17 @@ static void stand(bk_class* i_this) { anm_init(i_this, BK_BCK_BK_JUMP2, 0.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, BK_BAS_BK_JUMP2); i_this->dr.m004 += 1; break; - case 0x36: + case 54: i_this->speedF = 0.0f; if (i_this->mpMorf->isStop()) { - i_this->dr.m004 = 0x33; + i_this->dr.m004 = 51; } break; - case 0x3C: + case 60: cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->dr.m4D0 + 0x4000, 4, 0x1000); cLib_addCalc2(&i_this->speedF, l_bkHIO.m054, 1.0f, 5.0f); if (i_this->m0300[2] == 0) { - i_this->dr.m004 = 0x34; + i_this->dr.m004 = 52; } break; } @@ -1378,7 +1377,7 @@ static void stand(bk_class* i_this) { i_this->dr.m004 = 10; i_this->m0300[1] = 45.0f + cM_rndF(10.0f); } - if (!r28 && i_this->m0300[2] == 0 && i_this->dr.m004 != 0x14) { + if (!r28 && i_this->m0300[2] == 0 && i_this->dr.m004 != 20) { f32 f1; if (i_this->m02B5 != 0xFF) { f1 = i_this->m02B5 * 10.0f; @@ -1389,12 +1388,12 @@ static void stand(bk_class* i_this) { if (i_this->mPlayerDistance < f1 && daBk_player_view_check(i_this, &i_this->dr.m714->current.pos, i_this->m0332, l_bkHIO.m034) ) { - if (i_this->dr.m004 >= 0x32) { + if (i_this->dr.m004 >= 50) { i_this->dr.mState = 4; i_this->m0300[1] = 0; i_this->dr.m004 = 0; } else { - i_this->dr.m004 = 0x14; + i_this->dr.m004 = 20; anm_init(i_this, BK_BCK_BK_BIKKURI, 3.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); i_this->m0300[1] = 30; fopAcM_monsSeStart(i_this, JA_SE_CV_BK_FOUND_LINK, 0); @@ -1407,7 +1406,7 @@ static void stand(bk_class* i_this) { } } if (i_this->m0B30 == 0 && daBk_wepon_view_check(i_this)) { - i_this->dr.mState = 0xC; + i_this->dr.mState = 12; i_this->dr.m004 = -1; } } @@ -1451,10 +1450,10 @@ static void stand2(bk_class* i_this) { } switch (i_this->dr.m004) { - case 0x00: + case 0: i_this->dr.m004 = 1; // Fall-through - case 0x01: { + case 1: { if (i_this->mpSearchLight != NULL) { i_this->mpSearchLight->setBkControl(true); } @@ -1488,23 +1487,23 @@ static void stand2(bk_class* i_this) { i_this->speedF = 0.0f; break; } - case 0x0A: + case 10: i_this->m0B7B = 1; if (i_this->m0300[1] == 30) { anm_init(i_this, BK_BCK_BK_BIKKURI, 3.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); } if (i_this->m0300[1] == 0) { anm_init(i_this, BK_BCK_BK_KYORO2, 10.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, BK_BAS_BK_KYORO2); - i_this->dr.m004 = 0xB; + i_this->dr.m004 = 11; i_this->m0300[3] = 30.0f + cM_rndF(30.0f); } break; - case 0x0B: + case 11: if (i_this->m0300[3] == 0) { i_this->dr.m004 = 0; } break; - case 0x14: + case 20: i_this->m0B7B = 1; if (i_this->m0300[1] < 10) { i_this->dr.m710 = 1; @@ -1516,12 +1515,12 @@ static void stand2(bk_class* i_this) { return; } break; - case 0x32: + case 50: anm_init(i_this, BK_BCK_BK_KYORO1, 10.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, BK_BAS_BK_KYORO1); i_this->dr.m004 += 1; i_this->m0300[1] = 50; // Fall-through - case 0x33: + case 51: i_this->speedF = 0.0f; if (i_this->m0300[1] == 0) { anm_init(i_this, BK_BCK_BK_RUN, 10.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, BK_BAS_BK_RUN); @@ -1535,21 +1534,21 @@ static void stand2(bk_class* i_this) { i_this->m0300[2] = 60; } break; - case 0x34: { + case 52: { dPath__Point* pnt = &i_this->ppd->mpPnt[i_this->m1216]; i_this->m0320 = pnt->mPos; sp24 = i_this->m0320 - i_this->current.pos; goto temp_568; } - case 0x3C: + case 60: sp24 = i_this->home.pos - i_this->current.pos; temp_568: i_this->dr.m4D0 = cM_atan2s(sp24.x, sp24.z); if (std::sqrtf(sp24.x*sp24.x + sp24.z*sp24.z) < l_bkHIO.m054 * 0.25f * 5.0f) { - if (i_this->dr.m004 == 0x3C) { + if (i_this->dr.m004 == 60) { i_this->dr.m004 = 0; } else if (i_this->m1216 == 0) { - i_this->dr.m004 = 0x3C; + i_this->dr.m004 = 60; } else { i_this->m1216 += i_this->m1217; if (i_this->m1216 >= (s8)i_this->ppd->m_num) { @@ -1564,12 +1563,12 @@ temp_568: break; } - if (i_this->dr.m004 < 0x0A && r31 != 0) { - i_this->dr.m004 = 0x0A; + if (i_this->dr.m004 < 10 && r31 != 0) { + i_this->dr.m004 = 10; i_this->m0300[1] = cM_rndF(10.0f) + 45.0f; } - if (i_this->m0300[2] == 0 && i_this->dr.m004 != 0x14) { + if (i_this->m0300[2] == 0 && i_this->dr.m004 != 20) { f32 f1; if (i_this->m02B5 != 0xFF) { f1 = i_this->m02B5 * 10.0f; @@ -1580,12 +1579,12 @@ temp_568: if (i_this->mPlayerDistance < f1 && daBk_player_view_check(i_this, &i_this->dr.m714->current.pos, i_this->m0332, l_bkHIO.m034) ) { - if (i_this->dr.m004 >= 0x32) { + if (i_this->dr.m004 >= 50) { i_this->dr.mState = 4; i_this->m0300[1] = 0; i_this->dr.m004 = 0; } else { - i_this->dr.m004 = 0x14; + i_this->dr.m004 = 20; anm_init(i_this, BK_BCK_BK_BIKKURI, 3.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); i_this->m0300[1] = 30; fopAcM_monsSeStart(i_this, JA_SE_CV_BK_FOUND_LINK, 0); @@ -1599,7 +1598,7 @@ temp_568: } if (i_this->m0B30 == 0 && daBk_wepon_view_check(i_this)) { - i_this->dr.mState = 0xC; + i_this->dr.mState = 12; i_this->dr.m004 = -1; } } @@ -1762,7 +1761,6 @@ static void* shot_s_sub(void* param_1, void*) { /* 000064D8-000073B8 .text fight_run__FP8bk_class */ static void fight_run(bk_class* i_this) { - /* Nonmatching - data offsets */ daPy_py_c* player = daPy_getPlayerActorClass(); f32 stickPosX = g_mDoCPd_cpadInfo[0].mMainStickPosX; s8 r29 = 0; @@ -1782,7 +1780,7 @@ static void fight_run(bk_class* i_this) { } switch (i_this->dr.m004) { - case 0x00: + case 0: if (i_this->m0300[1] == 0) { fight_run_set(i_this); i_this->dr.m004 = 1; @@ -1793,7 +1791,7 @@ static void fight_run(bk_class* i_this) { break; } // Fall-through - case 0x01: + case 1: f32 scaleMag; if (i_this->m0B30 != 0 || i_this->m11F3 != 0) { scaleMag = l_bkHIO.m054; @@ -1860,7 +1858,7 @@ static void fight_run(bk_class* i_this) { return; } break; - case 0x02: + case 2: i_this->m120C = 0; if (cM_rndF(1.0f) < 0.3f && i_this->m0B30 == 0) { @@ -1897,32 +1895,32 @@ static void fight_run(bk_class* i_this) { } i_this->m0300[1] = 20.0f + cM_rndF(20.0f); break; - case 0x03: + case 3: cLib_addCalc2(&i_this->speedF, l_bkHIO.m060, 1.0f, 20.0f); if (r29) { i_this->speed.y = 100.0f + REG0_F(16); anm_init(i_this, BK_BCK_BK_JUMP1, 2.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, BK_BAS_BK_JUMP1); fopAcM_monsSeStart(i_this, JA_SE_CV_BK_JUMP, 0); - i_this->dr.m004 = 0x21; + i_this->dr.m004 = 33; break; } if (i_this->m0300[1] == 0) { i_this->dr.m004 = 2; } break; - case 0x21: + case 33: if (i_this->dr.mAcch.ChkGroundHit()) { anm_init(i_this, BK_BCK_BK_JUMP2, 0.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, BK_BAS_BK_JUMP2); i_this->dr.m004++; } break; - case 0x22: + case 34: i_this->speedF = 0.0f; if (i_this->mpMorf->isStop()) { i_this->dr.m004 = 3; } break; - case 0x04: + case 4: if ((i_this->m02DD & 0x2) == 0) { cLib_addCalc2(&i_this->speedF, -l_bkHIO.m060, 1.0f, 20.0f); if (i_this->m0300[1] == 0) { @@ -1937,7 +1935,7 @@ static void fight_run(bk_class* i_this) { anm_init(i_this, BK_BCK_BK_WALK2, 10.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, BK_BAS_BK_WALK2); } break; - case 0x05: + case 5: if ((i_this->m02DD & 0x4) == 0) { i_this->m0334 = 0x4000; goto temp_860; @@ -1945,7 +1943,7 @@ static void fight_run(bk_class* i_this) { i_this->m0300[1] = 0; goto temp_860; } - case 0x06: + case 6: if ((i_this->m02DD & 0x8) == 0) { i_this->m0334 = -0x4000; goto temp_860; @@ -1959,7 +1957,7 @@ static void fight_run(bk_class* i_this) { i_this->dr.m004 = 2; } break; - case 0x08: + case 8: i_this->speedF = 0.0f; if (i_this->m0300[1] == 0) { i_this->dr.m004 = 2; @@ -2007,7 +2005,7 @@ static void fight_run(bk_class* i_this) { ) ) { if (i_this->m02D4 != 0 && (cM_rndF(1.0f) <= 0.5f || l_bkHIO.m008 != 0)) { - i_this->dr.mState = 0xA; + i_this->dr.mState = 10; i_this->dr.m004 = 0; if (player->getCutType() == 0xA) { i_this->m0300[1] = 0x1E; @@ -2020,7 +2018,7 @@ static void fight_run(bk_class* i_this) { i_this->dr.mState = 5; attack_set(i_this, 1); anm_init(i_this, BK_BCK_BK_JUMP1, 2.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, BK_BAS_BK_JUMP1); - i_this->dr.m004 = -0xA; + i_this->dr.m004 = -10; i_this->speedF = -60.0f + REG0_F(3); i_this->speed.y = 80.0f + REG0_F(4); fopAcM_monsSeStart(i_this, JA_SE_CV_BK_JUMP, 0); @@ -2053,7 +2051,7 @@ static void fight_run(bk_class* i_this) { path_check(i_this, 0); } if (i_this->m0B30 == 0 && daBk_wepon_view_check(i_this)) { - i_this->dr.mState = 0xC; + i_this->dr.mState = 12; i_this->dr.m004 = -1; } if (daBk_bomb_view_check(i_this)) { @@ -2140,14 +2138,14 @@ static fopAc_ac_c* yari_hit_check(bk_class* i_this) { static void fight(bk_class* i_this) { daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); switch (i_this->dr.m004) { - case -0x0A: + case -10: if (i_this->dr.mAcch.ChkGroundHit()) { anm_init(i_this, BK_BCK_BK_JUMP2, 0.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, BK_BAS_BK_JUMP2); - i_this->dr.m004 = -0x09; + i_this->dr.m004 = -9; i_this->speedF = 0.0f; } break; - case -0x09: + case -9: if (i_this->mpMorf->isStop()) { i_this->dr.m004 = 1; i_this->m0300[2] = 8; @@ -2157,7 +2155,7 @@ static void fight(bk_class* i_this) { goto temp_1B8; } break; - case 0x00: + case 0: if (i_this->m0B30 != 0) { attack_set(i_this, 0); } else { @@ -2170,7 +2168,7 @@ static void fight(bk_class* i_this) { i_this->m0300[2] = 8; // Fall-through temp_1B8: - case 0x01: + case 1: i_this->m1040.SetAtAtp(bk_attack_AP[i_this->m0B5C]); f32 f1 = attack_info[i_this->m0B5C][i_this->m0B60].speed; if (i_this->dr.mAcch.ChkGroundHit() || (i_this->m0B5C != 1 && i_this->m0B5C != 2)) { @@ -2295,7 +2293,7 @@ temp_1B8: (i_this->m0B5C == 2 && i_this->m0B60 == 1) ) { if (i_this->m11FC != fpcM_ERROR_PROCESS_ID_e) { - i_this->dr.mState = 0xE; + i_this->dr.mState = 14; i_this->dr.m004 = 0; } else if (i_this->mPlayerDistance < l_bkHIO.m02C) { if (daBk_player_view_check(i_this, &i_this->dr.m714->current.pos, i_this->m0332, l_bkHIO.m034)) { @@ -2343,24 +2341,24 @@ temp_1B8: static void p_lost(bk_class* i_this) { i_this->dr.m710 = 0; switch (i_this->dr.m004) { - case -0x0A: + case -10: if (i_this->mpMorf->isStop() || i_this->m0300[0] == 0) { i_this->dr.m004++; i_this->m0300[0] = 5; } break; - case -0x09: + case -9: if (i_this->m0300[0] != 0) { break; } // Fall-through - case 0x00: + case 0: i_this->dr.m004 = 1; anm_init(i_this, BK_BCK_BK_KYORO2, 5.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, BK_BAS_BK_KYORO2); i_this->speedF = 0.0f; i_this->m0300[1] = 30.0f + cM_rndF(30.0f); // Fall-through - case 0x01: + case 1: int frame = i_this->mpMorf->getFrame(); if ((frame == 0xB || frame == 0x19) && cM_rndF(1.0f) < 0.5f) { fopAcM_monsSeStart(i_this, JA_SE_CV_BK_SEARCH, 0); @@ -2468,7 +2466,7 @@ static void oshi(bk_class* i_this) { i_this->dr.mState = 5; attack_set(i_this, 1); anm_init(i_this, BK_BCK_BK_JUMP1, 2.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, BK_BAS_BK_JUMP1); - i_this->dr.m004 = -0xA; + i_this->dr.m004 = -10; i_this->speedF = -90.0f + REG6_F(10); i_this->speed.y = 85.0f + REG6_F(11); fopAcM_monsSeStart(i_this, JA_SE_CV_BK_JUMP, 0); @@ -2486,16 +2484,16 @@ static void hukki(bk_class* i_this) { i_this->m030E = 2; switch (i_this->dr.m004) { - case 0xA: + case 10: anm_init(i_this, BK_BCK_BK_OKIRUA, 0.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, BK_BAS_BK_OKIRUA); i_this->m0300[2] = 15; goto temp_194; - case 0xC: + case 12: anm_init(i_this, BK_BCK_BK_OKIRUU, 0.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, BK_BAS_BK_OKIRUU); i_this->m0300[2] = 15 + REG0_S(5); temp_194: i_this->speedF = 0.0f; - i_this->dr.m004 = 0xD; + i_this->dr.m004 = 13; i_this->dr.m480 = 0; i_this->current.pos.y -= i_this->dr.m44C.y; i_this->old.pos.y -= i_this->dr.m44C.y; @@ -2508,7 +2506,7 @@ temp_194: i_this->dr.mAcch.CrrPos(*dComIfG_Bgsp()); } // Fall-through - case 0xD: + case 13: if (i_this->m0300[2] == 1) { i_this->m034C = l_bkHIO.m00C + 6; i_this->m034E = 3; @@ -2518,7 +2516,7 @@ temp_194: } if (i_this->mpMorf->isStop()) { if (i_this->mPlayerDistance < l_bkHIO.m02C) { - i_this->dr.m004 = 0xE; + i_this->dr.m004 = 14; i_this->m0300[1] = 10; } else { i_this->dr.mState = 0; @@ -2529,7 +2527,7 @@ temp_194: i_this->dr.m488 = 0; } break; - case 0xE: + case 14: i_this->dr.m710 = 1; i_this->dr.m4D0 = i_this->m0332; cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->dr.m4D0, 3, 0x1000); @@ -2651,7 +2649,42 @@ static void fail(bk_class* i_this) { /* 00008ECC-000090E0 .text yogan_fail__FP8bk_class */ static void yogan_fail(bk_class* i_this) { - /* Nonmatching */ + i_this->m030E = 5; + fopAcM_OffStatus(i_this, 0); + i_this->attention_info.flags = 0; + i_this->speedF = 0.0f; + + switch (i_this->dr.m004) { + case 0: + anm_init(i_this, BK_BCK_BK_NIGERU, 5.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, BK_BAS_BK_NIGERU); + i_this->dr.m004 = 1; + i_this->speed.y = 190.0f + REG0_F(19); + fopAcM_monsSeStart(i_this, JA_SE_CV_BK_SURPRISE, 0); + i_this->dr.m458.y = 0.0f; + i_this->dr.m44C.y = 0.0f; + i_this->dr.m480 = 0; + if (i_this->m0B30 != 0) { + i_this->m0B34 = 1; + } + // Fall-through + case 1: + dComIfGp_particle_setSimple(dPa_name::ID_SCENE_8061, &i_this->current.pos); + dComIfGp_particle_setSimple(dPa_name::ID_SCENE_8058, &i_this->current.pos); + + if ((i_this->m02F8 & 7) == 0) { + i_this->m0344.y = cM_rndF(0x10000); + i_this->m0344.x = -0x2000; + dComIfGp_particle_set(dPa_name::ID_COMMON_000E, &i_this->m116C, &i_this->m0344); + } + + cLib_addCalcAngleS2(&i_this->current.angle.x, -0x4000, 10, 0x200); + if (i_this->speed.y < 0.0f) { + i_this->dr.mState = 20; + i_this->dr.m004 = 0; + i_this->m0300[2] = 2000; + } + break; + } } /* 000090E0-0000924C .text water_fail__FP8bk_class */ @@ -2691,12 +2724,187 @@ static void water_fail(bk_class* i_this) { /* 0000924C-00009944 .text wepon_search__FP8bk_class */ static void wepon_search(bk_class* i_this) { - /* Nonmatching */ + fopAc_ac_c* actor = i_this; + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + daBoko_c* boko = (daBoko_c*)fopAcM_SearchByID(i_this->m1200); + + if (i_this->dr.m004 < 2 && (boko == NULL || (boko != NULL && fopAcM_checkCarryNow(boko)))) { + i_this->dr.mState = 0; + path_check(i_this, 0); + wait_set(i_this); + i_this->dr.m004 = 2; + return; + } + + f32 f31 = 10000.0f; + if (boko != NULL) { + cXyz delta; + delta.x = boko->current.pos.x - actor->current.pos.x; + delta.z = boko->current.pos.z - actor->current.pos.z; + i_this->dr.m4D0 = cM_atan2s(delta.x, delta.z); + f31 = std::sqrtf(delta.x*delta.x + delta.z*delta.z); + } + + switch (i_this->dr.m004) { + case -1: + i_this->dr.m004 = 0; + i_this->m11F3 = 0; + anm_init(i_this, BK_BCK_BK_HAKKEN, 3.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, BK_BAS_BK_HAKKEN); + if (f31 < 900.0f) { + i_this->m0300[1] = 20; + } else { + i_this->m0300[1] = 200; + } + i_this->m030C = 5; + fopAcM_monsSeStart(actor, JA_SE_CV_BK_FOUND_BOKO, 0); + break; + case 0: + actor->speedF = 0.0f; + if (i_this->m030C == 0) { + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->dr.m4D0, 2, 0x3000); + if (i_this->mpMorf->isStop() || i_this->m0300[1] == 0) { + i_this->dr.m004 = 1; + i_this->m030A = l_bkHIO.m08E; + anm_init(i_this, BK_BCK_BK_RUN, 3.0f, J3DFrameCtrl::LOOP_REPEAT_e, l_bkHIO.m074, BK_BAS_BK_RUN); + i_this->m02CE = 0; + } + } + break; + case 1: + actor->speedF = l_bkHIO.m05C; + i_this->m034C = l_bkHIO.m00C + 3; + i_this->m034E = 4; + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->dr.m4D0, 4, 0x1000); + if (f31 < REG8_F(2) + 150.0f) { + i_this->dr.m004 = 2; + anm_init(i_this, BK_BCK_BK_CATCH, 2.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, BK_BAS_BK_CATCH); + i_this->m0300[1] = 29; + } else { + if (i_this->m030A == 0) { + i_this->dr.mState = 4; + i_this->m0300[1] = 0; + i_this->m11F3 = 1; + } else if (i_this->dr.mAcch.ChkGroundHit() && i_this->dr.mAcch.ChkWallHit()) { + if (i_this->m02CE < 2) { + actor->speed.y = 100.0f + REG0_F(16); + anm_init(i_this, BK_BCK_BK_JUMP1, 2.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, BK_BAS_BK_JUMP1); + fopAcM_monsSeStart(actor, JA_SE_CV_BK_JUMP, 0); + i_this->dr.m004 = 5; + i_this->m02CE++; + } else { + i_this->dr.mState = 0; + path_check(i_this, 0); + wait_set(i_this); + i_this->dr.m004 = 2; + i_this->m02CC = 70; + } + } + } + break; + case 2: + actor->speedF = 0.0f; + if (i_this->m0300[1] == 24) { + if (boko != NULL && !fopAcM_checkCarryNow(boko)) { + i_this->m0B30 = 2; + if (fopAcM_GetParam(boko) == 0) { + i_this->m02D5 = 0; + i_this->m1040.SetAtType(AT_TYPE_UNK2000); + i_this->m1040.SetAtSe(dCcG_SE_UNK4); + } else { + i_this->m02D5 = 1; + i_this->m1040.SetAtType(AT_TYPE_UNK800); + i_this->m1040.SetAtSe(dCcG_SE_UNK2); + } + fopAcM_setCarryNow(boko, FALSE); + } else { + i_this->dr.mState = 0; + path_check(i_this, 0); + wait_set(i_this); + i_this->dr.m004 = 2; + } + } + if (i_this->m0300[1] < 14) { + i_this->dr.m710 = 1; + i_this->dr.m4D0 = i_this->m0332; + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->dr.m4D0, 3, 0x800); + } + if (i_this->mpMorf->isStop()) { + if (l_bkHIO.m00A == 0 && !player->checkGrabWear() && i_this->mPlayerDistance < l_bkHIO.m02C) { + i_this->dr.mState = 5; + i_this->m0B5C = 0; + i_this->m0B64 = 18.0f; + i_this->m0B68 = REG6_F(6) + 23.0f; + i_this->m0B6C = REG6_F(7) + 26.0f; + i_this->m0B70 = 63.0f; + i_this->m0B74 = l_bkHIO.m09C; + i_this->m0B7A = 1; + i_this->m0B60 = 1; + attack_info_s* info = attack_info[i_this->m0B5C]; + info++; // TODO: fakematch? + anm_init(i_this, info->bckFileIdx, 5.0f, J3DFrameCtrl::LOOP_ONCE_e, info->speed, info->soundFileIdx); + i_this->dr.m004 = 1; + i_this->m11F2 = 1; + } else { + i_this->dr.mState = 0; + path_check(i_this, 0); + wait_set(i_this); + i_this->dr.m004 = 2; + } + } + break; + case 5: + actor->speedF = l_bkHIO.m05C * 0.5f; + if (i_this->dr.mAcch.ChkGroundHit()) { + anm_init(i_this, BK_BCK_BK_JUMP2, 0.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, BK_BAS_BK_JUMP2); + i_this->dr.m004++; + } + break; + case 6: + actor->speedF = 0.0f; + if (i_this->mpMorf->isStop()) { + i_this->dr.m004 = 1; + anm_init(i_this, BK_BCK_BK_RUN, 3.0f, J3DFrameCtrl::LOOP_REPEAT_e, l_bkHIO.m074, BK_BAS_BK_RUN); + } + break; + } } /* 00009944-00009AFC .text d_dozou__FP8bk_class */ static void d_dozou(bk_class* i_this) { - /* Nonmatching */ + i_this->m030E = 5; + fopAcM_OffStatus(i_this, 0); + i_this->attention_info.flags = 0; + + switch (i_this->dr.m004) { + case 0: + i_this->dr.m004 = 1; + i_this->dr.mStts.Init(0xFF, 0xFF, i_this); + if (i_this->m02B5 == 0) { + anm_init(i_this, BK_BCK_BK_ATTACK2, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 0.0f, BK_BAS_BK_ATTACK2); + i_this->mpMorf->setFrame(0.0f); + } else { + anm_init(i_this, BK_BCK_BK_NOBI, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 0.0f, BK_BAS_BK_NOBI); + i_this->mpMorf->setFrame(27.0f); + } + // Fall-through + case 1: + if ( + (i_this->m02B7 != 0xFF && dComIfGs_isSwitch(i_this->m02B7, fopAcM_GetRoomNo(i_this))) || + (i_this->m02B7 == 0xFF && dComIfGs_isEventBit(0x3802)) + ) { + i_this->mpMorf->setPlaySpeed(1.0f); + i_this->dr.m004 = 2; + } + break; + case 2: + if (i_this->mpMorf->isStop()) { + i_this->dr.mStts.Init(200, 0xFF, i_this); + i_this->dr.mState = 0; + i_this->dr.m004 = 0; + i_this->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e; + } + break; + } } /* 00009AFC-00009B0C .text carry__FP8bk_class */ @@ -2706,7 +2914,51 @@ static void carry(bk_class* i_this) { /* 00009B0C-00009DF0 .text carry_drop__FP8bk_class */ static void carry_drop(bk_class* i_this) { - /* Nonmatching */ + fopAc_ac_c* actor = i_this; + + cLib_addCalc0(&i_this->dr.m468, 1.0f, 5.5f); + cLib_addCalc0(&i_this->dr.m46C, 1.0f, 0.5f); + cLib_addCalcAngleS2(&i_this->shape_angle.x, 0, 1, 0x100); + cLib_addCalcAngleS2(&i_this->shape_angle.z, 0, 1, 0x100); + cLib_addCalcAngleS2(&i_this->shape_angle.y, i_this->m0332, 4, 0x800); + + switch (i_this->dr.m004) { + case 0: + dComIfGs_onEventBit(0x0004); + i_this->dr.m004 = 1; + anm_init(i_this, BK_BCK_BK_KOUKA, 3.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); + // Fall-through + case 1: + if (i_this->dr.mAcch.ChkGroundHit()) { + anm_init(i_this, BK_BCK_BK_TYAKU, 0.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); + i_this->dr.m004 = 2; + i_this->m034C = l_bkHIO.m00C + 15; + i_this->m034E = 3; + i_this->dr.mMaxFallDistance = 1000.0f; + fopAcM_seStart(i_this, JA_SE_CM_BK_BB_LANDING, 0); + } + break; + case 2: + cLib_addCalc0(&i_this->dr.m468, 1.0f, 50.0f); + cLib_addCalc0(&i_this->dr.m46C, 1.0f, 50.0f); + cLib_addCalcAngleS2(&i_this->shape_angle.x, 0, 1, 0x1000); + cLib_addCalcAngleS2(&i_this->shape_angle.z, 0, 1, 0x1000); + cLib_addCalc0(&i_this->speedF, 1.0f, 1.0f); + if (i_this->mpMorf->isStop()) { + anm_init(i_this, BK_BCK_BK_KIME, 0.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); + i_this->dr.m004 = 3; + fopAcM_monsSeStart(actor, JA_SE_CV_BK_SURPRISE, 0); + } + break; + case 3: + cLib_addCalc0(&i_this->speedF, 1.0f, 1.0f); + if (i_this->mpMorf->isStop()) { + i_this->dr.mState = 0; + i_this->dr.m004 = 0; + i_this->current.angle = i_this->shape_angle; + } + break; + } } /* 00009DF0-00009F1C .text d_mahi__FP8bk_class */ @@ -2899,8 +3151,6 @@ static void bou_mtx_set(bk_class* i_this) { } } -static u8 temp[0x118] = {}; - /* 0000CE18-0000DD1C .text daBk_Execute__FP8bk_class */ static BOOL daBk_Execute(bk_class* i_this) { another_hit = 0; @@ -3063,7 +3313,7 @@ static BOOL daBk_Execute(bk_class* i_this) { i_this->dr.mpEnemy = i_this; i_this->dr.mEnemyType = 2; } - if (i_this->dr.mState != 0x1F) { + if (i_this->dr.mState != 31) { i_this->shape_angle = i_this->current.angle; } @@ -3083,7 +3333,7 @@ static BOOL daBk_Execute(bk_class* i_this) { anm_init(i_this, BK_BCK_BK_UTUBUSE, 2.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, BK_BAS_BK_UTUBUSE); break; case 5: - if (i_this->dr.mState != 4 && i_this->dr.mState != 0xB) { + if (i_this->dr.mState != 4 && i_this->dr.mState != 11) { wait_set(i_this); i_this->dr.mState = 4; i_this->dr.m004 = 0; @@ -3101,7 +3351,7 @@ static BOOL daBk_Execute(bk_class* i_this) { case 20: i_this->m0336 = 1; i_this->m0344.x = -0x4000; - i_this->m034C = l_bkHIO.m00C + 0x10; + i_this->m034C = l_bkHIO.m00C + 16; i_this->m034E = 1; i_this->dr.m4C8[2] = l_bkHIO.m08C; break; @@ -3199,7 +3449,7 @@ static BOOL daBk_Execute(bk_class* i_this) { sp40.y -= 20000.0f; sp34.y -= 20000.0f; } - if (i_this->dr.mState == 0xA) { + if (i_this->dr.mState == 10) { sp40.y -= 20000.0f; sp34.y -= 100.0f; } @@ -3216,7 +3466,7 @@ static BOOL daBk_Execute(bk_class* i_this) { } } - if (i_this->dr.mAcch.ChkGroundHit() || i_this->dr.mState == 0x13) { + if (i_this->dr.mAcch.ChkGroundHit() || i_this->dr.mState == 19) { dBgS_GndChk gndChk; s16 r21 = 0x7FFF; s16 r23 = 0x7FFF; @@ -3250,7 +3500,7 @@ static BOOL daBk_Execute(bk_class* i_this) { } } } - if (i_this->dr.mState == 0x13) { + if (i_this->dr.mState == 19) { r23 = 0; r21 = 0; } @@ -3587,7 +3837,7 @@ static s32 daBk_Create(fopAc_ac_c* i_actor) { if (i_this->mType == 4 || i_this->mType == 0xA) { i_this->dr.mState = 1; if (i_this->mType == 0xA) { - i_this->dr.m004 = -0x14; + i_this->dr.m004 = -20; fopAcM_OnStatus(i_this, fopAcStts_BOSS_e); } else { i_this->dr.m004 = -1; @@ -3597,15 +3847,15 @@ static s32 daBk_Create(fopAc_ac_c* i_actor) { i_this->dr.mState = 2; i_this->dr.mMaxFallDistance = 300.0f; } else if (i_this->mType == 7) { - i_this->dr.mState = 0x1D; + i_this->dr.mState = 29; i_this->dr.mMaxFallDistance = 300.0f; } else if (i_this->mType == 5) { anm_init(i_this, BK_BCK_BK_HAKOBI, 1.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, -1); - i_this->dr.mState = 0x1E; + i_this->dr.mState = 30; i_this->dr.mMaxFallDistance = 100000.0f; } else if (i_this->mType == 2 || i_this->mType == 3) { i_this->m02BA = 0xFF; - i_this->dr.mState = 0xF; + i_this->dr.mState = 15; i_this->m030E = 0xA; } else if (i_this->mType == 9) { i_this->dr.mState = 3; @@ -3622,7 +3872,7 @@ static s32 daBk_Create(fopAc_ac_c* i_actor) { } if (i_this->mType == 0xF) { - i_this->dr.mState = 0x17; + i_this->dr.mState = 23; i_this->m02BA = 0; } diff --git a/src/d/actor/d_a_demo_item.cpp b/src/d/actor/d_a_demo_item.cpp index 236414a5a..3c3d70b4e 100644 --- a/src/d/actor/d_a_demo_item.cpp +++ b/src/d/actor/d_a_demo_item.cpp @@ -336,9 +336,7 @@ void daDitem_c::set_effect() { rot.y = angleY; rot.z = 0; mpEmitters[i]->playCreateParticle(); - JGeometry::TVec3 pos; - pos.set(current.pos); - mpEmitters[i]->setGlobalTranslation(pos); + mpEmitters[i]->setGlobalTranslation(current.pos); mpEmitters[i]->setGlobalRotation(rot); } } diff --git a/src/d/actor/d_a_disappear.cpp b/src/d/actor/d_a_disappear.cpp index c7c79a6be..e02bfc9f1 100644 --- a/src/d/actor/d_a_disappear.cpp +++ b/src/d/actor/d_a_disappear.cpp @@ -77,6 +77,7 @@ void set_disappear(disappear_class* i_this, float scale) { case 0xC: case 0xD: dComIfGp_particle_set(dPa_name::ID_COMMON_0014, &i_this->current.pos, NULL, &particleScale); + // Fall-through case 0x3: dComIfGp_particle_set(dPa_name::ID_COMMON_0013, &i_this->current.pos, NULL, &particleScale); dComIfGp_particle_setStripes(dPa_name::ID_COMMON_0015, &i_this->current.pos, NULL, &particleScale, 0xFF, 0x96); diff --git a/src/d/actor/d_a_ghostship.cpp b/src/d/actor/d_a_ghostship.cpp index 792a808d1..9998b8f44 100644 --- a/src/d/actor/d_a_ghostship.cpp +++ b/src/d/actor/d_a_ghostship.cpp @@ -345,7 +345,7 @@ bool daGhostship_c::_execute() { dLib_setCirclePath(&mPaths[i]); if(mAlpha != 0.0f) { - dComIfGp_particle_setSimple(dPa_name::ID_SCENE_8306, &mPaths[i].mPos, 0xFF, g_whiteColor, g_whiteColor, 0); + dComIfGp_particle_setSimple(dPa_name::ID_SCENE_8306, &mPaths[i].mPos); } } diff --git a/src/d/actor/d_a_item.cpp b/src/d/actor/d_a_item.cpp index abc7af9ae..0c7649285 100644 --- a/src/d/actor/d_a_item.cpp +++ b/src/d/actor/d_a_item.cpp @@ -1037,10 +1037,7 @@ BOOL daItem_c::itemActionForArrow() { mAcch.CrrPos(*dComIfG_Bgsp()); if (mOnGroundTimer == 0 && mpParticleEmitter && fopAcM_SearchByName(PROC_BST)) { // Gohdan - f32 transX = current.pos.x; - f32 transY = current.pos.y; - f32 transZ = current.pos.z; - mpParticleEmitter->setGlobalTranslation(transX, transY, transZ); + mpParticleEmitter->setGlobalTranslation(current.pos); } if (mAcch.ChkGroundLanding()) { @@ -1244,7 +1241,7 @@ void daItem_c::mode_water_init() { void daItem_c::mode_wait() { if (checkFlag(FLAG_UNK04) && dItem_data::checkAppearEffect(m_itemNo)) { u16 appearEffect = dItem_data::getAppearEffect(m_itemNo); - dComIfGp_particle_setSimple(appearEffect, ¤t.pos, 0xFF, g_whiteColor, g_whiteColor, 0); + dComIfGp_particle_setSimple(appearEffect, ¤t.pos); } switch (m_itemNo) { diff --git a/src/d/actor/d_a_lamp.cpp b/src/d/actor/d_a_lamp.cpp index ebe34addf..24404f3f2 100644 --- a/src/d/actor/d_a_lamp.cpp +++ b/src/d/actor/d_a_lamp.cpp @@ -96,7 +96,7 @@ static BOOL daLamp_Execute(lamp_class* i_this) { if (i_this->mPa.getEmitter()) { cXyz whitePartPos = i_this->mPos; whitePartPos.y += partHeightOffset; - dComIfGp_particle_setSimple(dPa_name::ID_COMMON_4004, &whitePartPos, 0xFF, g_whiteColor, g_whiteColor, 0); + dComIfGp_particle_setSimple(dPa_name::ID_COMMON_4004, &whitePartPos); cLib_addCalc2(&i_this->mParticlePower, cM_rndF(0.2f) + 1.0f, 0.5f, partMaxFlickerPerTick); } else { i_this->mParticlePower = 0.0f; diff --git a/src/d/actor/d_a_npc_ji1.cpp b/src/d/actor/d_a_npc_ji1.cpp index d8b343532..cb4c5ae26 100644 --- a/src/d/actor/d_a_npc_ji1.cpp +++ b/src/d/actor/d_a_npc_ji1.cpp @@ -1788,6 +1788,21 @@ u32 daNpc_Ji1_c::privateCut() { "CONTINUETALK", "SETANGLE", }; + enum { + ACT_SETANM, + ACT_TALKMSG, + ACT_INITPOS, + ACT_CREATEITEM, + ACT_SOUND, + ACT_HEADSWING, + ACT_HARPOON, + ACT_ROLLAT_CNT, + ACT_GAME_MODE, + ACT_TURN_TO_PLAYER, + ACT_HIDE, + ACT_CONTINUETALK, + ACT_SETANGLE, + }; int actIdx = dComIfGp_evmng_getMyActIdx(staffIdx, cut_name_tbl, ARRAY_SIZE(cut_name_tbl), 1, 0); if(actIdx == -1) { dComIfGp_evmng_cutEnd(staffIdx); @@ -1795,40 +1810,40 @@ u32 daNpc_Ji1_c::privateCut() { else { if(dComIfGp_evmng_getIsAddvance(staffIdx)) { switch(actIdx) { - case 0: + case ACT_SETANM: evn_setAnm_init(staffIdx); break; - case 1: + case ACT_TALKMSG: evn_talk_init(staffIdx); break; - case 2: + case ACT_INITPOS: evn_init_pos_init(staffIdx); break; - case 3: + case ACT_CREATEITEM: createItem(); break; - case 4: + case ACT_SOUND: evn_sound_proc_init(staffIdx); break; - case 5: + case ACT_HEADSWING: evn_head_swing_init(staffIdx); break; - case 6: + case ACT_HARPOON: evn_harpoon_proc_init(staffIdx); break; - case 7: + case ACT_ROLLAT_CNT: evn_RollAtControl_init(staffIdx); break; - case 8: + case ACT_GAME_MODE: evn_game_mode_init(staffIdx); break; - case 0xA: + case ACT_HIDE: evn_hide_init(staffIdx); break; - case 0xB: + case ACT_CONTINUETALK: evn_continue_talk_init(staffIdx); break; - case 0xC: + case ACT_SETANGLE: evn_setAngle_init(staffIdx); break; } @@ -1836,16 +1851,16 @@ u32 daNpc_Ji1_c::privateCut() { BOOL end; switch(actIdx) { - case 1: + case ACT_TALKMSG: end = evn_talk(); break; - case 7: + case ACT_ROLLAT_CNT: end = evn_RollAtControl(); break; - case 9: + case ACT_TURN_TO_PLAYER: end = evn_turn_to_player(); break; - case 0xB: + case ACT_CONTINUETALK: end = evn_continue_talk(); break; default: diff --git a/src/d/actor/d_a_pw.cpp b/src/d/actor/d_a_pw.cpp index 9d9e94252..6d81c6d28 100644 --- a/src/d/actor/d_a_pw.cpp +++ b/src/d/actor/d_a_pw.cpp @@ -180,7 +180,7 @@ void action_dousa(pw_class* i_this) { i_this->m346 = 0; i_this->mState += 1; break; - case 0x1: + case 1: if (fopAcM_searchPlayerDistance(i_this) < 500.0f) { anm_init(i_this, PW_BCK_DERUA1, 3.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); i_this->m38C = fopAcM_searchPlayerAngleY(i_this); @@ -191,7 +191,7 @@ void action_dousa(pw_class* i_this) { i_this->mState += 1; } break; - case 0x2: + case 2: i_this->shape_angle.y += 0x1000; cLib_addCalc0(&i_this->m3A4, 1.0f, 3.0f); i_this->m39A += 7; @@ -210,12 +210,12 @@ void action_dousa(pw_class* i_this) { i_this->mState = 0x0A; } break; - case 0x9: + case 9: i_this->m39A = 0; i_this->m39C = 0; i_this->mState += 1; // Fall-through - case 0xA: + case 10: if (i_this->mBehaviorType == InvisibleAtStart) { i_this->m38C = fopAcM_searchPlayerAngleY(i_this); } @@ -237,7 +237,7 @@ void action_dousa(pw_class* i_this) { } } break; - case 0xB: + case 11: dKyr_get_vectle_calc(&i_this->current.pos, &camera->mLookat.mEye, &camfwd); i_this->mActorPlace.pos.x = i_this->m2CC.x + camfwd.x * 150.0f; i_this->mActorPlace.pos.y = i_this->m2CC.y; @@ -260,7 +260,7 @@ void action_dousa(pw_class* i_this) { } } break; - case 0x6: + case 6: i_this->m39A += 10; if (i_this->m39A > 100) { i_this->m39A = 100; @@ -272,7 +272,7 @@ void action_dousa(pw_class* i_this) { i_this->mState = 0xD; } break; - case 0x7: + case 7: if (fopAcM_searchPlayerDistance(i_this) < i_this->mNoticeRange) { i_this->m38C = fopAcM_searchPlayerAngleY(i_this); i_this->current.angle.y = i_this->m38C; @@ -281,7 +281,7 @@ void action_dousa(pw_class* i_this) { i_this->mState = 6; } break; - case 0x8: + case 8: i_this->m380 = 2; i_this->m346 = 1; if (fopAcM_searchPlayerDistance(i_this) < i_this->m3AC) { @@ -289,7 +289,7 @@ void action_dousa(pw_class* i_this) { i_this->mState = 7; } break; - case 0xD: + case 13: for (int i = 0; i < 4; i++) { i_this->m384[i] = 0; } @@ -303,14 +303,14 @@ void action_dousa(pw_class* i_this) { } i_this->mState += 1; // Fall-through - case 0xE: + case 14: cLib_addCalc0(&i_this->speedF, 1.0f, 1.0f); if (i_this->m378) { break; } i_this->mState += 1; // Fall-through - case 0xF: + case 15: i_this->m378 = cM_rndF(120.0f) + 120.0f; if (i_this->m346 == 1) { if (i_this->mBckIdx != PW_BCK_IDOU1) { @@ -328,7 +328,7 @@ void action_dousa(pw_class* i_this) { i_this->mState = 0x10; } break; - case 0x10: + case 16: i_this->speedF = 5.0f; move_sound(i_this); if (i_this->m37A == 0) { @@ -339,7 +339,7 @@ void action_dousa(pw_class* i_this) { } } break; - case 0x14: + case 20: i_this->m2FC = i_this->current.pos; if (i_this->mPathIndex != 0xFF && i_this->mpPath != NULL) { i_this->speedF = 5.0f; @@ -357,42 +357,42 @@ void action_dousa(pw_class* i_this) { } } break; - case 0x19: + case 25: i_this->m38C = fopAcM_searchPlayerAngleY(i_this); anm_init(i_this, PW_BCK_DAMAGE_K1, 9.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); i_this->speedF = -2.0f; i_this->mState += 1; break; - case 0x1A: + case 26: break; - case 0x1B: - case 0x1C: + case 27: + case 28: if (!fopAcM_CheckStatus(i_this, fopAcStts_HOOK_CARRY_e)) { i_this->mState = 0x5A; } break; - case 0x65: + case 101: if (!i_this->mpMorf->isStop()) { break; } // Fall-through - case 0x5A: - case 0x5B: + case 90: + case 91: // TODO Big_pow_gattai_check(i_this); break; - case 0x5C: + case 92: break; - case 0x64: + case 100: anm_init(i_this, PW_BCK_JITTAIKA1, 6.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); i_this->mState += 1; break; - case 0x6E: + case 110: anm_init(i_this, PW_BCK_ATTACK1, 7.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, -1); // TODO i_this->mState += 1; break; - case 0x6F: + case 111: if (i_this->m5C4.mpEmitter != NULL) { i_this->mActorPlace.pos = i_this->current.pos; i_this->mActorPlace.angle = i_this->shape_angle; @@ -405,23 +405,23 @@ void action_dousa(pw_class* i_this) { i_this->gravity = 0.0f; anm_init(i_this, PW_BCK_SIRIMOTI1, 0.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); i_this->mState += 1; - case 0x70: + case 112: // Fall-through if (i_this->mpMorf->isStop()) { - i_this->mState = 0x5A; + i_this->mState = 90; } break; } - if (i_this->mState <= 0xB) { + if (i_this->mState <= 11) { return; } - if (i_this->m37C == 0 && i_this->mState < 0x5A) { - if (i_this->mState == 0x0E || i_this->mState == 0x10 || i_this->mState == 0x14) { + if (i_this->m37C == 0 && i_this->mState < 90) { + if (i_this->mState == 14 || i_this->mState == 16 || i_this->mState == 20) { if (!hani_check(i_this) && fopAcM_searchPlayerDistance(i_this) < 500.0f && std::fabsf(i_this->current.pos.y - player->current.pos.y) < 100.0f) { if (!Line_check(i_this, i_this->current.pos, 1) && (i_this->m346 == 1 || !TORITUKI_ON)) { i_this->mAction = 1; - i_this->mState = 0x1E; + i_this->mState = 30; } } } diff --git a/src/d/actor/d_a_spc_item01.cpp b/src/d/actor/d_a_spc_item01.cpp index 2a74e475b..a3242180b 100644 --- a/src/d/actor/d_a_spc_item01.cpp +++ b/src/d/actor/d_a_spc_item01.cpp @@ -146,7 +146,7 @@ BOOL daSpcItem01_c::_execute() { /* 8015DFE8-8015E070 .text set_effect__13daSpcItem01_cFv */ void daSpcItem01_c::set_effect() { if (cLib_checkBit(field_0x644, (u16)0x01) && dItem_data::checkAppearEffect(m_itemNo) && !field_0x642 && m_itemNo != BOKO_BELT) { - dComIfGp_particle_setSimple(dItem_data::getAppearEffect(m_itemNo), ¤t.pos, (u8)0xFF, g_whiteColor, g_whiteColor, 0); + dComIfGp_particle_setSimple(dItem_data::getAppearEffect(m_itemNo), ¤t.pos); } } diff --git a/src/d/actor/d_a_swhit0.cpp b/src/d/actor/d_a_swhit0.cpp index 09615b74f..84c16f0aa 100644 --- a/src/d/actor/d_a_swhit0.cpp +++ b/src/d/actor/d_a_swhit0.cpp @@ -218,11 +218,15 @@ s32 daSwhit0_c::DemoProc() { "WAIT", "CHANGE" }; + enum { + ACT_WAIT, + ACT_CHANGE, + }; if (dComIfGp_evmng_getIsAddvance(mStaffId)) { switch(dComIfGp_evmng_getMyActIdx(mStaffId, action_table, ARRAY_SIZE(action_table), FALSE, 0)) { - case 1: + case ACT_CHANGE: dComIfGs_onSwitch(getSwNo(), fopAcM_GetRoomNo(this)); onFlag(0x01); diff --git a/src/d/actor/d_a_syan.cpp b/src/d/actor/d_a_syan.cpp index b4047e9c4..968ebfd61 100644 --- a/src/d/actor/d_a_syan.cpp +++ b/src/d/actor/d_a_syan.cpp @@ -162,7 +162,7 @@ static BOOL daSyan_Execute(syan_class* i_this) { i_this->emtrCallBack[i].getEmitter()->setGlobalParticleScale(scale); cXyz pos(i_this->partPos[i].x, i_this->partPos[i].y + REG0_F(7) + 20.0f, i_this->partPos[i].z); - dComIfGp_particle_setSimple(dPa_name::ID_COMMON_4004, &pos, 0xFF, g_whiteColor, g_whiteColor, 0); + dComIfGp_particle_setSimple(dPa_name::ID_COMMON_4004, &pos); } } } diff --git a/src/d/d_com_static.cpp b/src/d/d_com_static.cpp index 89c4c5925..b2eb30f13 100644 --- a/src/d/d_com_static.cpp +++ b/src/d/d_com_static.cpp @@ -438,10 +438,10 @@ BOOL daStandItem_c::daiItemNodeCallBack(J3DNode* node, int calcTiming) { daStandItem_c* i_this = (daStandItem_c*)userArea; mDoMtx_stack_c::copy(model->getAnmMtx(jntNo)); switch (i_this->getItemNo()) { - case 0x92: + case WIND_FLAG: mDoMtx_stack_c::XrotM(i_this->m6B4); break; - case 0x95: + case WATER_STATUE: if (jntNo == 0) { mDoMtx_copy(mDoMtx_stack_c::get(), i_this->m630); } else if (jntNo == 1) { diff --git a/src/d/d_event_manager.cpp b/src/d/d_event_manager.cpp index 2d3ed69ac..ca5f8d552 100644 --- a/src/d/d_event_manager.cpp +++ b/src/d/d_event_manager.cpp @@ -7,6 +7,12 @@ #include "d/d_com_inf_game.h" #include "d/d_procname.h" +enum { + ACT_WAIT, + ACT_TALK0, + ACT_TALK1, +}; + /* 800737DC-800737F4 .text init__18dEvent_exception_cFv */ void dEvent_exception_c::init() { mEventInfoIdx = -1; @@ -789,12 +795,12 @@ static int dEv_talkman_get_action(int param_0) { /* 80075450-8007548C .text ChkPresentEnd__16dEvent_manager_cFv */ BOOL dEvent_manager_c::ChkPresentEnd() { - return dEv_talkman_get_action(0) >= 1; + return dEv_talkman_get_action(ACT_WAIT) >= ACT_TALK0; } /* 8007548C-800754BC .text CancelPresent__16dEvent_manager_cFv */ BOOL dEvent_manager_c::CancelPresent() { - return dEv_talkman_get_action(1) == 1; + return dEv_talkman_get_action(ACT_TALK0) == ACT_TALK0; } /* 800754BC-800754EC .text checkStartDemo__16dEvent_manager_cFv */ diff --git a/src/d/d_npc_event_cut.inc b/src/d/d_npc_event_cut.inc index b7a977041..87a82ed04 100644 --- a/src/d/d_npc_event_cut.inc +++ b/src/d/d_npc_event_cut.inc @@ -75,7 +75,7 @@ bool dNpc_EventCut_c::cutProc() { } (this->*cut_tbl[mCurActIdx].proc)(); - return 1; + return true; } } }