diff options
| author | TakaRikka <38417346+TakaRikka@users.noreply.github.com> | 2025-11-09 01:20:51 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-09 11:20:51 +0200 |
| commit | 4b5277295ed47d4c83105d06af6df49cfcfafd56 (patch) | |
| tree | 14c243e4df362ddf63f86a62bf9dc18ce1ade4bb /src/d/actor/d_a_npc_inko.cpp | |
| parent | e49519229cd6b3974739f6e789f3bccb7ef302a3 (diff) | |
npcinko / myna2 done (#2780)
* npcinko done
* myna2 done
* Use sound enum
* Use FALSE instead of false when returning BOOL
* Use look mode enum
* TRUE instead of true when returning bool
---------
Co-authored-by: hatal175 <hatal175@users.noreply.github.com>
Diffstat (limited to 'src/d/actor/d_a_npc_inko.cpp')
| -rw-r--r-- | src/d/actor/d_a_npc_inko.cpp | 866 |
1 files changed, 445 insertions, 421 deletions
diff --git a/src/d/actor/d_a_npc_inko.cpp b/src/d/actor/d_a_npc_inko.cpp index b9079b61df..73e098e4bf 100644 --- a/src/d/actor/d_a_npc_inko.cpp +++ b/src/d/actor/d_a_npc_inko.cpp @@ -6,455 +6,481 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/actor/d_a_npc_inko.h" -#include "dol2asm.h" - - -// -// Forward References: -// - -extern "C" static void nodeCallBack__FP8J3DJointi(); -extern "C" static void daNpc_Inko_Draw__FP14npc_inko_class(); -extern "C" static void anm_init__FP14npc_inko_classifUcf(); -extern "C" static void daNpc_Inko_Execute__FP14npc_inko_class(); -extern "C" static bool daNpc_Inko_IsDelete__FP14npc_inko_class(); -extern "C" static void daNpc_Inko_Delete__FP14npc_inko_class(); -extern "C" static void useHeapInit__FP10fopAc_ac_c(); -extern "C" static void daNpc_Inko_Create__FP10fopAc_ac_c(); -extern "C" extern char const* const d_a_npc_inko__stringBase0; - -// -// External References: -// - -extern "C" void mDoMtx_XrotM__FPA4_fs(); -extern "C" void mDoMtx_YrotM__FPA4_fs(); -extern "C" void mDoMtx_ZrotM__FPA4_fs(); -extern "C" void transM__14mDoMtx_stack_cFfff(); -extern "C" void -__ct__14mDoExt_McaMorfFP12J3DModelDataP25mDoExt_McaMorfCallBack1_cP25mDoExt_McaMorfCallBack2_cP15J3DAnmTransformifiiiPvUlUl(); -extern "C" void setAnm__14mDoExt_McaMorfFP15J3DAnmTransformiffffPv(); -extern "C" void play__14mDoExt_McaMorfFP3VecUlSc(); -extern "C" void entryDL__14mDoExt_McaMorfFv(); -extern "C" void modelCalc__14mDoExt_McaMorfFv(); -extern "C" void __ct__10fopAc_ac_cFv(); -extern "C" void fopAcIt_Judge__FPFPvPv_PvPv(); -extern "C" void fopAcM_entrySolidHeap__FP10fopAc_ac_cPFP10fopAc_ac_c_iUl(); -extern "C" void fopAcM_SetMin__FP10fopAc_ac_cfff(); -extern "C" void fopAcM_SetMax__FP10fopAc_ac_cfff(); -extern "C" void fopAcM_searchActorAngleY__FPC10fopAc_ac_cPC10fopAc_ac_c(); -extern "C" void fopAcM_searchActorDistanceXZ__FPC10fopAc_ac_cPC10fopAc_ac_c(); -extern "C" void fpcSch_JudgeForPName__FPvPv(); -extern "C" void fpcSch_JudgeByID__FPvPv(); -extern "C" void dComIfG_resLoad__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfG_resDelete__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfGp_getReverb__Fi(); -extern "C" void getRes__14dRes_control_cFPCclP11dRes_info_ci(); -extern "C" void reset__14dEvt_control_cFv(); -extern "C" void setLookPos__9daPy_py_cFP4cXyz(); -extern "C" void settingTevStruct__18dScnKy_env_light_cFiP4cXyzP12dKy_tevstr_c(); -extern "C" void setLightTevColorType_MAJI__18dScnKy_env_light_cFP12J3DModelDataP12dKy_tevstr_c(); -extern "C" void __ct__10dMsgFlow_cFv(); -extern "C" void init__10dMsgFlow_cFP10fopAc_ac_ciiPP10fopAc_ac_c(); -extern "C" void doFlow__10dMsgFlow_cFP10fopAc_ac_cPP10fopAc_ac_ci(); -extern "C" void __mi__4cXyzCFRC3Vec(); -extern "C" void cM_rndF__Ff(); -extern "C" void cM_rndFX__Ff(); -extern "C" void cLib_addCalc2__FPffff(); -extern "C" void cLib_addCalcAngleS2__FPssss(); -extern "C" void deleteObject__14Z2SoundObjBaseFv(); -extern "C" void __ct__16Z2SoundObjSimpleFv(); -extern "C" void* __nw__FUl(); -extern "C" void _savegpr_24(); -extern "C" void _savegpr_28(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_24(); -extern "C" void _restgpr_28(); -extern "C" void _restgpr_29(); -extern "C" u8 m_cpadInfo__8mDoCPd_c[256]; -extern "C" u8 now__14mDoMtx_stack_c[48]; -extern "C" u8 mCurrentMtx__6J3DSys[48]; -extern "C" u8 sincosTable___5JMath[65536]; -extern "C" extern u8 cDmr_SkipInfo[4]; - -// -// Declarations: -// +#include "d/actor/d_a_obj_kage.h" +#include "d/actor/d_a_npc_henna.h" +#include "d/actor/d_a_player.h" +#include "d/d_s_play.h" +#include "c/c_damagereaction.h" /* 80A0C998-80A0CBB0 000078 0218+00 1/1 0/0 0/0 .text nodeCallBack__FP8J3DJointi */ -static void nodeCallBack(J3DJoint* param_0, int param_1) { - // NONMATCHING +static int nodeCallBack(J3DJoint* i_joint, int param_1) { + if (param_1 == 0) { + int jnt_no = i_joint->getJntNo(); + J3DModel* model = j3dSys.getModel(); + npc_inko_class* i_this = (npc_inko_class*)model->getUserArea(); + + if (i_this != NULL) { + MTXCopy(model->getAnmMtx(jnt_no), *calc_mtx); + if (jnt_no == 1) { + cMtx_YrotM(*calc_mtx, i_this->field_0x5c8.y); + cMtx_XrotM(*calc_mtx, i_this->field_0x5c8.x); + cMtx_ZrotM(*calc_mtx, i_this->field_0x5c8.z); + } else if (jnt_no == 2) { + cMtx_ZrotM(*calc_mtx, i_this->field_0x5e6); + } else if (jnt_no == 3) { + cMtx_ZrotM(*calc_mtx, i_this->field_0x5e0); + } else if (jnt_no == 4) { + cMtx_ZrotM(*calc_mtx, -i_this->field_0x5e0); + } else if (jnt_no == 5 || jnt_no == 6) { + cMtx_XrotM(*calc_mtx, i_this->field_0x5d4[jnt_no - 5]); + } + + model->setAnmMtx(jnt_no, *calc_mtx); + MTXCopy(*calc_mtx, J3DSys::mCurrentMtx); + + if (jnt_no == TREG_S(0)) { + MTXCopy(model->getAnmMtx(jnt_no), *calc_mtx); + cMtx_YrotM(*calc_mtx, TREG_S(1)); + cMtx_XrotM(*calc_mtx, TREG_S(2)); + cMtx_ZrotM(*calc_mtx, TREG_S(3)); + model->setAnmMtx(jnt_no, *calc_mtx); + MTXCopy(*calc_mtx, J3DSys::mCurrentMtx); + } + } + } + + return 1; } /* 80A0CBB0-80A0CC18 000290 0068+00 1/0 0/0 0/0 .text daNpc_Inko_Draw__FP14npc_inko_class */ -static void daNpc_Inko_Draw(npc_inko_class* param_0) { - // NONMATCHING +static int daNpc_Inko_Draw(npc_inko_class* i_this) { + fopAc_ac_c* actor = &i_this->actor; + g_env_light.settingTevStruct(0, &actor->current.pos, &actor->tevStr); + g_env_light.setLightTevColorType_MAJI(i_this->anm_p->getModel(), &actor->tevStr); + i_this->anm_p->entryDL(); + return 1; } -/* ############################################################################################## */ -/* 80A0E014-80A0E018 000000 0004+00 3/3 0/0 0/0 .rodata @3849 */ -SECTION_RODATA static u8 const lit_3849[4] = { - 0x00, - 0x00, - 0x00, - 0x00, -}; -COMPILER_STRIP_GATE(0x80A0E014, &lit_3849); - -/* 80A0E018-80A0E01C 000004 0004+00 1/2 0/0 0/0 .rodata @3850 */ -SECTION_RODATA static f32 const lit_3850 = -1.0f; -COMPILER_STRIP_GATE(0x80A0E018, &lit_3850); - -/* 80A0E0CC-80A0E0CC 0000B8 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80A0E0CC = "Npc_inko"; -#pragma pop - /* 80A0CC18-80A0CCC8 0002F8 00B0+00 1/1 0/0 0/0 .text anm_init__FP14npc_inko_classifUcf */ -static void anm_init(npc_inko_class* param_0, int param_1, f32 param_2, u8 param_3, - f32 param_4) { - // NONMATCHING +static void anm_init(npc_inko_class* i_this, int i_anmId, f32 i_morf, u8 i_mode, f32 i_speed) { + i_this->anm_p->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Npc_inko", i_anmId), i_mode, i_morf, i_speed, 0.0f, -1.0f, NULL); + i_this->anmId = i_anmId; } -/* ############################################################################################## */ -/* 80A0E01C-80A0E020 000008 0004+00 0/1 0/0 0/0 .rodata @4329 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4329 = -78.0f; -COMPILER_STRIP_GATE(0x80A0E01C, &lit_4329); -#pragma pop - -/* 80A0E020-80A0E024 00000C 0004+00 0/1 0/0 0/0 .rodata @4330 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4330 = -5.0f; -COMPILER_STRIP_GATE(0x80A0E020, &lit_4330); -#pragma pop - -/* 80A0E024-80A0E028 000010 0004+00 0/1 0/0 0/0 .rodata @4331 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4331 = 40.0f; -COMPILER_STRIP_GATE(0x80A0E024, &lit_4331); -#pragma pop - -/* 80A0E028-80A0E02C 000014 0004+00 0/1 0/0 0/0 .rodata @4332 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4332 = 30.0f; -COMPILER_STRIP_GATE(0x80A0E028, &lit_4332); -#pragma pop - -/* 80A0E02C-80A0E030 000018 0004+00 0/1 0/0 0/0 .rodata @4333 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4333 = 70.0f; -COMPILER_STRIP_GATE(0x80A0E02C, &lit_4333); -#pragma pop - -/* 80A0E030-80A0E034 00001C 0004+00 0/1 0/0 0/0 .rodata @4334 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4334 = 10.0f; -COMPILER_STRIP_GATE(0x80A0E030, &lit_4334); -#pragma pop - -/* 80A0E034-80A0E038 000020 0004+00 1/2 0/0 0/0 .rodata @4335 */ -SECTION_RODATA static f32 const lit_4335 = 1.0f; -COMPILER_STRIP_GATE(0x80A0E034, &lit_4335); - -/* 80A0E038-80A0E03C 000024 0004+00 0/1 0/0 0/0 .rodata @4336 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4336 = 1.5f; -COMPILER_STRIP_GATE(0x80A0E038, &lit_4336); -#pragma pop - -/* 80A0E03C-80A0E040 000028 0004+00 0/1 0/0 0/0 .rodata @4337 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4337 = 2.0f; -COMPILER_STRIP_GATE(0x80A0E03C, &lit_4337); -#pragma pop - -/* 80A0E040-80A0E044 00002C 0004+00 0/1 0/0 0/0 .rodata @4338 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4338 = 1300.0f; -COMPILER_STRIP_GATE(0x80A0E040, &lit_4338); -#pragma pop - -/* 80A0E044-80A0E048 000030 0004+00 0/1 0/0 0/0 .rodata @4339 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4339 = 1000.0f; -COMPILER_STRIP_GATE(0x80A0E044, &lit_4339); -#pragma pop - -/* 80A0E048-80A0E04C 000034 0004+00 0/1 0/0 0/0 .rodata @4340 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4340 = 3.0f / 10.0f; -COMPILER_STRIP_GATE(0x80A0E048, &lit_4340); -#pragma pop - -/* 80A0E04C-80A0E050 000038 0004+00 0/1 0/0 0/0 .rodata @4341 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4341 = 6.0f / 5.0f; -COMPILER_STRIP_GATE(0x80A0E04C, &lit_4341); -#pragma pop - -/* 80A0E050-80A0E054 00003C 0004+00 0/1 0/0 0/0 .rodata @4342 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4342 = 3.0f; -COMPILER_STRIP_GATE(0x80A0E050, &lit_4342); -#pragma pop - -/* 80A0E054-80A0E058 000040 0004+00 0/1 0/0 0/0 .rodata @4343 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4343 = 100.0f; -COMPILER_STRIP_GATE(0x80A0E054, &lit_4343); -#pragma pop - -/* 80A0E058-80A0E05C 000044 0004+00 0/1 0/0 0/0 .rodata @4344 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4344 = 7000.0f; -COMPILER_STRIP_GATE(0x80A0E058, &lit_4344); -#pragma pop - -/* 80A0E05C-80A0E060 000048 0004+00 0/1 0/0 0/0 .rodata @4345 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4345 = 0.5f; -COMPILER_STRIP_GATE(0x80A0E05C, &lit_4345); -#pragma pop - -/* 80A0E060-80A0E064 00004C 0004+00 0/1 0/0 0/0 .rodata @4346 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4346 = 8.0f; -COMPILER_STRIP_GATE(0x80A0E060, &lit_4346); -#pragma pop - -/* 80A0E064-80A0E068 000050 0004+00 0/1 0/0 0/0 .rodata @4347 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4347 = 41.0f; -COMPILER_STRIP_GATE(0x80A0E064, &lit_4347); -#pragma pop - -/* 80A0E068-80A0E06C 000054 0004+00 0/1 0/0 0/0 .rodata @4348 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4348 = 14.0f; -COMPILER_STRIP_GATE(0x80A0E068, &lit_4348); -#pragma pop - -/* 80A0E06C-80A0E070 000058 0004+00 0/1 0/0 0/0 .rodata @4349 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4349 = 1.0f / 100.0f; -COMPILER_STRIP_GATE(0x80A0E06C, &lit_4349); -#pragma pop - -/* 80A0E070-80A0E074 00005C 0004+00 0/1 0/0 0/0 .rodata @4350 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4350 = 20.0f; -COMPILER_STRIP_GATE(0x80A0E070, &lit_4350); -#pragma pop - -/* 80A0E074-80A0E078 000060 0004+00 0/2 0/0 0/0 .rodata @4351 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4351 = 200.0f; -COMPILER_STRIP_GATE(0x80A0E074, &lit_4351); -#pragma pop - -/* 80A0E078-80A0E07C 000064 0004+00 0/1 0/0 0/0 .rodata @4352 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4352 = 32768.0f; -COMPILER_STRIP_GATE(0x80A0E078, &lit_4352); -#pragma pop - -/* 80A0E07C-80A0E080 000068 0004+00 0/1 0/0 0/0 .rodata @4353 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4353 = 4.0f / 5.0f; -COMPILER_STRIP_GATE(0x80A0E07C, &lit_4353); -#pragma pop - -/* 80A0E080-80A0E084 00006C 0004+00 0/1 0/0 0/0 .rodata @4354 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4354 = 5.0f; -COMPILER_STRIP_GATE(0x80A0E080, &lit_4354); -#pragma pop - -/* 80A0E084-80A0E08C 000070 0008+00 0/1 0/0 0/0 .rodata @4355 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_4355[8] = { - 0x3F, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x80A0E084, &lit_4355); -#pragma pop - -/* 80A0E08C-80A0E094 000078 0008+00 0/1 0/0 0/0 .rodata @4356 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_4356[8] = { - 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x80A0E08C, &lit_4356); -#pragma pop - -/* 80A0E094-80A0E09C 000080 0008+00 0/1 0/0 0/0 .rodata @4357 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_4357[8] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x80A0E094, &lit_4357); -#pragma pop - -/* 80A0E09C-80A0E0A0 000088 0004+00 0/1 0/0 0/0 .rodata @4358 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4358 = 1.0f / 10.0f; -COMPILER_STRIP_GATE(0x80A0E09C, &lit_4358); -#pragma pop - -/* 80A0E0A0-80A0E0A4 00008C 0004+00 0/1 0/0 0/0 .rodata @4359 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4359 = 300.0f; -COMPILER_STRIP_GATE(0x80A0E0A0, &lit_4359); -#pragma pop - -/* 80A0E0A4-80A0E0A8 000090 0004+00 0/1 0/0 0/0 .rodata @4360 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4360 = 9.0f / 10.0f; -COMPILER_STRIP_GATE(0x80A0E0A4, &lit_4360); -#pragma pop - -/* 80A0E0A8-80A0E0AC 000094 0004+00 0/1 0/0 0/0 .rodata @4361 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4361 = 2.5f; -COMPILER_STRIP_GATE(0x80A0E0A8, &lit_4361); -#pragma pop - -/* 80A0E0AC-80A0E0B0 000098 0004+00 0/1 0/0 0/0 .rodata @4362 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4362 = 3000.0f; -COMPILER_STRIP_GATE(0x80A0E0AC, &lit_4362); -#pragma pop - -/* 80A0E0B0-80A0E0B4 00009C 0004+00 0/1 0/0 0/0 .rodata @4363 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4363 = 90.0f; -COMPILER_STRIP_GATE(0x80A0E0B0, &lit_4363); -#pragma pop - -/* 80A0E0B4-80A0E0B8 0000A0 0004+00 0/1 0/0 0/0 .rodata @4364 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4364 = 500.0f; -COMPILER_STRIP_GATE(0x80A0E0B4, &lit_4364); -#pragma pop - -/* 80A0E0B8-80A0E0BC 0000A4 0004+00 0/1 0/0 0/0 .rodata @4365 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4365 = -2.0f; -COMPILER_STRIP_GATE(0x80A0E0B8, &lit_4365); -#pragma pop - -/* 80A0E0BC-80A0E0C0 0000A8 0004+00 0/1 0/0 0/0 .rodata @4366 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4366 = 23000.0f; -COMPILER_STRIP_GATE(0x80A0E0BC, &lit_4366); -#pragma pop - -/* 80A0E0C0-80A0E0C4 0000AC 0004+00 0/1 0/0 0/0 .rodata @4367 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4367 = 150.0f; -COMPILER_STRIP_GATE(0x80A0E0C0, &lit_4367); -#pragma pop - -/* 80A0E0D8-80A0E0E8 000000 0010+00 1/1 0/0 0/0 .data mes_0$3966 */ -SECTION_DATA static u8 mes_0[16] = { - 0x00, 0x00, 0x03, 0x57, 0x00, 0x00, 0x03, 0x58, 0x00, 0x00, 0x03, 0x59, 0x00, 0x00, 0x03, 0x5A, -}; - -/* 80A0E0E8-80A0E0F8 000010 0010+00 1/1 0/0 0/0 .data mes_1$3967 */ -SECTION_DATA static u8 mes_1[16] = { - 0x00, 0x00, 0x03, 0x5B, 0x00, 0x00, 0x03, 0x5C, 0x00, 0x00, 0x03, 0x5D, 0x00, 0x00, 0x03, 0x5E, -}; - /* 80A0CCC8-80A0DD70 0003A8 10A8+00 2/1 0/0 0/0 .text daNpc_Inko_Execute__FP14npc_inko_class */ -static void daNpc_Inko_Execute(npc_inko_class* param_0) { - // NONMATCHING +static int daNpc_Inko_Execute(npc_inko_class* i_this) { + fopAc_ac_c* actor = (fopAc_ac_c*)i_this; + cXyz sp78; + cXyz sp6C; + + i_this->field_0x596++; + + for (int i = 0; i < 4; i++) { + if (i_this->field_0x59c[i] != 0) { + i_this->field_0x59c[i]--; + } + } + + obj_kage_class* kage = (obj_kage_class*)fopAcM_SearchByID(actor->parentActorID); + if (kage == NULL) { + return 1; + } + + s16 sp1A = 0; + s16 sp18 = 0; + MTXCopy(kage->model->getBaseTRMtx(), mDoMtx_stack_c::get()); + i_this->field_0x5c0 = kage->actor.shape_angle; + + if (i_this->field_0x598 <= 2) { + mDoMtx_stack_c::transM(i_this->field_0x5a8, -78.0f + TREG_F(1), -5.0f + TREG_F(2)); + mDoMtx_stack_c::multVecZero(&i_this->field_0x5b4); + cLib_addCalcAngleS2(&actor->shape_angle.y, i_this->field_0x59a, 1, 0xC00); + cLib_addCalcAngleS2(&actor->shape_angle.x, 0, 1, 0xA00); + } else { + mDoMtx_stack_c::YrotM(i_this->field_0x59a); + mDoMtx_stack_c::transM(0.0f, i_this->field_0x5e8, 40.0f + JREG_F(2)); + mDoMtx_stack_c::multVecZero(&i_this->field_0x5b4); + cLib_addCalcAngleS2(&actor->shape_angle.y, (i_this->field_0x5c0.y + i_this->field_0x59a), 1, 0xA00); + cLib_addCalcAngleS2(&actor->shape_angle.x, i_this->field_0x5ec, 1, 0xA00); + } + + f32 var_f31; + if (i_this->field_0x598 == 0) { + if (i_this->field_0x59c[1] == 0) { + i_this->field_0x59c[1] = 30.0f + cM_rndF(70.0f); + i_this->field_0x5ac = cM_rndFX(30.0f); + + for (int i = 0; i < 10; i++) { + i_this->field_0x5ac = cM_rndFX(30.0f); + if (fabsf(i_this->field_0x5a8 - i_this->field_0x5ac) >= 10.0f) { + break; + } + } + } + + cLib_addCalc2(&i_this->field_0x5a8, i_this->field_0x5ac, 1.0f, 1.5f + TREG_F(3)); + i_this->field_0x5e0 = 0; + + if (fabsf(i_this->field_0x5a8 - i_this->field_0x5ac) > 1.0f) { + s16 sp16 = i_this->field_0x596 * (TREG_S(1) + 8000); + var_f31 = (2.0f + TREG_F(4)) * cM_ssin(sp16); + if (var_f31 < 0.0f) { + var_f31 *= -1.0f; + } + + if ((u16)sp16 < 0x4000) { + i_this->field_0x5e0 = 10000; + } else if ((u16)sp16 > 0x8000 && (u16)sp16 < 0xC000) { + i_this->field_0x5e0 = 10000; + } + + sp1A = (1300.0f + TREG_F(8)) * cM_ssin(sp16); + if (sp1A < 0) { + sp1A *= -1; + } + + sp18 = (1000.0f + TREG_F(9)) * cM_ssin(sp16); + } else { + var_f31 = 0.0f; + } + + actor->current.pos = i_this->field_0x5b4; + + u8 spA = 0; + s16 sp14 = fopAcM_searchPlayerAngleY(actor); + s16 sp12 = sp14 - actor->shape_angle.y; + + if (i_this->field_0x59c[2] == 0) { + if (cM_rndF(1.0f) < 0.3f && sp12 < 0x3000 && sp12 > -0x3000) { + i_this->field_0x598 = 3; + anm_init(i_this, 4, 1.0f, 2, 1.2f + cM_rndF(3.0f)); + i_this->sound.startSound(Z2SE_LINKBIRD_WING, 0, -1); + + i_this->field_0x59c[0] = 40.0f + cM_rndF(100.0f); + i_this->field_0x59a = (sp14 - i_this->field_0x5c0.y) + (s16)cM_rndFX(7000.0f); + + u16 sp10 = i_this->field_0x59a; + if (cM_rndF(1.0f) < 0.5f && ((sp10 < 0x5000 && sp10 > 0xA000) || sp10 < 0x3000 || sp10 > 0xD000)) { + i_this->field_0x5e8 = -(70.0f + cM_rndF(8.0f)); + i_this->field_0x5ec = -8000; + } else { + i_this->field_0x5e8 = -(41.0f + cM_rndF(14.0f)); + i_this->field_0x5ec = -10000; + } + } else { + i_this->field_0x598 = 2; + anm_init(i_this, 4, 1.0f, 2, 1.2f + cM_rndF(3.0f)); + i_this->sound.startSound(Z2SE_LINKBIRD_WING, 0, -1); + i_this->field_0x5b0 = i_this->field_0x5a8; + + for (int i = 0; i < 10; i++) { + i_this->field_0x5ac = cM_rndFX(30.0f); + if (fabsf(i_this->field_0x5a8 - i_this->field_0x5ac) >= 10.0f) { + break; + } + } + + if (cM_rndF(1.0f) < 0.5f) { + i_this->field_0x59a = i_this->field_0x5c0.y + 0x8000; + } else { + i_this->field_0x59a = (s16)i_this->field_0x5c0.y; + } + } + } + } else if (i_this->field_0x598 == 2) { + i_this->field_0x5e0 = 0; + cLib_addCalc2(&i_this->field_0x5a8, i_this->field_0x5ac, 1.0f, 2.0f + TREG_F(7)); + + if (fabsf(i_this->field_0x5a8 - i_this->field_0x5ac) <= 0.01f) { + i_this->field_0x598 = 0; + i_this->field_0x59c[2] = 30.0f + cM_rndF(100.0f); + i_this->field_0x59c[1] = 20.0f + cM_rndF(20.0f); + anm_init(i_this, 5, 3.0f, 2, 1.0f); + kage->field_0x5a8 = 200.0f + KREG_F(11); + } + + f32 temp_f30 = fabsf(i_this->field_0x5ac - i_this->field_0x5b0); + f32 temp_f26 = fabsf(i_this->field_0x5ac - i_this->field_0x5a8); + f32 temp_f25 = temp_f30 * (1.5f + BREG_F(19)); + var_f31 = temp_f25 * cM_ssin(32768.0f * (temp_f26 / temp_f30)); + if (var_f31 > 30.0f + BREG_F(18)) { + var_f31 = 30.0f + BREG_F(18); + } + + actor->current.pos = i_this->field_0x5b4; + } else if (i_this->field_0x598 == 3) { + i_this->field_0x5e0 = 0; + cLib_addCalc2(&actor->current.pos.x, i_this->field_0x5b4.x, 0.8f, 5.0f); + cLib_addCalc2(&actor->current.pos.y, i_this->field_0x5b4.y, 0.8f, 5.0f); + cLib_addCalc2(&actor->current.pos.z, i_this->field_0x5b4.z, 0.8f, 5.0f); + + bool sp9 = (actor->current.pos - i_this->field_0x5b4).abs() < 0.1f; + if (sp9 && i_this->anmId == 4) { + anm_init(i_this, 5, 3.0f, 2, 1.0f); + kage->field_0x5a8 = 300.0f + KREG_F(12); + } + + i_this->field_0x5ce.z = 13000; + + if (i_this->field_0x59c[0] == 0) { + anm_init(i_this, 4, 1.0f, 2, 1.2f + cM_rndF(3.0f)); + i_this->sound.startSound(Z2SE_LINKBIRD_WING, 0, -1); + i_this->field_0x598 = 1; + + if (cM_rndF(1.0f) < 0.5f) { + i_this->field_0x59a = i_this->field_0x5c0.y + 0x8000; + } else { + i_this->field_0x59a = (s16)i_this->field_0x5c0.y; + } + } + } else if (i_this->field_0x598 == 1) { + cLib_addCalc2(&actor->current.pos.x, i_this->field_0x5b4.x, 0.9f, 5.0f); + cLib_addCalc2(&actor->current.pos.y, i_this->field_0x5b4.y, 0.9f, 2.5f); + cLib_addCalc2(&actor->current.pos.z, i_this->field_0x5b4.z, 0.9f, 5.0f); + + bool sp8 = (actor->current.pos - i_this->field_0x5b4).abs() < 0.1f; + if (sp8) { + i_this->field_0x598 = 0; + i_this->field_0x59c[2] = 30.0f + cM_rndF(100.0f); + i_this->field_0x59c[1] = 20.0f + cM_rndF(20.0f); + anm_init(i_this, 5, 3.0f, 2, 1.0f); + i_this->field_0x5ce.z = 0; + kage->field_0x5a8 = 200.0f + KREG_F(11); + } + } + + if (i_this->field_0x5c6 != 0) { + i_this->field_0x5c6--; + } + + cLib_addCalcAngleS2(&i_this->field_0x5c8.x, i_this->field_0x5ce.x, 2, 3000); + cLib_addCalcAngleS2(&i_this->field_0x5c8.y, i_this->field_0x5ce.y, 2, 3000); + cLib_addCalcAngleS2(&i_this->field_0x5c8.z, i_this->field_0x5ce.z, 2, 3000); + + if (i_this->field_0x5c6 == 0) { + i_this->field_0x5c6 = 10.0f + cM_rndF(30.0f); + i_this->field_0x5ce.x = cM_rndFX(3000.0f + BREG_F(1)); + i_this->field_0x5ce.y = cM_rndFX(3000.0f + BREG_F(1)); + i_this->field_0x5ce.z = cM_rndFX(3000.0f + BREG_F(1)); + } + + if (i_this->field_0x5e2 != 0) { + i_this->field_0x5e2--; + } + + if (i_this->field_0x5e2 == 5) { + i_this->field_0x5e4 = 10.0f + cM_rndF(10.0f); + } + + if (i_this->field_0x5e2 == 0) { + i_this->field_0x5e2 = (s8)(30.0f + cM_rndF(90.0f)); + i_this->sound.startSound(Z2SE_LINKBIRD_CRY, 0, -1); + } + + s16 spE = 0; + if (i_this->field_0x5e4 != 0) { + i_this->field_0x5e4--; + spE = 10000; + } + + cLib_addCalcAngleS2(&i_this->field_0x5e6, spE, 1, 4000); + + for (int i = 0; i < 2; i++) { + if (i_this->field_0x5dc[i] != 0) { + i_this->field_0x5dc[i]--; + } + + if (i_this->field_0x5dc[i] == 0) { + i_this->field_0x5d8[i] = cM_rndFX(500.0f + BREG_F(0)); + i_this->field_0x5dc[i] = 5.0f + cM_rndF(10.0f); + } + + cLib_addCalcAngleS2(&i_this->field_0x5d4[i], i_this->field_0x5d8[i], 2, 0x1F4); + } + + mDoMtx_stack_c::transS(actor->current.pos.x, actor->current.pos.y + var_f31, actor->current.pos.z); + mDoMtx_stack_c::YrotM(BREG_S(0) + (actor->shape_angle.y + sp18)); + mDoMtx_stack_c::XrotM(BREG_S(1) + (actor->shape_angle.x + sp1A)); + mDoMtx_stack_c::ZrotM(actor->shape_angle.z); + mDoMtx_stack_c::transM(0.0f, 0.0f, BREG_F(4) + -2.0f); + + i_this->anm_p->getModel()->setBaseTRMtx(mDoMtx_stack_c::get()); + i_this->anm_p->play(NULL, 0, 0); + i_this->anm_p->modelCalc(); + + i_this->sound.framework(0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + + f32 temp_f1 = fopAcM_searchPlayerDistanceXZ(actor); + if (temp_f1 < (100.0f + KREG_F(15))) { + daPy_py_c::setLookPos(&actor->current.pos); + } + + if (daPy_getPlayerActorClass()->checkFrontRollCrash() && temp_f1 < 200.0f) { + i_this->field_0x59c[2] = 0; + + npc_henna_class* henna = (npc_henna_class*)fopAcM_SearchByName(PROC_NPC_HENNA); + if (henna != NULL) { + henna->field_0x7b5 = 40; + data_80450C9D |= 0x40; + } + } + + if (i_this->field_0x5f4 != 0) { + if (i_this->msgflow.doFlow(actor, NULL, 0)) { + dComIfGp_event_reset(); + i_this->field_0x5f4 = 0; + } + return 1; + } + + if (dComIfGp_event_runCheck() && actor->eventInfo.checkCommandTalk() && i_this->field_0x5f4 == 0) { + int flowId; + if (cM_rndF(1.0f) < 0.1f) { + flowId = 0x361; + npc_henna_class* henna = (npc_henna_class*)fopAcM_SearchByName(PROC_NPC_HENNA); + if (henna != NULL) { + henna->field_0x7ba = 2; + } + } else { + static u32 mes_0[] = { + 0x357, + 0x358, + 0x359, + 0x35A, + }; + + static u32 mes_1[] = { + 0x35B, + 0x35C, + 0x35D, + 0x35E, + }; + + int sp30 = (data_80450C9D & 3); + if (data_80450C9D & 0x40) { + flowId = mes_1[sp30]; + } else { + flowId = mes_0[sp30]; + } + } + + i_this->msgflow.init(actor, flowId, 0, NULL); + i_this->field_0x5f4 = 1; + + data_80450C9D++; + data_80450C9D &= 0xC3; + } + + fopAc_ac_c* player = dComIfGp_getPlayer(0); + f32 temp_f28 = kage->actor.current.pos.x - player->current.pos.x; + f32 temp_f27 = kage->actor.current.pos.z - player->current.pos.z; + + if ((data_80450C9D & 0x80) && i_this->field_0x59c[3] < 15 && (SQUARE(temp_f28) + SQUARE(temp_f27)) < 23000.0f) { + s16 spC = fopAcM_searchPlayerAngleY(actor); + spC = (spC - player->shape_angle.y) + 0x8000; + if (spC < 0x1800 && spC > -0x1800) { + i_this->field_0x5f5 = 5; + } + } + + if (i_this->field_0x59c[3] == 0 || mDoCPd_c::getTrigA(PAD_1)) { + i_this->field_0x59c[3] = 150.0f + cM_rndF(200.0f); + } + + if (i_this->field_0x5f5 != 0) { + i_this->field_0x5f5--; + + actor->eyePos = actor->current.pos; + actor->eyePos.y += 20.0f; + actor->attention_info.position = actor->eyePos; + actor->attention_info.position.y += 20.0f; + fopAcM_OnStatus(actor, 0); + cLib_onBit<u32>(actor->attention_info.flags, fopAc_AttnFlag_SPEAK_e | fopAc_AttnFlag_TALK_e); + actor->eventInfo.onCondition(1); + } else { + fopAcM_OffStatus(actor, 0); + cLib_offBit<u32>(actor->attention_info.flags, fopAc_AttnFlag_SPEAK_e | fopAc_AttnFlag_TALK_e); + } + + return 1; } /* 80A0DD70-80A0DD78 001450 0008+00 1/0 0/0 0/0 .text daNpc_Inko_IsDelete__FP14npc_inko_class */ -static bool daNpc_Inko_IsDelete(npc_inko_class* param_0) { - return true; +static int daNpc_Inko_IsDelete(npc_inko_class* i_this) { + return 1; } /* 80A0DD78-80A0DDC8 001458 0050+00 1/0 0/0 0/0 .text daNpc_Inko_Delete__FP14npc_inko_class */ -static void daNpc_Inko_Delete(npc_inko_class* param_0) { - // NONMATCHING +static int daNpc_Inko_Delete(npc_inko_class* i_this) { + fopAc_ac_c* actor = (fopAc_ac_c*)i_this; + fpc_ProcID id = fopAcM_GetID(i_this); + dComIfG_resDelete(&i_this->phase, "Npc_inko"); + + if (actor->heap != NULL) { + i_this->sound.deleteObject(); + } + + return 1; } /* 80A0DDC8-80A0DF08 0014A8 0140+00 1/1 0/0 0/0 .text useHeapInit__FP10fopAc_ac_c */ -static void useHeapInit(fopAc_ac_c* param_0) { - // NONMATCHING +static int useHeapInit(fopAc_ac_c* actor) { + npc_inko_class* i_this = (npc_inko_class*)actor; + i_this->anm_p = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Npc_inko", 8), NULL, NULL, NULL, 0, 1.0f, 0, -1, 1, 0, 0x80000, 0x11000084); + if (i_this->anm_p == NULL || i_this->anm_p->getModel() == NULL) { + return 0; + } + + J3DModel* model = i_this->anm_p->getModel(); + model->setUserArea((uintptr_t)i_this); + + for (u16 i = 0; i < model->getModelData()->getJointNum(); i++) { + model->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack); + } + + fopAcM_SetMtx(actor, model->getBaseTRMtx()); + i_this->sound.init(&actor->current.pos, 2); + return 1; } -/* ############################################################################################## */ -/* 80A0E0C4-80A0E0C8 0000B0 0004+00 0/1 0/0 0/0 .rodata @4461 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4461 = 65536.0f; -COMPILER_STRIP_GATE(0x80A0E0C4, &lit_4461); -#pragma pop - -/* 80A0E0C8-80A0E0CC 0000B4 0004+00 0/1 0/0 0/0 .rodata @4462 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4462 = -200.0f; -COMPILER_STRIP_GATE(0x80A0E0C8, &lit_4462); -#pragma pop - /* 80A0DF08-80A0E00C 0015E8 0104+00 1/0 0/0 0/0 .text daNpc_Inko_Create__FP10fopAc_ac_c */ -static void daNpc_Inko_Create(fopAc_ac_c* param_0) { - // NONMATCHING +static int daNpc_Inko_Create(fopAc_ac_c* actor) { + npc_inko_class* i_this = (npc_inko_class*)actor; + fopAcM_ct(actor, npc_inko_class); + + int phase_state = dComIfG_resLoad(&i_this->phase, "Npc_inko"); + if (phase_state == cPhs_COMPLEATE_e) { + OS_REPORT("NPC_INKO PARAM %x\n", fopAcM_GetParam(actor)); + i_this->field_0x570 = fopAcM_GetParam(actor); + + OS_REPORT("NPC_INKO//////////////NPC_INKO SET 1 !!\n"); + + if (!fopAcM_entrySolidHeap(actor, useHeapInit, 0xC00)) { + OS_REPORT("//////////////NPC_INKO SET NON !!\n"); + return cPhs_ERROR_e; + } + + OS_REPORT("//////////////NPC_INKO SET 2 !!\n"); + + i_this->field_0x596 = cM_rndF(65536.0f); + fopAcM_SetMin(actor, -200.0f, -200.0f, -200.0f); + fopAcM_SetMax(actor, 200.0f, 200.0f, 200.0f); + daNpc_Inko_Execute(i_this); + } + + return phase_state; } -/* ############################################################################################## */ /* 80A0E0F8-80A0E118 -00001 0020+00 1/0 0/0 0/0 .data l_daNpc_Inko_Method */ static actor_method_class l_daNpc_Inko_Method = { - (process_method_func)daNpc_Inko_Create__FP10fopAc_ac_c, - (process_method_func)daNpc_Inko_Delete__FP14npc_inko_class, - (process_method_func)daNpc_Inko_Execute__FP14npc_inko_class, - (process_method_func)daNpc_Inko_IsDelete__FP14npc_inko_class, - (process_method_func)daNpc_Inko_Draw__FP14npc_inko_class, + (process_method_func)daNpc_Inko_Create, + (process_method_func)daNpc_Inko_Delete, + (process_method_func)daNpc_Inko_Execute, + (process_method_func)daNpc_Inko_IsDelete, + (process_method_func)daNpc_Inko_Draw, }; /* 80A0E118-80A0E148 -00001 0030+00 0/0 0/0 1/0 .data g_profile_NPC_INKO */ @@ -474,5 +500,3 @@ extern actor_process_profile_definition g_profile_NPC_INKO = { fopAc_ACTOR_e, // mActorType fopAc_CULLBOX_CUSTOM_e, // cullType }; - -/* 80A0E0CC-80A0E0CC 0000B8 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ |
