// // Generated by dtk // Translation Unit: d_a_fgmahou.cpp // #include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/actor/d_a_fgmahou.h" #include "d/d_cc_d.h" #include "d/d_s_play.h" #include "d/d_particle_name.h" #include "d/actor/d_a_fganon.h" #include "res/Object/Fganon.h" /* 00000078-000000E4 .text daFgmahou_Draw__FP13fgmahou_class */ static BOOL daFgmahou_Draw(fgmahou_class* i_this) { J3DModel* pModel = i_this->mpMorf->getModel(); i_this->mpBrk->entry(pModel->getModelData()); i_this->mpBtk->entry(pModel->getModelData()); i_this->mpMorf->entryDL(); return TRUE; } /* 000000E4-00000130 .text boss_s_sub__FPvPv */ static void* boss_s_sub(void* param_1, void*) { if(fopAc_IsActor(param_1) && fopAcM_GetName(param_1) == fpcNm_FGANON_e) { return param_1; } return NULL; } /* 00000130-00000C14 .text move__FP13fgmahou_class */ static void move(fgmahou_class* i_this) { static f32 spdd[] = { 0.65f, 0.3f, 0.1f, 0.0f, 0.0f, 0.1f, 0.3f, 0.65f, }; static s16 angXd[] = { 0x0000, 0xF400, 0xE800, 0xE000, 0xE000, 0xE800, 0xF400, 0x0000 }; fopAc_ac_c* pPlayer = dComIfGp_getPlayer(0); cXyz diff2; cXyz diff3; int temp2 = 1; f32 temp3; fganon_class* fganon2; i_this->mStts.Move(); switch(i_this->mState) { case 0: i_this->mState = 1; i_this->field_0x2D4 = i_this->mOrbNumber * REG6_S(2) - REG6_S(3); i_this->field_0x2D6 = cM_rndF(0x10000); i_this->speedF = REG0_F(0xD) + 50.0f; i_this->speedF *= (0.2f + REG0_F(4)) * spdd[i_this->mOrbNumber] + 1.0f; i_this->mTargetPos = pPlayer->eyePos; diff2 = i_this->mTargetPos - i_this->current.pos; i_this->home.angle.y = i_this->mOrbNumber * (REG8_S(2) + 0x1400) - (REG8_S(3) + 0x4000) + cM_atan2s(diff2.x, diff2.z); i_this->home.angle.x = angXd[i_this->mOrbNumber]; i_this->shape_angle = i_this->home.angle; i_this->mTimers[0] = REG8_S(9) + 5; i_this->mTimers[1] = 0x14; i_this->mpEmitter = dComIfGp_particle_set(dPa_name::ID_AK_SN_BPGDARKSHOT00, &i_this->current.pos); i_this->mTgSph.SetR(REG6_F(5) + 110.0f); temp2 = REG0_S(2) + 2; case 1: case 2: diff3 = i_this->mTargetPos - i_this->current.pos; temp3 = diff3.abs(); if(i_this->mTimers[0] != 0) { break; } if(temp3 > REG0_F(0x11) + 500.0f && i_this->mState < 2) { diff2 = i_this->mTargetPos - i_this->current.pos; cLib_addCalcAngleS2(&i_this->home.angle.y, cM_atan2s(diff2.x, diff2.z), 2, REG8_S(4) + 0x500); cLib_addCalcAngleS2(&i_this->home.angle.x, -cM_atan2s(diff2.y, std::sqrtf(diff2.x * diff2.x + diff2.z * diff2.z)), 2, REG8_S(4) + 0x500); } else { i_this->mState = 2; } if(i_this->mAtSph.ChkAtHit()) { i_this->mAtSph.GetAtHitObj(); fganon_class* fganon = (fganon_class*)fpcM_Search(boss_s_sub, i_this); if(fganon != NULL) { fganon->m68B = 1; break; } } if(!i_this->mTgSph.ChkTgHit()) { break; } dComIfGp_particle_set(dPa_name::ID_AK_SN_BPGSMASHDARKSHOT00, &i_this->current.pos, &i_this->home.angle); #if VERSION == VERSION_USA fopAcM_seStartCurrent(i_this, JA_SE_LK_PG_BOMB_STRIKE, 0); #endif i_this->mState = 5; case 5: fganon2 = (fganon_class*)fpcM_Search(boss_s_sub, i_this); if(fganon2 == NULL) { i_this->field_0x780 = 0x32; break; } i_this->mTargetPos = fganon2->actor.eyePos; i_this->mTargetPos.y -= cM_rndFX(50.0f) + 50.0f; i_this->home.angle.y -= 0x8000; i_this->home.angle.x *= -1; i_this->mTimers[0] = REG8_S(9) + 5; i_this->field_0x2E0 = 1; i_this->field_0x2E2 = 0x8000; i_this->shape_angle = i_this->home.angle; i_this->mState = 6; i_this->mAtSph.SetR(60.0f); case 6: case 7: diff3 = i_this->mTargetPos - i_this->current.pos; temp3 = diff3.abs(); if(i_this->mTimers[0] != 0) { break; } if(temp3 > REG0_F(0x11) + 500.0f && i_this->mState < 7) { diff2 = i_this->mTargetPos - i_this->current.pos; cLib_addCalcAngleS2(&i_this->home.angle.y, cM_atan2s(diff2.x, diff2.z), 2, REG8_S(4) + 0x500); cLib_addCalcAngleS2(&i_this->home.angle.x, -cM_atan2s(diff2.y, std::sqrtf(diff2.x * diff2.x + diff2.z * diff2.z)), 2, REG8_S(4) + 0x500); } else { i_this->mState = 7; } break; case 10: if(i_this->mTimers[0] == 0) { fopAcM_delete(i_this); } return; case 3: case 4: case 8: case 9: break; } f32 temp4 = temp3 * (REG0_F(3) + 3.0f); if(temp4 > REG0_F(8) + 8000.0f) { temp4 = REG0_F(8) + 8000.0f; } i_this->field_0x2D4 += REG0_S(6) + 0xDAC; i_this->field_0x2D6 += REG0_S(7) + 0xCE4; s16 temp5 = (s16)(temp4 * cM_ssin(i_this->field_0x2D4)); s16 temp7 = (s16)(temp4 * cM_ssin(i_this->field_0x2D6) * 0.75f); i_this->shape_angle.y = i_this->home.angle.y + temp5; i_this->shape_angle.x = i_this->home.angle.x + temp7; diff2.x = 0.0f; diff2.y = 0.0f; diff2.z = i_this->speedF; cMtx_YrotS(*calc_mtx, i_this->shape_angle.y); cMtx_XrotM(*calc_mtx, i_this->shape_angle.x); MtxPosition(&diff2, &i_this->speed); if(temp2 <= 1) { i_this->current.pos += i_this->speed; } else { for(int i = 0; i < temp2; i++) { i_this->current.pos += i_this->speed; } } cXyz temp6 = i_this->current.pos; if(i_this->mTimers[1] == 0) { i_this->mTgSph.SetC(temp6); dComIfG_Ccsp()->Set(&i_this->mTgSph); i_this->mAtSph.SetC(temp6); dComIfG_Ccsp()->Set(&i_this->mAtSph); i_this->mAcch.CrrPos(*dComIfG_Bgsp()); if(fopAcM_searchPlayerDistance(i_this) > 5000.0f || i_this->mAtSph.ChkAtHit() || i_this->mAcch.ChkGroundHit() || i_this->mAcch.ChkWallHit() || i_this->mAcch.ChkRoofHit()) { i_this->field_0x780 = 0x32; i_this->health = 1; JPABaseEmitter* pEmtr = dComIfGp_particle_set(dPa_name::ID_AK_SN_BPGHITDARKSHOT00, &i_this->current.pos); pEmtr->setGlobalRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(YDKSP00_JNT_HEAD_e)); JPABaseEmitter* pEmtr2 = dComIfGp_particle_set(dPa_name::ID_AK_SN_BPGHITDARKSHOT01, &i_this->current.pos); pEmtr2->setGlobalRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(YDKSP00_JNT_HEAD_e)); fopAcM_seStartCurrent(i_this, JA_SE_OBJ_PG_EBALL_EXP_L, 0); } } if(i_this->field_0x2E0 != 0) { i_this->field_0x2E0++; if(i_this->field_0x2E0 > 8) { i_this->field_0x2E0 = 0; } } } /* 00000C14-00000DD8 .text daFgmahou_Execute__FP13fgmahou_class */ static BOOL daFgmahou_Execute(fgmahou_class* i_this) { cXyz temp(0.0f, 0.0f, 0.0f); i_this->mAge++; for(int i = 0; i < 2; i++) { if(i_this->mTimers[i]) { i_this->mTimers[i]--; } } if(i_this->field_0x2DE) { i_this->field_0x2DE--; } if(i_this->field_0x780 == 0) { move(i_this); } else { i_this->field_0x780--; if(i_this->field_0x780 == 0) { fopAcM_delete(i_this); return TRUE; } } i_this->mpBrk->play(); i_this->mpBtk->play(); J3DModel* pModel = i_this->mpMorf->getModel(); mDoMtx_stack_c::transS(i_this->current.pos.x, i_this->current.pos.y, i_this->current.pos.z); mDoMtx_stack_c::YrotM(i_this->shape_angle.y); mDoMtx_stack_c::XrotM(i_this->shape_angle.x); pModel->setBaseTRMtx(mDoMtx_stack_c::get()); i_this->mpMorf->calc(); if(i_this->mpEmitter) { i_this->mpEmitter->setGlobalRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(YDKSP00_JNT_HEAD_e)); if(i_this->field_0x780 != 0 && i_this->field_0x780 == 0x32) { i_this->mpEmitter->becomeInvalidEmitter(); i_this->mpEmitter = NULL; i_this->mpBrk->setPlaySpeed(-1.0f); } } i_this->eyePos = i_this->current.pos; return TRUE; } /* 00000DD8-00000DE0 .text daFgmahou_IsDelete__FP13fgmahou_class */ static BOOL daFgmahou_IsDelete(fgmahou_class* i_this) { return TRUE; } /* 00000DE0-00000E3C .text daFgmahou_Delete__FP13fgmahou_class */ static BOOL daFgmahou_Delete(fgmahou_class* i_this) { dComIfG_resDeleteDemo(&i_this->mPhs, "Fganon"); if(i_this->mpEmitter) { i_this->mpEmitter->becomeInvalidEmitter(); } return TRUE; } /* 00000E3C-0000109C .text useHeapInit__FP10fopAc_ac_c */ static BOOL useHeapInit(fopAc_ac_c* a_this) { fgmahou_class* i_this = static_cast(a_this); i_this->mpMorf = new mDoExt_McaMorf( (J3DModelData*)dComIfG_getObjectRes("Fganon", dRes_INDEX_FGANON_BDL_YDKSP00_e), NULL, NULL, NULL, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, 1, NULL, 0, 0x11020203 ); if(i_this->mpMorf == NULL || i_this->mpMorf->getModel() == NULL) { return FALSE; } J3DModelData* pModelData = i_this->mpMorf->getModel()->getModelData(); i_this->mpBtk = new mDoExt_btkAnm(); if(i_this->mpBtk == NULL) { return FALSE; } if(!i_this->mpBtk->init(pModelData, (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Fganon", dRes_INDEX_FGANON_BTK_YDKSP00_e), true, J3DFrameCtrl::EMode_LOOP)) { return FALSE; } i_this->mpBrk = new mDoExt_brkAnm(); if(i_this->mpBrk == NULL) { return FALSE; } if(!i_this->mpBrk->init(pModelData, (J3DAnmTevRegKey*)dComIfG_getObjectRes("Fganon", dRes_INDEX_FGANON_BRK_YDKSP00_e), true, J3DFrameCtrl::EMode_NONE)) { return FALSE; } i_this->mpBrk->setFrame(6.999f); return TRUE; } /* 000010E4-0000135C .text daFgmahou_Create__FP10fopAc_ac_c */ static cPhs_State daFgmahou_Create(fopAc_ac_c* a_this) { static dCcD_SrcSph tg_sph_src = { // dCcD_SrcGObjInf { /* Flags */ 0, /* SrcObjAt Type */ 0, /* SrcObjAt Atp */ 0, /* SrcObjAt SPrm */ 0, /* SrcObjTg Type */ AT_TYPE_SWORD, /* SrcObjTg SPrm */ cCcD_TgSPrm_Set_e | cCcD_TgSPrm_IsEnemy_e, /* SrcObjCo SPrm */ 0, /* SrcGObjAt Se */ 0, /* SrcGObjAt HitMark */ dCcG_AtHitMark_None_e, /* SrcGObjAt Spl */ dCcG_At_Spl_UNK0, /* SrcGObjAt Mtrl */ 0, /* SrcGObjAt SPrm */ 0, /* SrcGObjTg Se */ 0, /* SrcGObjTg HitMark */ 0, /* SrcGObjTg Spl */ dCcG_Tg_Spl_UNK0, /* SrcGObjTg Mtrl */ 0, /* SrcGObjTg SPrm */ dCcG_TgSPrm_NoConHit_e, /* SrcGObjCo SPrm */ 0, }, // cM3dGSphS {{ /* Center */ {0.0f, 0.0f, 0.0f}, /* Radius */ 60.0f, }}, }; static dCcD_SrcSph at_sph_src = { // dCcD_SrcGObjInf { /* Flags */ 0, /* SrcObjAt Type */ AT_TYPE_UNK800, /* SrcObjAt Atp */ 8, /* SrcObjAt SPrm */ cCcD_AtSPrm_Set_e | cCcD_AtSPrm_GrpAll_e, /* SrcObjTg Type */ 0, /* SrcObjTg SPrm */ 0, /* SrcObjCo SPrm */ 0, /* SrcGObjAt Se */ 0, /* SrcGObjAt HitMark */ dCcG_AtHitMark_None_e, /* SrcGObjAt Spl */ dCcG_At_Spl_UNKA, /* SrcGObjAt Mtrl */ 0, /* SrcGObjAt SPrm */ dCcG_AtSPrm_NoConHit_e, /* SrcGObjTg Se */ 0, /* SrcGObjTg HitMark */ 0, /* SrcGObjTg Spl */ dCcG_Tg_Spl_UNK0, /* SrcGObjTg Mtrl */ 0, /* SrcGObjTg SPrm */ 0, /* SrcGObjCo SPrm */ 0, }, // cM3dGSphS {{ /* Center */ {0.0f, 0.0f, 0.0f}, /* Radius */ 30.0f, }}, }; fgmahou_class* i_this = static_cast(a_this); fopAcM_ct_Retail(i_this, fgmahou_class); cPhs_State phase_state = dComIfG_resLoad(&i_this->mPhs, "Fganon"); if(phase_state == cPhs_COMPLEATE_e) { fopAcM_ct_Demo(i_this, fgmahou_class); i_this->mOrbNumber = fopAcM_GetParam(i_this) & 0xF; if(!fopAcM_entrySolidHeap(i_this, useHeapInit, 0x19000)) { return cPhs_ERROR_e; } i_this->mAcch.Set(fopAcM_GetPosition_p(i_this), fopAcM_GetOldPosition_p(i_this), i_this, 1, &i_this->mCir, fopAcM_GetSpeed_p(i_this)); i_this->mCir.SetWall(50.0f, 50.0f); i_this->mAcch.ClrRoofNone(); i_this->mAcch.SetRoofCrrHeight(REG0_F(7) + 70.0f); i_this->mStts.Init(0xFA, 0xFF, i_this); i_this->mTgSph.Set(tg_sph_src); i_this->mTgSph.SetStts(&i_this->mStts); i_this->mTgSph.OnTgNoHitMark(); i_this->mAtSph.Set(at_sph_src); i_this->mAtSph.SetStts(&i_this->mStts); } return phase_state; } static actor_method_class l_daFgmahou_Method = { (process_method_func)daFgmahou_Create, (process_method_func)daFgmahou_Delete, (process_method_func)daFgmahou_Execute, (process_method_func)daFgmahou_IsDelete, (process_method_func)daFgmahou_Draw, }; actor_process_profile_definition g_profile_FGMAHOU = { /* Layer ID */ fpcLy_CURRENT_e, /* List ID */ 0x0007, /* List Prio */ fpcPi_CURRENT_e, /* Proc Name */ fpcNm_FGMAHOU_e, /* Proc SubMtd */ &g_fpcLf_Method.base, /* Size */ sizeof(fgmahou_class), /* Size Other */ 0, /* Parameters */ 0, /* Leaf SubMtd */ &g_fopAc_Method.base, /* Draw Prio */ fpcDwPi_FGMAHOU_e, /* Actor SubMtd */ &l_daFgmahou_Method, /* Status */ fopAcStts_UNK40000_e, /* Group */ fopAc_ENEMY_e, /* Cull Type */ fopAc_CULLBOX_0_e, };