From 3c2a99e701934bcde95e55420d993ffa3f635ef2 Mon Sep 17 00:00:00 2001 From: Max Roncace Date: Thu, 22 May 2025 09:22:16 -0400 Subject: [PATCH] d_a_mg_fish matching (#2450) --- config/GZ2E01/rels/d_a_mg_fish/symbols.txt | 5 +- configure.py | 2 +- include/d/actor/d_a_mg_fish.h | 114 +- include/d/actor/d_a_mg_rod.h | 103 +- include/d/actor/d_a_player.h | 7 +- include/f_op/f_op_actor_mng.h | 4 +- src/d/actor/d_a_alink_canoe.inc | 2 +- src/d/actor/d_a_mg_fish.cpp | 6332 ++++++++++++-------- src/d/actor/d_a_npc_ne.cpp | 22 +- 9 files changed, 4101 insertions(+), 2490 deletions(-) diff --git a/config/GZ2E01/rels/d_a_mg_fish/symbols.txt b/config/GZ2E01/rels/d_a_mg_fish/symbols.txt index f34510a7fcd..c562813a397 100644 --- a/config/GZ2E01/rels/d_a_mg_fish/symbols.txt +++ b/config/GZ2E01/rels/d_a_mg_fish/symbols.txt @@ -258,7 +258,7 @@ lbl_78_data_10 = .data:0x00000010; // type:object size:0x10 check_kind = .data:0x00000020; // type:object size:0x8 scope:global vib_p$3694 = .data:0x00000028; // type:object size:0x10 scope:local learn_d$3913 = .data:0x00000038; // type:object size:0x5 scope:local -swim_path127 = .data:0x00000040; // type:object size:0x2B0 scope:global +swim_path = .data:0x00000040; // type:object size:0x2B0 scope:global joint_offset_LM$5310 = .data:0x000002F0; // type:object size:0xC scope:local joint_offset_BG$5311 = .data:0x000002FC; // type:object size:0x8 scope:local joint_offset_NP$5312 = .data:0x00000304; // type:object size:0x18 scope:local @@ -303,12 +303,13 @@ __global_destructor_chain = .bss:0x00000000; // type:object size:0x4 scope:globa @1014 = .bss:0x00000038; // type:object size:0x1 scope:local @1012 = .bss:0x0000003C; // type:object size:0x1 scope:local @1010 = .bss:0x00000040; // type:object size:0x1 scope:local -@1009 = .bss:0x00000044; // type:object size:0x1 scope:local +@1007 = .bss:0x00000044; // type:object size:0x1 scope:local lbl_78_bss_46 = .bss:0x00000046; // type:object size:0x1 data:byte @3674 = .bss:0x00000048; // type:object size:0xC scope:local l_HIO = .bss:0x00000054; // type:object size:0x1C scope:global data:byte s_fish_ct = .bss:0x00000070; // type:object size:0x4 scope:global data:4byte @7455 = .bss:0x00000074; // type:object size:0xC scope:local +init$5256 = .bss:0x00000080; // type:object size:0x1 scope:local @7458 = .bss:0x00000084; // type:object size:0xC scope:local @7459 = .bss:0x00000090; // type:object size:0xC scope:local @7460 = .bss:0x0000009C; // type:object size:0xC scope:local diff --git a/configure.py b/configure.py index 21b03a80216..5703673dd08 100755 --- a/configure.py +++ b/configure.py @@ -1541,7 +1541,7 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01"), "d_a_kytag10"), ActorRel(MatchingFor("GZ2E01"), "d_a_kytag11"), ActorRel(MatchingFor("GZ2E01"), "d_a_kytag14"), - ActorRel(NonMatching, "d_a_mg_fish"), + ActorRel(MatchingFor("GZ2E01"), "d_a_mg_fish"), ActorRel(NonMatching, "d_a_npc_besu"), ActorRel(Equivalent, "d_a_npc_fairy_seirei"), ActorRel(MatchingFor("GZ2E01"), "d_a_npc_fish"), diff --git a/include/d/actor/d_a_mg_fish.h b/include/d/actor/d_a_mg_fish.h index 655ddacc9f0..2267cb8738c 100644 --- a/include/d/actor/d_a_mg_fish.h +++ b/include/d/actor/d_a_mg_fish.h @@ -7,11 +7,16 @@ #include "d/d_bg_s_acch.h" #include "d/d_cc_d.h" +/** + * @ingroup actors-unsorted + * @class mf_ke_s + * @brief Fishing line ("keburu") + * + * @details + */ struct mf_ke_s { - /* 80535F74 */ ~mf_ke_s(); - /* 80535FD4 */ mf_ke_s(); - - /* 0x00 */ u8 field_0x0[0x48]; + /* 0x00 */ cXyz mControlPoints[5]; + /* 0x3C */ cXyz mMovementDir; }; /** @@ -22,59 +27,86 @@ struct mf_ke_s { * @details * */ -class mg_fish_class : public fopEn_enemy_c { +class mg_fish_class { public: + /* 0x0 */ fopEn_enemy_c actor; /* 0x5AC */ request_of_phase_process_class mPhaseReq; - /* 0x5B4 */ s16 field_0x5b4; - /* 0x5B6 */ s16 field_0x5b6; - /* 0x5B8 */ s16 field_0x5b8; - /* 0x5BC */ f32 field_0x5bc; - /* 0x5C0 */ cXyz field_0x5c0; - /* 0x5CC */ u8 field_0x5cc[0xc]; - /* 0x5D8 */ f32 field_0x5d8; - /* 0x5DC */ f32 field_0x5dc; + /* 0x5B4 */ s16 mBobTimer; + /* 0x5B6 */ s16 mCurAction; + /* 0x5B8 */ s16 mActionPhase; + /* 0x5BC */ f32 mJointScale; + /* 0x5C0 */ cXyz mNextPos; + /* 0x5CC */ s16 mMovementYaw; + /* 0x5CE */ s16 mMovementPitch; + /* 0x5D0 */ s16 mMaxStep; + /* 0x5D2 */ s16 mCurSwimStep; + /* 0x5D4 */ f32 field_0x5d4; + /* 0x5D8 */ f32 mSurfaceY; + /* 0x5DC */ f32 mGroundY; /* 0x5E0 */ cXyz field_0x5e0; /* 0x5EC */ f32 field_0x5ec; - /* 0x5F0 */ f32 field_0x5f0; - /* 0x5F4 */ u8 field_0x5f4[8]; + /* 0x5F0 */ f32 mDistToPlayer; + /* 0x5F4 */ s16 mYawToPlayer; + /* 0x5F6 */ s16 field_0x5f6; + /* 0x5F8 */ s16 field_0x5f8; /* 0x5FC */ char* mResName; /* 0x600 */ mDoExt_McaMorf* mpMorf; - /* 0x604 */ J3DAnmTransform* field_0x604; - /* 0x608 */ u8 field_0x608[4]; + /* 0x604 */ J3DAnmTransform* mAnmTransform; + /* 0x608 */ u32 mShadowId; /* 0x60C */ int mAnmID; /* 0x610 */ mDoExt_brkAnm* mpBrkAnm; /* 0x614 */ J3DModel* mpModel[3]; /* 0x620 */ mDoExt_btpAnm* mpBtpAnm; - /* 0x624 */ s16 field_0x624; - /* 0x626 */ u8 field_0x626[2]; - /* 0x628 */ s16 field_0x628; - /* 0x62A */ u8 field_0x62a[8]; - /* 0x632 */ u16 field_0x632; + /* 0x624 */ s16 field_0x624[5]; + /* 0x62E */ s16 field_0x62e; + /* 0x630 */ s16 mRemainingHookTime; + /* 0x632 */ s16 field_0x632; /* 0x634 */ u8 mGedouKind; /* 0x635 */ u8 mKind2; /* 0x638 */ cXyz field_0x638; - /* 0x644 */ u16 field_0x644; - /* 0x646 */ u8 field_0x646[0x1e]; - /* 0x664 */ cXyz field_0x664[10]; - /* 0x6DC */ csXyz field_0x6dc[10]; - /* 0x718 */ s16 field_0x718[10]; - /* 0x72C */ int field_0x72c; - /* 0x730 */ s16 field_0x730; - /* 0x732 */ u8 field_0x732[0xe]; + /* 0x644 */ s16 mRotZ; + /* 0x648 */ u32 mBaitId; + /* 0x64C */ u32 mRodId; + /* 0x650 */ f32 field_0x650; + /* 0x654 */ f32 field_0x654; + /* 0x658 */ s8 mHookedState; + /* 0x659 */ s8 field_0x659; + /* 0x65A */ s8 field_0x65a; + /* 0x65B */ u8 field_0x65b; + /* 0x65C */ u8 field_0x65c; + /* 0x65D */ u8 field_0x65d; + /* 0x660 */ f32 field_0x660; + /* 0x664 */ cXyz mJointTranslations[10]; + /* 0x6DC */ csXyz mJointRotations[10]; + /* 0x718 */ s16 jointYaws1[10]; + /* 0x72C */ s32 mNumJoints; + /* 0x730 */ s16 jointYaws2[6]; + /* 0x73C */ f32 field_0x73c; /* 0x740 */ f32 field_0x740; - /* 0x744 */ u8 field_0x744[0x10]; + /* 0x744 */ f32 mBobAmp; + /* 0x748 */ f32 field_0x748; + /* 0x74C */ f32 field_0x74c; + /* 0x750 */ u8 field_0x750; /* 0x754 */ mf_ke_s field_0x754[2]; - /* 0x7E4 */ mDoExt_3DlineMat0_c field_0x7e4; + /* 0x7E4 */ mDoExt_3DlineMat0_c mLineMat; /* 0x800 */ Z2Creature mSound; /* 0x890 */ dBgS_AcchCir mAcchCir; /* 0x8D0 */ dBgS_ObjAcch mAcch; /* 0xAA8 */ dCcD_Stts mCcStatus; /* 0xAE4 */ dCcD_Cyl mCcCyl; - /* 0xC20 */ u8 field_0xc20[0x1c]; + /* 0xC20 */ u32 field_0xc20; + /* 0xC24 */ u8 field_0xc24[0xc28 - 0xc24]; + /* 0xC28 */ s32 mEmitterIds[3]; + /* 0xC34 */ u32 field_0xc34; + /* 0xC38 */ u32 field_0xc38; /* 0xC3C */ u8 field_0xc3c; - /* 0xC3D */ u8 field_0xc3d[0xb]; + /* 0xC3D */ u8 mCaughtType; + /* 0xC3E */ u8 field_0xc3e; + /* 0xC3F */ u8 field_0xc3f; + /* 0xC40 */ f32 field_0xc40; + /* 0xC44 */ u8 field_0xc44; /* 0xC48 */ J3DJointCallBack mNodeCallBack; - /* 0xC4C */ u32 field_0xc4c; + /* 0xC4C */ u32 mSkullfishId; }; STATIC_ASSERT(sizeof(mg_fish_class) == 0xC50); @@ -82,7 +114,17 @@ STATIC_ASSERT(sizeof(mg_fish_class) == 0xC50); class daMg_Fish_HIO_c { public: /* 80529D2C */ daMg_Fish_HIO_c(); - /* 805360A8 */ ~daMg_Fish_HIO_c(); + /* 805360A8 */ virtual ~daMg_Fish_HIO_c() {} + + /* 0x4 */ s8 field_0x4; + /* 0x8 */ f32 field_0x8; + /* 0xC */ f32 field_0xc; + /* 0x10 */ f32 field_0x10; + /* 0x14 */ f32 field_0x14; + /* 0x18 */ u8 field_0x18; + /* 0x19 */ u8 field_0x19; + /* 0x1A */ u8 field_0x1a; + /* 0x1B */ u8 field_0x1b; }; diff --git a/include/d/actor/d_a_mg_rod.h b/include/d/actor/d_a_mg_rod.h index ce70fe84742..fb30fa8c35e 100644 --- a/include/d/actor/d_a_mg_rod.h +++ b/include/d/actor/d_a_mg_rod.h @@ -9,7 +9,14 @@ #include "f_op/f_op_actor_mng.h" struct mg_rod_s { - /* 0x0 */ cXyz field_0x0[16]; + /* 0x0 */ u8 field_0x0[0x14 - 0x0]; + /* 0x14 */ void* field_0x14; + /* 0x18 */ u8 field_0x18[0x2E - 0x18]; + /* 0x2E */ s16 field_0x2e; + /* 0x30 */ s16 field_0x30; + /* 0x32 */ u8 field_0x32[0x54 - 0x32]; + /* 0x54 */ u32 field_0x54; + /* 0x58 */ u8 field_0x58[0xC0 - 0x58]; }; struct mg_line_s { @@ -43,7 +50,14 @@ public: bool checkRodEquipPermission() { return field_0x1514 == 0; } bool checkReelSpin() { return field_0x14f0 != 0; } - /* 0x0568 */ u8 field_0x568[0x590 - 0x568]; + /* 0x0568 */ u8 field_0x568[0x57A - 0x568]; + /* 0x057A */ s16 field_0x57a; + /* 0x057C */ u8 field_0x57c[0x57E - 0x57C]; + /* 0x057E */ s16 field_0x57e; + /* 0x0580 */ s16 field_0x580; + /* 0x0582 */ u8 field_0x582[0x584 - 0x582]; + /* 0x0584 */ s16 field_0x584; + /* 0x0586 */ u8 field_0x586[0x590 - 0x586]; /* 0x0590 */ f32 field_0x590; /* 0x0594 */ u8 field_0x594[0x5A4 - 0x594]; /* 0x05A4 */ mg_rod_s field_0x5a4; @@ -53,9 +67,11 @@ public: /* 0x06C4 */ u8 field_0x6c4[0x6C8 - 0x6C4]; /* 0x06C8 */ cXyz field_0x6c8; /* 0x06D4 */ cXyz field_0x6d4; - /* 0x06E0 */ u8 field_0x6e0[0x6EC - 0x6E0]; + /* 0x06E0 */ s16 field_0x6e0; + /* 0x06E2 */ u8 field_0x6e2[0x6EC - 0x6E2]; /* 0x06EC */ cXyz field_0x6ec; - /* 0x06F8 */ u8 field_0x6f8[0x71C - 0x6F8]; + /* 0x06F8 */ f32 field_0x6f8; + /* 0x06FC */ u8 field_0x6fc[0x71C - 0x6FC]; /* 0x071C */ csXyz field_0x71c[6]; /* 0x0740 */ u8 field_0x740[0x744 - 0x740]; /* 0x0744 */ cXyz field_0x744; @@ -63,36 +79,91 @@ public: /* 0x075C */ u8 field_0x75c[0x764 - 0x75C]; /* 0x0764 */ cXyz field_0x764; /* 0x0770 */ mg_line_s field_0x770; - /* 0x0C20 */ u8 field_0xc20[0xF7C - 0xC20]; + /* 0x0C20 */ u8 field_0xc20[0xF5C - 0xC20]; + /* 0x0F5C */ f32 field_0xf5c; + /* 0x0F60 */ f32 field_0xf60; + /* 0x0F64 */ f32 field_0xf64; + /* 0x0F68 */ u8 field_0xf68[0xF7C - 0xF68]; /* 0x0F7C */ s16 field_0xf7c; /* 0x0F7E */ s16 field_0xf7e; - /* 0x0F80 */ u8 field_0xf80[0xFAC - 0xF80]; + /* 0x0F80 */ s8 field_0xf80; + /* 0x0F81 */ u8 field_0xf81[0xFAC - 0xF81]; /* 0x0FAC */ mg_hook_s field_0xfac[2]; - /* 0x0FEC */ u8 field_0xfec[0x100D - 0xFEC]; + /* 0x0FEC */ u8 field_0xfec[0xFFC - 0xFEC]; + /* 0x0FFC */ s16 field_0xffc; + /* 0x0FFE */ u8 field_0xffe[2]; + /* 0x1000 */ s16 field_0x1000; + /* 0x1002 */ u8 field_0x1002[2]; + /* 0x1004 */ s16 field_0x1004; + /* 0x1006 */ s16 field_0x1006; + /* 0x1008 */ s8 field_0x1008; + /* 0x1009 */ s8 field_0x1009; + /* 0x100A */ s8 field_0x100a; + /* 0x100B */ u8 field_0x100b[1]; + /* 0x100C */ u8 field_0x100c; /* 0x100D */ s8 field_0x100d; - /* 0x100E */ u8 field_0x100e[0x1060 - 0x100E]; + /* 0x100E */ u8 field_0x100e[1]; + /* 0x100F */ s8 field_0x100f; + /* 0x1010 */ u8 field_0x1010[0x102C - 0x1010]; + /* 0x102C */ s8 field_0x102c; + /* 0x102D */ s8 field_0x102d; + /* 0x102E */ u8 field_0x102e[0x1060 - 0x102E]; /* 0x1060 */ cXyz mHookPosition; /* 0x106C */ cXyz field_0x106c; /* 0x1078 */ cXyz field_0x1078; /* 0x1084 */ csXyz field_0x1084; - /* 0x108A */ u8 field_0x108a[0x10B4 - 0x108A]; + /* 0x108A */ u8 field_0x108a[0x1090 - 0x108A]; + /* 0x1090 */ f32 field_0x1090; + /* 0x1094 */ u8 field_0x1094[0x10A4 - 0x1094]; + /* 0x10A4 */ s8 field_0x10a4; + /* 0x10A5 */ s8 field_0x10a5; + /* 0x10A6 */ s8 field_0x10a6; + /* 0x10A7 */ s8 field_0x10a7; + /* 0x10A8 */ s8 field_0x10a8; + /* 0x10A9 */ s8 field_0x10a9; + /* 0x10AA */ s8 field_0x10aa; + /* 0x10AB */ u8 field_0x10ab; + /* 0x10AC */ s32 mFishId; + /* 0x10B0 */ s16 field_0x10b0; + /* 0x10B2 */ u8 field_0x10b2[2]; /* 0x10B4 */ Z2Creature field_0x10b4; - /* 0x1144 */ u8 field_0x1144[0x1190 - 0x1144]; + /* 0x1144 */ u8 field_0x1144[0x114A - 0x1144]; + /* 0x114A */ s16 field_0x114a; + /* 0x114C */ s16 field_0x114c; + /* 0x114E */ u8 field_0x114e[0x1178 - 0x114E]; + /* 0x1178 */ u32 field_0x1178; + /* 0x117C */ u8 field_0x117c[0x1190 - 0x117C]; /* 0x1190 */ dBgS_AcchCir field_0x1190; /* 0x11D0 */ dBgS_ObjAcch field_0x11d0; /* 0x13A8 */ u8 field_0x13a8[0x13B4 - 0x13A8]; /* 0x13B4 */ s16 field_0x13b4; /* 0x13B6 */ s16 field_0x13b6; - /* 0x13B8 */ u8 field_0x13b8[0x1474 - 0x13B8]; + /* 0x13B8 */ u8 field_0x13b8[0x1408 - 0x13B8]; + /* 0x1408 */ f32 field_0x1408; + /* 0x140C */ u8 field_0x140c[0x1410 - 0x140C]; + /* 0x1410 */ f32 field_0x1410; + /* 0x1414 */ u8 field_0x1414[0x146D - 0x1414]; + /* 0x146D */ s8 field_0x146d; + /* 0x146E */ u8 field_0x146e[0x1474 - 0x146E]; /* 0x1474 */ dMsgFlow_c mMsgFlow; - /* 0x14C0 */ u8 field_0x14c0[0x14C8 - 0x14C0]; + /* 0x14C0 */ u8 field_0x14c0[0x14C2 - 0x14C0]; + /* 0x14C2 */ s16 field_0x14c2; + /* 0x14C4 */ u8 field_0x14c4[0x14C8 - 0x14C4]; /* 0x14C8 */ f32 mRodStickX; /* 0x14CC */ f32 mRodStickY; - /* 0x14D0 */ u8 field_0x14d0[0x14F0 - 0x14D0]; - /* 0x14F0 */ int field_0x14f0; - /* 0x14F4 */ u8 field_0x14f4[0x1514 - 0x14F4]; + /* 0x14D0 */ u8 field_0x14d0[0x14D8 - 0x14D0]; + /* 0x14D8 */ f32 field_0x14d8; + /* 0x14DC */ f32 field_0x14dc; + /* 0x14E0 */ u8 field_0x14e0[0x14F0 - 0x14E0]; + /* 0x14F0 */ s32 field_0x14f0; + /* 0x14F4 */ u8 field_0x14f4[0x14FC - 0x14F4]; + /* 0x14F4 */ s16 field_0x14fc; + /* 0x14F4 */ u8 field_0x14fe[0x1508 - 0x14FE]; + /* 0x1508 */ f32 field_0x1508; + /* 0x150C */ u8 field_0x150c[0x1514 - 0x150C]; /* 0x1514 */ u8 field_0x1514; - /* 0x1515 */ u8 field_0x1515[0x1518 - 0x1515]; + /* 0x1515 */ u8 field_0x1515; + /* 0x1516 */ u8 field_0x1516[0x1518 - 0x1516]; /* 0x1518 */ dCcD_Stts field_0x1518; /* 0x1554 */ dCcD_Sph field_0x1554; /* 0x168C */ u8 field_0x168c; diff --git a/include/d/actor/d_a_player.h b/include/d/actor/d_a_player.h index ce65907dd72..bfe343f1c62 100644 --- a/include/d/actor/d_a_player.h +++ b/include/d/actor/d_a_player.h @@ -475,7 +475,7 @@ public: ERFLG0_UNK_200000 = 0x200000, ERFLG0_UNK_100000 = 0x100000, ERFLG0_UNK_80000 = 0x80000, - ERFLG0_UNK_40000 = 0x40000, + ERFLG0_FISHING_ROD_GET_FISH = 0x40000, ERFLG0_UNK_20000 = 0x20000, ERFLG0_UNK_10000 = 0x10000, ERFLG0_UNK_4000 = 0x4000, @@ -928,6 +928,7 @@ public: void onNotAutoJump() { onEndResetFlg0(ERFLG0_NOT_AUTO_JUMP); } void onNotHang() { onEndResetFlg0(ERFLG0_NOT_HANG); } void onWolfFchainPull() { onEndResetFlg0(ERFLG0_WOLF_FCHAIN_PULL); } + void onFishingRodGetFish() { onEndResetFlg0(ERFLG0_FISHING_ROD_GET_FISH); } void onShieldBackBone() { onEndResetFlg1(ERFLG1_GANON_FINISH); } void onWolfEyeKeep() { onEndResetFlg1(ERFLG1_WOLF_EYE_KEEP); } void onPortalWarpMidnaAtnKeep() { onEndResetFlg2(ERFLG2_PORTAL_WARP_MIDNA_ATN_KEEP); } @@ -1143,6 +1144,10 @@ public: onEndResetFlg2(ERFLG2_UNK_2); } + void onFishingRelease() { + this->mEndResetFlg0 |= 0x4000000; + } + static daMidna_c* m_midnaActor; void setGiantPuzzle() { mSpecialMode = SMODE_WOLF_PUZZLE; } diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index 5983bf469f2..b695b0eb709 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -106,8 +106,8 @@ dBgS& dComIfG_Bgsp(); class dKy_tevstr_c; class cBgS_PolyInfo; -typedef int (*heapCallbackFunc)(fopAc_ac_c*); typedef int (*createFunc)(void*); +typedef int (*heapCallbackFunc)(fopAc_ac_c*); struct DOUBLE_POS { double x, y, z; @@ -219,7 +219,7 @@ inline fopAc_ac_c* fopAcM_Search(fopAcIt_JudgeFunc i_judgeFunc, void* i_process) } inline fopAc_ac_c* fopAcM_SearchByID(fpc_ProcID id) { - return (fopAc_ac_c*)fopAcIt_Judge((fopAcIt_JudgeFunc)fpcSch_JudgeByID, &id); + return (fopAc_ac_c*)fopAcIt_Judge(fpcSch_JudgeByID, &id); } inline fpc_ProcID fopAcM_GetLinkId(const fopAc_ac_c* i_actor) { diff --git a/src/d/actor/d_a_alink_canoe.inc b/src/d/actor/d_a_alink_canoe.inc index 856a70a4d24..73479e0fd9b 100644 --- a/src/d/actor/d_a_alink_canoe.inc +++ b/src/d/actor/d_a_alink_canoe.inc @@ -1249,7 +1249,7 @@ int daAlink_c::procCanoeFishingReel() { setFishGetFace(); - if (checkEndResetFlg0(ERFLG0_UNK_40000)) { + if (checkEndResetFlg0(ERFLG0_FISHING_ROD_GET_FISH)) { procCanoeFishingGetInit(); } else if (checkEndResetFlg0(ERFLG0_UNK_20000)) { resetUpperAnime(UPPER_2, -1.0f); diff --git a/src/d/actor/d_a_mg_fish.cpp b/src/d/actor/d_a_mg_fish.cpp index a7412441648..6faac6a4442 100644 --- a/src/d/actor/d_a_mg_fish.cpp +++ b/src/d/actor/d_a_mg_fish.cpp @@ -1,2639 +1,4131 @@ /** * @file d_a_mg_fish.cpp - * + * */ #include "d/actor/d_a_mg_fish.h" + +#include "JSystem/JKernel/JKRSolidHeap.h" +#include "SSystem/SComponent/c_cc_d.h" +#include "SSystem/SComponent/c_counter.h" +#include "Z2AudioLib/Z2Instances.h" +#include "d/actor/d_a_alink.h" +#include "d/actor/d_a_b_ob.h" +#include "d/actor/d_a_e_sg.h" +#include "d/actor/d_a_fr.h" +#include "d/actor/d_a_mg_rod.h" +#include "d/actor/d_a_npc_henna.h" +#include "d/actor/d_a_player.h" +#include "d/d_com_inf_game.h" +#include "d/d_s_play.h" +#include "d/d_vibration.h" #include "dol2asm.h" +#include "f_op/f_op_kankyo_mng.h" +#define ANM_MG_FISH_MOUTH_CLOSE 4 +#define ANM_MG_FISH_MOUTH_OPEN 5 -// -// Forward References: -// +#define ACTION_MG_FISH_MF_SWIM 0 +#define ACTION_MG_FISH_MF_STAY 1 +#define ACTION_MG_FISH_MF_AWAY 2 +#define ACTION_MG_FISH_MF_SWIM_P 4 +#define ACTION_MG_FISH_MF_SWIM_S 5 +#define ACTION_MG_FISH_RI_SWIM 10 +#define ACTION_MG_FISH_MF_AQUA 20 +#define ACTION_MG_FISH_RI_AQUA 21 +#define ACTION_MG_FISH_MF_AQUA_TILT 22 +#define ACTION_MG_FISH_MF_LURE_SEARCH 50 +#define ACTION_MG_FISH_MF_BAIT_SEARCH 51 +#define ACTION_MG_FISH_MF_HIT 52 +#define ACTION_MG_FISH_MF_JUMP 53 +#define ACTION_MG_FISH_MF_CATCH 60 +#define ACTION_MG_FISH_MF_ESA_SEARCH 70 +#define ACTION_MG_FISH_MF_ESA_HIT 71 +#define ACTION_MG_FISH_MF_ESA_CATCH 72 -extern "C" void __ct__15daMg_Fish_HIO_cFv(); -extern "C" static void hit_vib_set__FP13mg_fish_class(); -extern "C" void __dt__4cXyzFv(); -extern "C" static void sibuki_set__FP13mg_fish_classf4cXyz(); -extern "C" static void s_hitfish_sub__FPvPv(); -extern "C" static void pl_check__FP13mg_fish_classf(); -extern "C" static void anm_init__FP13mg_fish_classifUcf(); -extern "C" static void mouth_open__FP13mg_fish_class(); -extern "C" static void mouth_close__FP13mg_fish_class(); -extern "C" static void s_lure_sub__FPvPv(); -extern "C" static void s_esa_sub__FPvPv(); -extern "C" static void s_bait_sub__FPvPv(); -extern "C" static void s_other_search_sub__FPvPv(); -extern "C" static void search_lure__FP13mg_fish_classi(); -extern "C" static void s_other_bait_sub__FPvPv(); -extern "C" static void search_bait__FP13mg_fish_class(); -extern "C" static void nodeCallBack__FP8J3DJointi(); -extern "C" static void nodeCallBack2__FP8J3DJointi(); -extern "C" static void nodeCallBackLH__FP8J3DJointi(); -extern "C" static void nodeCallBackBB__FP8J3DJointi(); -extern "C" static void s_bt_sub__FPvPv(); -extern "C" static void s_sp_sub__FPvPv(); -extern "C" static void s_lh_sub__FPvPv(); -extern "C" static void s_bin_sub__FPvPv(); -extern "C" static void s_kn_sub__FPvPv(); -extern "C" static void s_ed_sub__FPvPv(); -extern "C" static void s_sy_sub__FPvPv(); -extern "C" static void s_bb_sub__FPvPv(); -extern "C" static void s_bb2_sub__FPvPv(); -extern "C" static void s_sg_sub__FPvPv(); -extern "C" static void daMg_Fish_Draw__FP13mg_fish_class(); -extern "C" static void get_surface_y__FP13mg_fish_classP4cXyz(); -extern "C" static void get_ground_y__FP13mg_fish_classP4cXyz(); -extern "C" void __dt__14dBgS_ObjGndChkFv(); -extern "C" static void mf_swim__FP13mg_fish_class(); -extern "C" static void pos_bg_check__FP4cXyzP4cXyz(); -extern "C" static void path_search__FP13mg_fish_class(); -extern "C" static void mf_swim_p__FP13mg_fish_class(); -extern "C" static void mf_swim_s__FP13mg_fish_class(); -extern "C" static void mf_stay__FP13mg_fish_class(); -extern "C" static void mf_away__FP13mg_fish_class(); -extern "C" static void ri_swim__FP13mg_fish_class(); -extern "C" static void dmcalc__FP13mg_fish_class(); -extern "C" static void mf_lure_search__FP13mg_fish_class(); -extern "C" static void mf_bait_search__FP13mg_fish_class(); -extern "C" static void mf_hit__FP13mg_fish_class(); -extern "C" static void mf_jump__FP13mg_fish_class(); -extern "C" static void pota_set__FP13mg_fish_class(); -extern "C" static void mf_catch__FP13mg_fish_class(); -extern "C" static void mf_esa_search__FP13mg_fish_class(); -extern "C" static void mf_esa_hit__FP13mg_fish_class(); -extern "C" static void mf_esa_catch__FP13mg_fish_class(); -extern "C" static void mf_aqua__FP13mg_fish_class(); -extern "C" static void ri_aqua__FP13mg_fish_class(); -extern "C" static void mf_aqua_tilt__FP13mg_fish_class(); -extern "C" static void action__FP13mg_fish_class(); -extern "C" static void ke_control__FP13mg_fish_classP7mf_ke_s(); -extern "C" static void ke_move__FP13mg_fish_classP7mf_ke_si(); -extern "C" static void daMg_Fish_Execute__FP13mg_fish_class(); -extern "C" static bool daMg_Fish_IsDelete__FP13mg_fish_class(); -extern "C" static void daMg_Fish_Delete__FP13mg_fish_class(); -extern "C" static void useHeapInit2__FP10fopAc_ac_c(); -extern "C" void __dt__12J3DFrameCtrlFv(); -extern "C" static void useHeapImg_fisht__FP10fopAc_ac_c(); -extern "C" static void daMg_Fish_Create__FP10fopAc_ac_c(); -extern "C" void __dt__8cM3dGCylFv(); -extern "C" void __dt__8cM3dGAabFv(); -extern "C" void __dt__10dCcD_GSttsFv(); -extern "C" void __dt__12dBgS_ObjAcchFv(); -extern "C" void __dt__12dBgS_AcchCirFv(); -extern "C" void __dt__7mf_ke_sFv(); -extern "C" void __ct__7mf_ke_sFv(); -extern "C" void __dt__5csXyzFv(); -extern "C" void __ct__5csXyzFv(); -extern "C" void __ct__4cXyzFv(); -extern "C" void __dt__10cCcD_GSttsFv(); -extern "C" void __dt__15daMg_Fish_HIO_cFv(); -extern "C" void __sinit_d_a_mg_fish_cpp(); -extern "C" static void func_8053612C(); -extern "C" static void func_80536134(); -extern "C" static void func_8053613C(); -extern "C" static void func_80536144(); -extern "C" static void func_8053614C(); -extern "C" extern char const* const d_a_mg_fish__stringBase0; +#define GEDOU_KIND_LM_1 0 +#define GEDOU_KIND_RI_1 1 +#define GEDOU_KIND_NP_1 2 +#define GEDOU_KIND_CF_1 3 +#define GEDOU_KIND_KS_1 4 +#define GEDOU_KIND_BG 5 +#define GEDOU_KIND_LM_2 6 +#define GEDOU_KIND_RI_2 7 +#define GEDOU_KIND_NP_2 8 +#define GEDOU_KIND_CF_2 9 +#define GEDOU_KIND_KS_2 10 +#define GEDOU_KIND_BT 20 +#define GEDOU_KIND_LH 21 +#define GEDOU_KIND_SP 22 +#define GEDOU_KIND_BB 23 +#define GEDOU_KIND_O_GD_BOTT 24 +#define GEDOU_KIND_KN 25 +#define GEDOU_KIND_ED 26 +#define GEDOU_KIND_SY 27 -// -// External References: -// - -extern "C" void mDoMtx_XrotM__FPA4_fs(); -extern "C" void mDoMtx_YrotS__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 scaleM__14mDoMtx_stack_cFfff(); -extern "C" void play__14mDoExt_baseAnmFv(); -extern "C" void init__13mDoExt_btpAnmFP16J3DMaterialTableP16J3DAnmTexPatterniifss(); -extern "C" void entry__13mDoExt_btpAnmFP16J3DMaterialTables(); -extern "C" void init__13mDoExt_brkAnmFP16J3DMaterialTableP15J3DAnmTevRegKeyiifss(); -extern "C" void entry__13mDoExt_brkAnmFP16J3DMaterialTablef(); -extern "C" void mDoExt_modelUpdateDL__FP8J3DModel(); -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 init__19mDoExt_3DlineMat0_cFUsUsi(); -extern "C" void update__19mDoExt_3DlineMat0_cFiR8_GXColorP12dKy_tevstr_c(); -extern "C" void setMat__26mDoExt_3DlineMatSortPacketFP18mDoExt_3DlineMat_c(); -extern "C" void mDoExt_J3DModel__create__FP12J3DModelDataUlUl(); -extern "C" void __ct__10fopAc_ac_cFv(); -extern "C" void fopAc_IsActor__FPv(); -extern "C" void fopAcIt_Judge__FPFPvPv_PvPv(); -extern "C" void fopAcM_delete__FP10fopAc_ac_c(); -extern "C" void fopAcM_create__FsUlPC4cXyziPC5csXyzPC4cXyzSc(); -extern "C" void fopAcM_createChild__FsUiUlPC4cXyziPC5csXyzPC4cXyzScPFPv_i(); -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 fopAcM_createItem__FPC4cXyziiiPC5csXyzPC4cXyzi(); -extern "C" void fopAcM_effSmokeSet1__FPUlPUlPC4cXyzPC5csXyzfPC12dKy_tevstr_ci(); -extern "C" void fopAcM_effHamonSet__FPUlPC4cXyzff(); -extern "C" void fopKyM_createWpillar__FPC4cXyzfi(); -extern "C" void fpcEx_Search__FPFPvPv_PvPv(); -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 -dComIfGd_setShadow__FUlScP8J3DModelP4cXyzffffR13cBgS_PolyInfoP12dKy_tevstr_csfP9_GXTexObj(); -extern "C" void onEventBit__11dSv_event_cFUs(); -extern "C" void setEventReg__11dSv_event_cFUsUc(); -extern "C" void getEventReg__11dSv_event_cCFUs(); -extern "C" void isSwitch__10dSv_info_cCFii(); -extern "C" void getRes__14dRes_control_cFPCclP11dRes_info_ci(); -extern "C" void getEmitter__Q213dPa_control_c7level_cFUl(); -extern "C" void -set__13dPa_control_cFUlUcUsPC4cXyzPC12dKy_tevstr_cPC5csXyzPC4cXyzUcP18dPa_levelEcallBackScPC8_GXColorPC8_GXColorPC4cXyzf(); -extern "C" void StartShock__12dVibration_cFii4cXyz(); -extern "C" void LineCross__4cBgSFP11cBgS_LinChk(); -extern "C" void GroundCross__4cBgSFP11cBgS_GndChk(); -extern "C" void __ct__12dBgS_AcchCirFv(); -extern "C" void SetWall__12dBgS_AcchCirFff(); -extern "C" void __dt__9dBgS_AcchFv(); -extern "C" void __ct__9dBgS_AcchFv(); -extern "C" void Set__9dBgS_AcchFP4cXyzP4cXyzP10fopAc_ac_ciP12dBgS_AcchCirP4cXyzP5csXyzP5csXyz(); -extern "C" void CrrPos__9dBgS_AcchFR4dBgS(); -extern "C" void __ct__11dBgS_GndChkFv(); -extern "C" void __dt__11dBgS_GndChkFv(); -extern "C" void __ct__18dBgS_ObjGndChk_SplFv(); -extern "C" void __dt__18dBgS_ObjGndChk_SplFv(); -extern "C" void __ct__11dBgS_LinChkFv(); -extern "C" void __dt__11dBgS_LinChkFv(); -extern "C" void Set__11dBgS_LinChkFPC4cXyzPC4cXyzPC10fopAc_ac_c(); -extern "C" void SetObj__16dBgS_PolyPassChkFv(); -extern "C" void __ct__10dCcD_GSttsFv(); -extern "C" void Init__9dCcD_SttsFiiP10fopAc_ac_c(); -extern "C" void __ct__12dCcD_GObjInfFv(); -extern "C" void Set__8dCcD_CylFRC11dCcD_SrcCyl(); -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 dKy_Sound_set__F4cXyziUii(); -extern "C" void Set__4cCcSFP8cCcD_Obj(); -extern "C" void __mi__4cXyzCFRC3Vec(); -extern "C" void cM_atan2s__Fff(); -extern "C" void cM_rndF__Ff(); -extern "C" void cM_rndFX__Ff(); -extern "C" void SetPos__11cBgS_GndChkFPC4cXyz(); -extern "C" void __dt__13cBgS_PolyInfoFv(); -extern "C" void __dt__8cM3dGCirFv(); -extern "C" void SetC__8cM3dGCylFRC4cXyz(); -extern "C" void SetH__8cM3dGCylFf(); -extern "C" void SetR__8cM3dGCylFf(); -extern "C" void cLib_addCalc2__FPffff(); -extern "C" void cLib_addCalcAngleS2__FPssss(); -extern "C" void MtxTrans__FfffUc(); -extern "C" void MtxScale__FfffUc(); -extern "C" void MtxPosition__FP4cXyzP4cXyz(); -extern "C" void func_80280808(); -extern "C" void seStart__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc(); -extern "C" void changeBgmStatus__8Z2SeqMgrFl(); -extern "C" void changeFishingBgm__8Z2SeqMgrFl(); -extern "C" void __ct__10Z2CreatureFv(); -extern "C" void init__10Z2CreatureFP3VecP3VecUcUc(); -extern "C" void* __nw__FUl(); -extern "C" void __dl__FPv(); -extern "C" void init__12J3DFrameCtrlFs(); -extern "C" void __destroy_arr(); -extern "C" void __construct_array(); -extern "C" void _savegpr_20(); -extern "C" void _savegpr_22(); -extern "C" void _savegpr_24(); -extern "C" void _savegpr_25(); -extern "C" void _savegpr_26(); -extern "C" void _savegpr_27(); -extern "C" void _savegpr_28(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_20(); -extern "C" void _restgpr_22(); -extern "C" void _restgpr_24(); -extern "C" void _restgpr_25(); -extern "C" void _restgpr_26(); -extern "C" void _restgpr_27(); -extern "C" void _restgpr_28(); -extern "C" void _restgpr_29(); -extern "C" extern void* __vt__19mDoExt_3DlineMat0_c[5]; -extern "C" u8 saveBitLabels__16dSv_event_flag_c[1644 + 4 /* padding */]; -extern "C" extern void* __vt__8dCcD_Cyl[36]; -extern "C" extern void* __vt__9dCcD_Stts[11]; -extern "C" extern void* __vt__12cCcD_CylAttr[25]; -extern "C" extern void* __vt__14cCcD_ShapeAttr[22]; -extern "C" extern void* __vt__9cCcD_Stts[8]; -extern "C" u8 m_cpadInfo__8mDoCPd_c[256]; -extern "C" u8 now__14mDoMtx_stack_c[48]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; -extern "C" u8 mSimpleTexObj__21dDlst_shadowControl_c[32]; -extern "C" extern u8 g_Counter[12 + 4 /* padding */]; -extern "C" u8 mCurrentMtx__6J3DSys[48]; -extern "C" u8 sincosTable___5JMath[65536]; -extern "C" extern void* calc_mtx[1 + 1 /* padding */]; -extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */]; -extern "C" void __register_global_object(); - -// -// Declarations: -// - -/* ############################################################################################## */ -/* 80536168-8053616C 000000 0004+00 36/36 0/0 0/0 .rodata @3679 */ -SECTION_RODATA static f32 const lit_3679 = 1.0f; -COMPILER_STRIP_GATE(0x80536168, &lit_3679); - -/* 8053616C-80536170 000004 0004+00 0/5 0/0 0/0 .rodata @3680 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3680 = 5.0f; -COMPILER_STRIP_GATE(0x8053616C, &lit_3680); -#pragma pop - -/* 80536170-80536174 000008 0004+00 0/8 0/0 0/0 .rodata @3681 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3681 = 300.0f; -COMPILER_STRIP_GATE(0x80536170, &lit_3681); -#pragma pop - -/* 80536174-80536178 00000C 0004+00 0/4 0/0 0/0 .rodata @3682 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3682 = 400.0f; -COMPILER_STRIP_GATE(0x80536174, &lit_3682); -#pragma pop - -/* 805364A4-805364B0 000000 000C+00 2/2 0/0 0/0 .data cNullVec__6Z2Calc */ -SECTION_DATA static u8 cNullVec__6Z2Calc[12] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -/* 805364B0-805364C4 00000C 0004+10 0/0 0/0 0/0 .data @1787 */ -#pragma push -#pragma force_active on -SECTION_DATA static u32 lit_1787[1 + 4 /* padding */] = { - 0x02000201, - /* padding */ - 0x40080000, - 0x00000000, - 0x3FE00000, - 0x00000000, -}; -#pragma pop +UNK_REL_DATA /* 805364C4-805364CC 000020 0008+00 0/1 0/0 0/0 .data check_kind */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 check_kind[8] = { - 0xF5, 0x7F, 0xF4, 0x7F, 0xF3, 0x7F, 0xF2, 0x7F, -}; -#pragma pop - -/* 805364CC-805364DC 000028 0010+00 1/1 0/0 0/0 .data vib_p$3694 */ -SECTION_DATA static u8 vib_p[16] = { - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, +static u16 check_kind[4] = { + 0xF57F, + 0xF47F, + 0xF37F, + 0xF27F, }; -/* 805364DC-805364E4 000038 0005+03 1/1 0/0 0/0 .data learn_d$3913 */ -SECTION_DATA static u8 learn_d[5 + 3 /* padding */] = { - 0x01, - 0x02, - 0x04, - 0x08, - 0x10, - /* padding */ - 0x00, - 0x00, - 0x00, -}; - -/* 805364E4-80536794 000040 02B0+00 2/2 0/0 0/0 .data swim_path127 */ -SECTION_DATA static u8 swim_path127[688] = { - 0x00, 0x00, 0x00, 0x00, 0xC4, 0xAE, 0x40, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x44, 0x0B, 0xC0, 0x00, - 0x00, 0x01, 0x00, 0x00, 0xC5, 0x11, 0x70, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x44, 0x9B, 0x00, 0x00, - 0x00, 0x02, 0x00, 0x00, 0xC5, 0x3B, 0xA0, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x44, 0xB9, 0x20, 0x00, - 0x00, 0x03, 0x00, 0x00, 0xC5, 0x85, 0x60, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x44, 0xD7, 0x60, 0x00, - 0x00, 0x04, 0x00, 0x00, 0xC5, 0x9F, 0xD0, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x44, 0xDF, 0x40, 0x00, - 0x00, 0x05, 0x00, 0x00, 0xC5, 0xC0, 0x98, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x45, 0x0B, 0x60, 0x00, - 0x00, 0x06, 0x00, 0x00, 0xC5, 0xD8, 0x60, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x45, 0x21, 0xF0, 0x00, - 0x00, 0x07, 0x00, 0x00, 0xC5, 0xF5, 0x00, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x45, 0x1B, 0xE0, 0x00, - 0x00, 0x08, 0x00, 0x00, 0xC6, 0x02, 0x5C, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x45, 0x04, 0x80, 0x00, - 0x00, 0x09, 0x00, 0x00, 0xC5, 0xFB, 0xE0, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x44, 0xAA, 0x20, 0x00, - 0x00, 0x0A, 0x00, 0x00, 0xC5, 0xF2, 0x50, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x44, 0x41, 0x40, 0x00, - 0x00, 0x0B, 0x00, 0x00, 0xC5, 0xE6, 0x98, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x44, 0x00, 0xC0, 0x00, - 0x00, 0x0C, 0x00, 0x00, 0xC5, 0xD4, 0xB8, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x44, 0x09, 0x40, 0x00, - 0x00, 0x0D, 0x00, 0x00, 0xC5, 0xC2, 0x70, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x44, 0x07, 0x00, 0x00, - 0x00, 0x0E, 0x00, 0x00, 0xC5, 0xA6, 0xF8, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x41, 0xA8, 0x00, 0x00, - 0x00, 0x0F, 0x00, 0x00, 0xC5, 0x9A, 0xB8, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0xC4, 0x08, 0xC0, 0x00, - 0x00, 0x10, 0x00, 0x00, 0xC5, 0x96, 0xC8, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0xC4, 0x8B, 0x00, 0x00, - 0x00, 0x11, 0x00, 0x00, 0xC5, 0x81, 0x20, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0xC4, 0xC5, 0x40, 0x00, - 0x00, 0x12, 0x00, 0x00, 0xC5, 0x5E, 0x90, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0xC4, 0xEC, 0x60, 0x00, - 0x00, 0x13, 0x00, 0x00, 0xC5, 0x4C, 0xA0, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0xC5, 0x30, 0x80, 0x00, - 0x00, 0x14, 0x00, 0x00, 0xC5, 0x28, 0x50, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0xC5, 0x56, 0xA0, 0x00, - 0x00, 0x15, 0x00, 0x00, 0xC4, 0xEF, 0x60, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0xC5, 0x60, 0x20, 0x00, - 0x00, 0x16, 0x00, 0x00, 0xC4, 0xAA, 0x00, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0xC5, 0x6D, 0x80, 0x00, - 0x00, 0x17, 0x00, 0x00, 0xC2, 0x3C, 0x00, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0xC5, 0x75, 0x10, 0x00, - 0x00, 0x18, 0x00, 0x00, 0x44, 0x33, 0x00, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0xC5, 0x46, 0xC0, 0x00, - 0x00, 0x19, 0x00, 0x00, 0x44, 0x2E, 0x00, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0xC5, 0x1B, 0xA0, 0x00, - 0x00, 0x1A, 0x00, 0x00, 0xC3, 0xC3, 0x80, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0xC4, 0x87, 0xC0, 0x00, - 0x00, 0x1B, 0x00, 0x00, 0xC4, 0x9C, 0x40, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x43, 0xA9, 0x00, 0x00, - 0x00, 0x1C, 0x00, 0x00, 0xC4, 0xB7, 0x20, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x44, 0x96, 0x60, 0x00, - 0x00, 0x1D, 0x00, 0x00, 0xC4, 0xC2, 0x20, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x45, 0x14, 0xC0, 0x00, - 0x00, 0x1E, 0x00, 0x00, 0xC3, 0xF6, 0x80, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x45, 0x42, 0x20, 0x00, - 0x00, 0x1F, 0x00, 0x00, 0x43, 0xA5, 0x00, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x45, 0x54, 0xB0, 0x00, - 0x00, 0x20, 0x00, 0x00, 0x44, 0xC9, 0xE0, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x45, 0x52, 0x10, 0x00, - 0x00, 0x21, 0x00, 0x00, 0x45, 0x55, 0xE0, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x45, 0x19, 0xC0, 0x00, - 0x00, 0x22, 0x00, 0x00, 0x45, 0x51, 0x30, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x44, 0x96, 0x60, 0x00, - 0x00, 0x23, 0x00, 0x00, 0x45, 0x44, 0x00, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x44, 0x51, 0xC0, 0x00, - 0x00, 0x24, 0x00, 0x00, 0x45, 0x2C, 0x20, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x43, 0x74, 0x00, 0x00, - 0x00, 0x25, 0x00, 0x00, 0x45, 0x03, 0x00, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0xC2, 0xFE, 0x00, 0x00, - 0x00, 0x26, 0x00, 0x00, 0x44, 0xB5, 0x80, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0xC4, 0x71, 0x00, 0x00, - 0x00, 0x27, 0x00, 0x00, 0x43, 0x7C, 0x00, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0xC4, 0xC2, 0x80, 0x00, - 0x00, 0x28, 0x00, 0x00, 0xC3, 0x57, 0x00, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0xC4, 0x99, 0x60, 0x00, - 0x00, 0x29, 0x00, 0x00, 0xC4, 0x8F, 0xA0, 0x00, 0xC2, 0xA0, 0x00, 0x00, 0x43, 0x88, 0x00, 0x00, - 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -/* 80536794-805367A0 0002F0 000C+00 1/0 0/0 0/0 .data joint_offset_LM$5310 */ -SECTION_DATA static u8 joint_offset_LM[12] = { - 0x41, 0xA0, 0x00, 0x00, 0x41, 0xA0, 0x00, 0x00, 0x41, 0xA0, 0x00, 0x00, -}; - -/* 805367A0-805367A8 0002FC 0008+00 1/0 0/0 0/0 .data joint_offset_BG$5311 */ -SECTION_DATA static u8 joint_offset_BG[8] = { - 0x41, 0xA0, 0x00, 0x00, 0x41, 0xA0, 0x00, 0x00, -}; - -/* 805367A8-805367C0 000304 0018+00 1/0 0/0 0/0 .data joint_offset_NP$5312 */ -SECTION_DATA static u8 joint_offset_NP[24] = { - 0x41, 0x78, 0x00, 0x00, 0x41, 0x78, 0x00, 0x00, 0x41, 0x78, 0x00, 0x00, - 0x41, 0x20, 0x00, 0x00, 0x41, 0x20, 0x00, 0x00, 0x41, 0x70, 0x00, 0x00, -}; - -/* 805367C0-805367D8 00031C 0018+00 1/0 0/0 0/0 .data joint_offset_KS$5313 */ -SECTION_DATA static u8 joint_offset_KS[24] = { - 0x41, 0x78, 0x00, 0x00, 0x41, 0x78, 0x00, 0x00, 0x41, 0x20, 0x00, 0x00, - 0x40, 0xA0, 0x00, 0x00, 0x41, 0x20, 0x00, 0x00, 0x41, 0x70, 0x00, 0x00, -}; - -/* 805367D8-805367F0 000334 0018+00 1/0 0/0 0/0 .data joint_offset_CF$5314 */ -SECTION_DATA static u8 joint_offset_CF[24] = { - 0x41, 0x70, 0x00, 0x00, 0x41, 0x70, 0x00, 0x00, 0x41, 0x70, 0x00, 0x00, - 0x41, 0x70, 0x00, 0x00, 0x41, 0x70, 0x00, 0x00, 0x41, 0x70, 0x00, 0x00, -}; - -/* 805367F0-80536808 00034C 0018+00 1/0 0/0 0/0 .data joint_offset_RI$5315 */ -SECTION_DATA static u8 joint_offset_RI[24] = { - 0x41, 0x84, 0x00, 0x00, 0x41, 0xB0, 0x00, 0x00, 0x41, 0xB0, 0x00, 0x00, - 0x41, 0x20, 0x00, 0x00, 0x41, 0x70, 0x00, 0x00, 0x41, 0x70, 0x00, 0x00, -}; - -/* 80536808-80536810 000364 0006+02 0/1 0/0 0/0 .data b_id$6145 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 b_id[6 + 2 /* padding */] = { - 0x87, - 0x3A, - 0x87, - 0x3B, - 0x87, - 0x3C, - /* padding */ - 0x00, - 0x00, -}; -#pragma pop - -/* 80536810-80536828 00036C 0016+02 0/1 0/0 0/0 .data h_id$6156 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 h_id[22 + 2 /* padding */] = { - 0x87, - 0x38, - 0x87, - 0x39, - 0x87, - 0x39, - 0x87, - 0x37, - 0x87, - 0x39, - 0x87, - 0x36, - 0x87, - 0x38, - 0x87, - 0x39, - 0x87, - 0x39, - 0x87, - 0x37, - 0x87, - 0x39, - /* padding */ - 0x00, - 0x00, -}; -#pragma pop - -/* 80536828-80536854 000384 002C+00 0/1 0/0 0/0 .data h_jnt$6157 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 h_jnt[44] = { - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, - 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, -}; -#pragma pop - -/* 80536854-80536978 -00001 0124+00 1/1 0/0 0/0 .data @7242 */ -SECTION_DATA static void* lit_7242[73] = { - (void*)(((char*)action__FP13mg_fish_class) + 0x1E4), - (void*)(((char*)action__FP13mg_fish_class) + 0x200), - (void*)(((char*)action__FP13mg_fish_class) + 0x234), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x244), - (void*)(((char*)action__FP13mg_fish_class) + 0x258), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x274), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x2A4), - (void*)(((char*)action__FP13mg_fish_class) + 0x2B8), - (void*)(((char*)action__FP13mg_fish_class) + 0x2CC), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x2E0), - (void*)(((char*)action__FP13mg_fish_class) + 0x2F0), - (void*)(((char*)action__FP13mg_fish_class) + 0x300), - (void*)(((char*)action__FP13mg_fish_class) + 0x310), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x324), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x374), - (void*)(((char*)action__FP13mg_fish_class) + 0x33C), - (void*)(((char*)action__FP13mg_fish_class) + 0x350), - (void*)(((char*)action__FP13mg_fish_class) + 0x360), -}; - -/* 80536978-805369A4 0004D4 002C+00 1/1 0/0 0/0 .data mouth_idx$7453 */ -SECTION_DATA static u8 mouth_idx[44] = { - 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x09, -}; - -/* 805369A4-805369D0 000500 002C+00 1/1 0/0 0/0 .data fish_bmd$8228 */ -SECTION_DATA static u8 fish_bmd[44] = { - 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, -}; - -/* 805369D0-805369FC 00052C 002C+00 1/1 0/0 0/0 .data fish_joint$8229 */ -SECTION_DATA static u8 fish_joint[44] = { - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, - 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, -}; - -/* 805369FC-80536A40 000558 0044+00 0/1 0/0 0/0 .data cc_cyl_src$8395 */ -#pragma push -#pragma force_active on -static dCcD_SrcCyl cc_cyl_src = { - { - {0x0, {{0x0, 0x0, 0x0}, {0x0, 0x0}, 0x75}}, // mObj - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg - {0x0}, // mGObjCo - }, // mObjInf - { - {0.0f, 0.0f, 0.0f}, // mCenter - 35.0f, // mRadius - 35.0f // mHeight - } // mCyl -}; -#pragma pop - -/* 80536A40-80536A6C 00059C 002C+00 0/1 0/0 0/0 .data fish_max$8453 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 fish_max[44] = { - 0x3F, 0x53, 0xF7, 0xCF, 0x3F, 0x7F, 0x7C, 0xEE, 0x3F, 0x7F, 0x7C, 0xEE, 0x3F, 0x7F, 0x7C, - 0xEE, 0x3F, 0x35, 0x3F, 0x7D, 0x3E, 0xDB, 0x22, 0xD1, 0x3E, 0xE5, 0x60, 0x42, 0x3F, 0x16, - 0x87, 0x2B, 0x3F, 0x16, 0x87, 0x2B, 0x3F, 0x0C, 0x49, 0xBA, 0x3F, 0x35, 0x3F, 0x7D, -}; -#pragma pop - -/* 80536A6C-80536A8C -00001 0020+00 1/0 0/0 0/0 .data l_daMg_Fish_Method */ -static actor_method_class l_daMg_Fish_Method = { - (process_method_func)daMg_Fish_Create__FP10fopAc_ac_c, - (process_method_func)daMg_Fish_Delete__FP13mg_fish_class, - (process_method_func)daMg_Fish_Execute__FP13mg_fish_class, - (process_method_func)daMg_Fish_IsDelete__FP13mg_fish_class, - (process_method_func)daMg_Fish_Draw__FP13mg_fish_class, -}; - -/* 80536A8C-80536ABC -00001 0030+00 0/0 0/0 1/0 .data g_profile_MG_FISH */ -extern actor_process_profile_definition g_profile_MG_FISH = { - fpcLy_CURRENT_e, // mLayerID - 7, // mListID - fpcPi_CURRENT_e, // mListPrio - PROC_MG_FISH, // mProcName - &g_fpcLf_Method.base, // sub_method - 0x00000C50, // mSize - 0, // mSizeOther - 0, // mParameters - &g_fopAc_Method.base, // sub_method - 720, // mPriority - &l_daMg_Fish_Method, // sub_method - 0x00040100, // mStatus - fopAc_ACTOR_e, // mActorType - fopAc_CULLBOX_CUSTOM_e, // cullType -}; - -/* 80536ABC-80536AC8 000618 000C+00 1/1 0/0 0/0 .data __vt__12dBgS_AcchCir */ -SECTION_DATA extern void* __vt__12dBgS_AcchCir[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12dBgS_AcchCirFv, -}; - -/* 80536AC8-80536AD4 000624 000C+00 2/2 0/0 0/0 .data __vt__10cCcD_GStts */ -SECTION_DATA extern void* __vt__10cCcD_GStts[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__10cCcD_GSttsFv, -}; - -/* 80536AD4-80536AE0 000630 000C+00 1/1 0/0 0/0 .data __vt__10dCcD_GStts */ -SECTION_DATA extern void* __vt__10dCcD_GStts[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__10dCcD_GSttsFv, -}; - -/* 80536AE0-80536AEC 00063C 000C+00 2/2 0/0 0/0 .data __vt__8cM3dGCyl */ -SECTION_DATA extern void* __vt__8cM3dGCyl[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__8cM3dGCylFv, -}; - -/* 80536AEC-80536AF8 000648 000C+00 2/2 0/0 0/0 .data __vt__8cM3dGAab */ -SECTION_DATA extern void* __vt__8cM3dGAab[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__8cM3dGAabFv, -}; - -/* 80536AF8-80536B1C 000654 0024+00 2/2 0/0 0/0 .data __vt__12dBgS_ObjAcch */ -SECTION_DATA extern void* __vt__12dBgS_ObjAcch[9] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12dBgS_ObjAcchFv, - (void*)NULL, - (void*)NULL, - (void*)func_8053614C, - (void*)NULL, - (void*)NULL, - (void*)func_80536144, -}; - -/* 80536B1C-80536B30 000678 0014+00 1/1 0/0 0/0 .data __vt__18mDoExt_3DlineMat_c */ -SECTION_DATA extern void* __vt__18mDoExt_3DlineMat_c[5] = { - (void*)NULL /* RTTI */, (void*)NULL, (void*)NULL, (void*)NULL, (void*)NULL, -}; - -/* 80536B30-80536B3C 00068C 000C+00 3/3 0/0 0/0 .data __vt__12J3DFrameCtrl */ -SECTION_DATA extern void* __vt__12J3DFrameCtrl[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12J3DFrameCtrlFv, -}; - -/* 80536B3C-80536B6C 000698 0030+00 2/2 0/0 0/0 .data __vt__14dBgS_ObjGndChk */ -SECTION_DATA extern void* __vt__14dBgS_ObjGndChk[12] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__14dBgS_ObjGndChkFv, - (void*)NULL, - (void*)NULL, - (void*)func_8053612C, - (void*)NULL, - (void*)NULL, - (void*)func_8053613C, - (void*)NULL, - (void*)NULL, - (void*)func_80536134, -}; - -/* 80536B6C-80536B78 0006C8 000C+00 2/2 0/0 0/0 .data __vt__15daMg_Fish_HIO_c */ -SECTION_DATA extern void* __vt__15daMg_Fish_HIO_c[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__15daMg_Fish_HIO_cFv, +struct PathNode { + s16 index; + Vec pos; }; /* 80529D2C-80529D7C 0000EC 0050+00 1/1 0/0 0/0 .text __ct__15daMg_Fish_HIO_cFv */ daMg_Fish_HIO_c::daMg_Fish_HIO_c() { - // NONMATCHING + this->field_0x4 = -1; + this->field_0x8 = 1.0f; + this->field_0xc = 5.0f; + this->field_0x10 = 300.0f; + this->field_0x14 = 400.0f; + this->field_0x18 = 0x0; + this->field_0x19 = 0x0; + this->field_0x1a = 0x0; } -/* ############################################################################################## */ -/* 80536178-8053617C 000010 0004+00 0/3 0/0 0/0 .rodata @3713 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3713 = 1.0f / 50.0f; -COMPILER_STRIP_GATE(0x80536178, &lit_3713); -#pragma pop - -/* 8053617C-80536180 000014 0004+00 0/19 0/0 0/0 .rodata @3714 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3714 = 100.0f; -COMPILER_STRIP_GATE(0x8053617C, &lit_3714); -#pragma pop - -/* 80536180-80536184 000018 0004+00 5/31 0/0 0/0 .rodata @3715 */ -SECTION_RODATA static u8 const lit_3715[4] = { - 0x00, - 0x00, - 0x00, - 0x00, -}; -COMPILER_STRIP_GATE(0x80536180, &lit_3715); - /* 80529D7C-80529E4C 00013C 00D0+00 3/3 0/0 0/0 .text hit_vib_set__FP13mg_fish_class */ -static void hit_vib_set(mg_fish_class* param_0) { - // NONMATCHING +static void hit_vib_set(mg_fish_class* i_this) { + static s32 vib_p[4] = { 1, 2, 3, 4 }; + + dmg_rod_class* rod = (dmg_rod_class*)fopAcM_SearchByID(i_this->mRodId); + if (rod != NULL && rod->field_0x10ab == 0) { + s32 vib_index = (rod->field_0xf60 - 100.0f) * 0.02f; + if (vib_index < 0) { + vib_index = 0; + } else if (vib_index > 3) { + vib_index = 3; + } + dComIfGp_getVibration().StartShock(vib_p[vib_index], 1, + cXyz(0.0f, 1.0f, 0.0f)); + } } -/* 80529E4C-80529E88 00020C 003C+00 4/4 0/0 0/0 .text __dt__4cXyzFv */ -// cXyz::~cXyz() { -extern "C" void __dt__4cXyzFv() { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 80536184-80536188 00001C 0004+00 1/5 0/0 0/0 .rodata @3723 */ -SECTION_RODATA static f32 const lit_3723 = 2.0f / 5.0f; -COMPILER_STRIP_GATE(0x80536184, &lit_3723); - -/* 80536188-8053618C 000020 0004+00 1/10 0/0 0/0 .rodata @3724 */ -SECTION_RODATA static f32 const lit_3724 = 1.0f / 5.0f; -COMPILER_STRIP_GATE(0x80536188, &lit_3724); - /* 80529E88-80529F10 000248 0088+00 6/6 0/0 0/0 .text sibuki_set__FP13mg_fish_classf4cXyz */ -static void sibuki_set(mg_fish_class* param_0, f32 param_1, cXyz param_2) { - // NONMATCHING +static void sibuki_set(mg_fish_class* i_this, f32 scale, cXyz i_pos) { + double newScale = 0.4f * scale * i_this->mJointScale; + i_pos.y = i_this->mSurfaceY; + fopKyM_createWpillar(&i_pos, newScale, 0); + fopAcM_effHamonSet(&i_this->field_0xc20, &i_pos, newScale, 0.2f); +} + +// needed for .rodata ordering +static f32 dummy_3759() { + return 30.0f; } /* 80529F10-80529F68 0002D0 0058+00 1/1 0/0 0/0 .text s_hitfish_sub__FPvPv */ -static void s_hitfish_sub(void* param_0, void* param_1) { - // NONMATCHING +static void* s_hitfish_sub(void* a, void* b) { + if (fopAc_IsActor(a)) { + mg_fish_class* fish = (mg_fish_class*)a; + if (fopAcM_GetName(fish) == PROC_MG_FISH && fish->mCurAction == ACTION_MG_FISH_MF_HIT) { + return &fish->actor.base; + } + } + return NULL; } -/* ############################################################################################## */ -/* 8053618C-80536190 000024 0004+00 0/12 0/0 0/0 .rodata @3759 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3759 = 30.0f; -COMPILER_STRIP_GATE(0x8053618C, &lit_3759); -#pragma pop - -/* 80536190-80536198 000028 0004+04 0/10 0/0 0/0 .rodata @3812 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3812[1 + 1 /* padding */] = { - 10.0f, - /* padding */ - 0.0f, -}; -COMPILER_STRIP_GATE(0x80536190, &lit_3812); -#pragma pop - -/* 80536198-805361A0 000030 0008+00 0/15 0/0 0/0 .rodata @3813 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3813[8] = { - 0x3F, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x80536198, &lit_3813); -#pragma pop - -/* 805361A0-805361A8 000038 0008+00 0/15 0/0 0/0 .rodata @3814 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3814[8] = { - 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x805361A0, &lit_3814); -#pragma pop - -/* 805361A8-805361B0 000040 0008+00 0/15 0/0 0/0 .rodata @3815 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3815[8] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x805361A8, &lit_3815); -#pragma pop - /* 80529F68-8052A114 000328 01AC+00 2/2 0/0 0/0 .text pl_check__FP13mg_fish_classf */ -static void pl_check(mg_fish_class* param_0, f32 param_1) { - // NONMATCHING -} +static s32 pl_check(mg_fish_class* i_this, f32 speed) { + if (i_this->mDistToPlayer < fabsf(dComIfGp_getPlayer(0)->speedF) * 10.0f + speed) { + return 1; + } -/* ############################################################################################## */ -/* 805361B0-805361B4 000048 0004+00 1/5 0/0 0/0 .rodata @3823 */ -SECTION_RODATA static f32 const lit_3823 = -1.0f; -COMPILER_STRIP_GATE(0x805361B0, &lit_3823); + fopAc_ac_c* actor = (fopAc_ac_c*)fpcEx_Search(s_hitfish_sub, i_this); + if (actor != NULL) { + if ((actor->current.pos - i_this->actor.current.pos).abs() < speed) { + return 3; + } + } + + return 0; +} /* 8052A114-8052A1C0 0004D4 00AC+00 2/2 0/0 0/0 .text anm_init__FP13mg_fish_classifUcf */ -static void anm_init(mg_fish_class* param_0, int param_1, f32 param_2, u8 param_3, - f32 param_4) { - // NONMATCHING +static void anm_init(mg_fish_class* i_this, int i_resIndex, f32 i_morf, u8 i_mode, f32 i_speed) { + J3DAnmTransform* anmTransform = + (J3DAnmTransform*)dComIfG_getObjectRes(i_this->mResName, i_resIndex); + i_this->mpMorf->setAnm(anmTransform, i_mode, i_morf, i_speed, + 0.0f, -1.0f, NULL); + i_this->mAnmID = i_resIndex; } -/* ############################################################################################## */ -/* 805361B4-805361B8 00004C 0004+00 2/8 0/0 0/0 .rodata @3833 */ -SECTION_RODATA static f32 const lit_3833 = 2.0f; -COMPILER_STRIP_GATE(0x805361B4, &lit_3833); - /* 8052A1C0-8052A21C 000580 005C+00 3/3 0/0 0/0 .text mouth_open__FP13mg_fish_class */ -static void mouth_open(mg_fish_class* param_0) { - // NONMATCHING +static void mouth_open(mg_fish_class* i_this) { + if (i_this->mAnmTransform != NULL) { + anm_init(i_this, ANM_MG_FISH_MOUTH_OPEN, 2.0f, 0, 1.0f); + } else { + if (i_this->mKind2 == 2) { + i_this->mRotZ = -3000; + } + } } /* 8052A21C-8052A278 0005DC 005C+00 6/6 0/0 0/0 .text mouth_close__FP13mg_fish_class */ -static void mouth_close(mg_fish_class* param_0) { - // NONMATCHING +static void mouth_close(mg_fish_class* i_this) { + if (i_this->mAnmTransform != NULL) { + anm_init(i_this, ANM_MG_FISH_MOUTH_CLOSE, 2.0f, 0, 1.0f); + } else { + if (i_this->mKind2 == 2) { + i_this->mRotZ = 0; + } + } } /* 8052A278-8052A2F4 000638 007C+00 1/1 0/0 0/0 .text s_lure_sub__FPvPv */ -static void s_lure_sub(void* param_0, void* param_1) { - // NONMATCHING +static void* s_lure_sub(void* a, void* b) { + if (fopAc_IsActor(a)) { + if (fopAcM_GetName(a) == PROC_MG_ROD) { + dmg_rod_class* rod = (dmg_rod_class*)a; + if (rod->field_0xf7c == 0 && + rod->field_0xf7e == 4 && + rod->field_0x10a9 == 0 && + rod->field_0x100d != 0) { + return rod; + } + } + } + return NULL; } -/* ############################################################################################## */ -/* 805361B8-805361BC 000050 0004+00 1/9 0/0 0/0 .rodata @3869 */ -SECTION_RODATA static f32 const lit_3869 = 20.0f; -COMPILER_STRIP_GATE(0x805361B8, &lit_3869); - /* 8052A2F4-8052A380 0006B4 008C+00 1/1 0/0 0/0 .text s_esa_sub__FPvPv */ -static void s_esa_sub(void* param_0, void* param_1) { - // NONMATCHING +static void* s_esa_sub(void* a, void* b) { + if (fopAc_IsActor(a)) { + if (fopAcM_GetName(a) == PROC_MG_ROD) { + dmg_rod_class* rod = (dmg_rod_class*)a; + if (rod->field_0xf7c == 1 && + rod->field_0xf7e != 5 && + rod->field_0x100d != 0 && + rod->current.pos.y < rod->field_0x590 - 20.0f) { + return rod; + } + } + } + return NULL; } /* 8052A380-8052A3EC 000740 006C+00 1/1 0/0 0/0 .text s_bait_sub__FPvPv */ -static void s_bait_sub(void* param_0, void* param_1) { - // NONMATCHING +static void* s_bait_sub(void* a, void* b) { + if (fopAc_IsActor(a)) { + if (fopAcM_GetName(a) == PROC_FR) { + fr_class* fr = (fr_class*)a; + if (fr->field_0x5ec != 0 && + fr->speedF > 1.0f) { + return fr; + } + } + } + return NULL; } -/* ############################################################################################## */ -/* 80536B80-80536B84 000008 0001+03 2/2 0/0 0/0 .bss @1109 */ -static u8 lit_1109[1 + 3 /* padding */]; - -/* 80536B84-80536B88 00000C 0001+03 0/0 0/0 0/0 .bss @1107 */ -#pragma push -#pragma force_active on -static u8 lit_1107[1 + 3 /* padding */]; -#pragma pop - -/* 80536B88-80536B8C 000010 0001+03 0/0 0/0 0/0 .bss @1105 */ -#pragma push -#pragma force_active on -static u8 lit_1105[1 + 3 /* padding */]; -#pragma pop - -/* 80536B8C-80536B90 000014 0001+03 0/0 0/0 0/0 .bss @1104 */ -#pragma push -#pragma force_active on -static u8 lit_1104[1 + 3 /* padding */]; -#pragma pop - -/* 80536B90-80536B94 000018 0001+03 0/0 0/0 0/0 .bss @1099 */ -#pragma push -#pragma force_active on -static u8 lit_1099[1 + 3 /* padding */]; -#pragma pop - -/* 80536B94-80536B98 00001C 0001+03 0/0 0/0 0/0 .bss @1097 */ -#pragma push -#pragma force_active on -static u8 lit_1097[1 + 3 /* padding */]; -#pragma pop - -/* 80536B98-80536B9C 000020 0001+03 0/0 0/0 0/0 .bss @1095 */ -#pragma push -#pragma force_active on -static u8 lit_1095[1 + 3 /* padding */]; -#pragma pop - -/* 80536B9C-80536BA0 000024 0001+03 0/0 0/0 0/0 .bss @1094 */ -#pragma push -#pragma force_active on -static u8 lit_1094[1 + 3 /* padding */]; -#pragma pop - -/* 80536BA0-80536BA4 000028 0001+03 0/0 0/0 0/0 .bss @1057 */ -#pragma push -#pragma force_active on -static u8 lit_1057[1 + 3 /* padding */]; -#pragma pop - -/* 80536BA4-80536BA8 00002C 0001+03 0/0 0/0 0/0 .bss @1055 */ -#pragma push -#pragma force_active on -static u8 lit_1055[1 + 3 /* padding */]; -#pragma pop - -/* 80536BA8-80536BAC 000030 0001+03 0/0 0/0 0/0 .bss @1053 */ -#pragma push -#pragma force_active on -static u8 lit_1053[1 + 3 /* padding */]; -#pragma pop - -/* 80536BAC-80536BB0 000034 0001+03 0/0 0/0 0/0 .bss @1052 */ -#pragma push -#pragma force_active on -static u8 lit_1052[1 + 3 /* padding */]; -#pragma pop - -/* 80536BB0-80536BB4 000038 0001+03 0/0 0/0 0/0 .bss @1014 */ -#pragma push -#pragma force_active on -static u8 lit_1014[1 + 3 /* padding */]; -#pragma pop - -/* 80536BB4-80536BB8 00003C 0001+03 0/0 0/0 0/0 .bss @1012 */ -#pragma push -#pragma force_active on -static u8 lit_1012[1 + 3 /* padding */]; -#pragma pop - -/* 80536BB8-80536BBC 000040 0001+03 0/0 0/0 0/0 .bss @1010 */ -#pragma push -#pragma force_active on -static u8 lit_1010[1 + 3 /* padding */]; -#pragma pop - -/* 80536BBC-80536BC0 -00001 0004+00 1/2 0/0 0/0 .bss None */ -/* 80536BBC 0001+01 data_80536BBC @1009 */ -/* 80536BBE 0002+00 data_80536BBE None */ -static u8 struct_80536BBC[4]; - -/* 80536BC0-80536BCC 000048 000C+00 1/1 0/0 0/0 .bss @3674 */ -static u8 lit_3674[12]; +UNK_REL_BSS +static u8 lit_1008; +static u8 lit_1007; /* 80536BCC-80536BE8 000054 001C+00 4/5 0/0 0/0 .bss l_HIO */ -static u8 l_HIO[28]; +static daMg_Fish_HIO_c l_HIO; /* 80536BE8-80536BEC 000070 0004+00 2/2 0/0 0/0 .bss s_fish_ct */ -static u8 s_fish_ct[4]; +static s32 s_fish_ct; /* 8052A3EC-8052A464 0007AC 0078+00 1/1 0/0 0/0 .text s_other_search_sub__FPvPv */ -static void s_other_search_sub(void* param_0, void* param_1) { - // NONMATCHING +static void* s_other_search_sub(void* a, void* b) { + if (fopAc_IsActor(a) && b != a && fopAcM_GetName(a) == PROC_MG_FISH) { + mg_fish_class* fish = (mg_fish_class*)a; + if (fish->mCurAction == ACTION_MG_FISH_MF_LURE_SEARCH) { + s_fish_ct += 1; + } + } + return NULL; } -/* ############################################################################################## */ -/* 805361BC-805361C0 000054 0004+00 0/11 0/0 0/0 .rodata @3987 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3987 = 1000.0f; -COMPILER_STRIP_GATE(0x805361BC, &lit_3987); -#pragma pop - -/* 805361C0-805361C4 000058 0004+00 0/12 0/0 0/0 .rodata @3988 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3988 = 1.5f; -COMPILER_STRIP_GATE(0x805361C0, &lit_3988); -#pragma pop - -/* 805361C4-805361C8 00005C 0004+00 0/12 0/0 0/0 .rodata @3989 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3989 = 0.5f; -COMPILER_STRIP_GATE(0x805361C4, &lit_3989); -#pragma pop - -/* 805361C8-805361CC 000060 0004+00 0/1 0/0 0/0 .rodata @3990 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3990 = -80.0f; -COMPILER_STRIP_GATE(0x805361C8, &lit_3990); -#pragma pop - -/* 805361CC-805361D0 000064 0004+00 0/3 0/0 0/0 .rodata @3991 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3991 = 60.0f; -COMPILER_STRIP_GATE(0x805361CC, &lit_3991); -#pragma pop - /* 8052A464-8052A7BC 000824 0358+00 1/1 0/0 0/0 .text search_lure__FP13mg_fish_classi */ -static void search_lure(mg_fish_class* param_0, int param_1) { - // NONMATCHING +static s32 search_lure(mg_fish_class* i_this, int param_2) { + static u8 learn_d[5] = { + 0x01, 0x02, 0x04, 0x08, 0x10, + }; + + if (param_2 == 0) { + fopAc_ac_c* rod_actor = (fopAc_ac_c*)fpcM_Search(s_lure_sub, i_this); + if (rod_actor != NULL) { + dmg_rod_class* rod = (dmg_rod_class*)rod_actor; + s_fish_ct = 0; + fpcM_Search(s_other_search_sub, i_this); + if (s_fish_ct <= 1) { + f32 fVar1 = i_this->field_0x5ec; + if (rod->field_0xf80 == 4) { + fVar1 = 1000.0f; + } else { + if (rod->field_0x1009 != 0) { + fVar1 *= 1.5f; + } + if (s_fish_ct > 0 && i_this->mGedouKind != GEDOU_KIND_CF_1) { + fVar1 *= 0.5f; + } + } + if (i_this->field_0xc44 >= 0x14) { + fVar1 *= 0.5f; + } + if (i_this->mGedouKind != GEDOU_KIND_CF_1 && + rod->field_0xf80 != 4 && + (i_this->field_0x750 & learn_d[rod->field_0xf80]) != 0) + { + return -1; + } + cXyz diff = rod->current.pos - i_this->actor.current.pos; + if (rod->field_0xf80 == 2 && rod->field_0x100c >= 10) { + diff.y = -80.0f; + } + if (diff.abs() < fVar1) { + return fopAcM_GetID(rod); + } + } + } + } else if (param_2 == 1) { + fopAc_ac_c* rod_actor = (fopAc_ac_c*)fpcM_Search(s_esa_sub, i_this); + if (rod_actor != NULL) { + dmg_rod_class* rod = (dmg_rod_class*)rod_actor; + if (i_this->mGedouKind == GEDOU_KIND_KS_2 && rod->field_0x102d != 1) { + return -1; + } + if ((i_this->mGedouKind == GEDOU_KIND_BG || rod->field_0x102d == 1 || rod->field_0x102c != 0) && + rod->current.pos.y < i_this->mSurfaceY - 60.0f) + { + f32 maxLatDist = i_this->field_0x5ec; + f32 distX = rod->current.pos.x - i_this->actor.current.pos.x; + f32 distZ = rod->current.pos.z - i_this->actor.current.pos.z; + f32 latDist = JMAFastSqrt(distX * distX + distZ * distZ); + if (latDist < maxLatDist) { + return fopAcM_GetID(rod); + } + } + } + } + return -1; } + + +/* 805364E4-80536794 000040 02B0+00 2/2 0/0 0/0 .data swim_path127 */ +static PathNode swim_path[43] = { + { 0, { -1394.0f, -80.0f, 559.0f } }, + { 1, { -2327.0f, -80.0f, 1240.0f } }, + { 2, { -3002.0f, -80.0f, 1481.0f } }, + { 3, { -4268.0f, -80.0f, 1723.0f } }, + { 4, { -5114.0f, -80.0f, 1786.0f } }, + { 5, { -6163.0f, -80.0f, 2230.0f } }, + { 6, { -6924.0f, -80.0f, 2591.0f } }, + { 7, { -7840.0f, -80.0f, 2494.0f } }, + { 8, { -8343.0f, -80.0f, 2120.0f } }, + { 9, { -8060.0f, -80.0f, 1361.0f } }, + { 10, { -7754.0f, -80.0f, 773.0f } }, + { 11, { -7379.0f, -80.0f, 515.0f } }, + { 12, { -6807.0f, -80.0f, 549.0f } }, + { 13, { -6222.0f, -80.0f, 540.0f } }, + { 14, { -5343.0f, -80.0f, 21.0f } }, + { 15, { -4951.0f, -80.0f, -547.0f } }, + { 16, { -4825.0f, -80.0f, -1112.0f } }, + { 17, { -4132.0f, -80.0f, -1578.0f } }, + { 18, { -3561.0f, -80.0f, -1891.0f } }, + { 19, { -3274.0f, -80.0f, -2824.0f } }, + { 20, { -2693.0f, -80.0f, -3434.0f } }, + { 21, { -1915.0f, -80.0f, -3586.0f } }, + { 22, { -1360.0f, -80.0f, -3800.0f } }, + { 23, { -47.0f, -80.0f, -3921.0f } }, + { 24, { 716,.0f -80.0f, -3180.0f } }, + { 25, { 696,.0f -80.0f, -2490.0f } }, + { 26, { -391.0f, -80.0f, -1086.0f } }, + { 27, { -1250.0f, -80.0f, 338.0f } }, + { 28, { -1465.0f, -80.0f, 1203.0f } }, + { 29, { -1553.0f, -80.0f, 2380.0f } }, + { 30, { -493.0f, -80.0f, 3106.0f } }, + { 31, { 330.0f, -80.0f, 3403.0f } }, + { 32, { 1615.0f, -80.0f, 3361.0f } }, + { 33, { 3422.0f, -80.0f, 2460.0f } }, + { 34, { 3347.0f, -80.0f, 1203.0f } }, + { 35, { 3136.0f, -80.0f, 839.0f } }, + { 36, { 2754.0f, -80.0f, 244.0f } }, + { 37, { 2096.0f, -80.0f, -127.0f } }, + { 38, { 1452.0f, -80.0f, -964.0f } }, + { 39, { 252,.0f -80.0f, -1556.0f } }, + { 40, { -215.0f, -80.0f, -1227.0f } }, + { 41, { -1149.0f, -80.0f, 272.0f } }, + { -1, { 0.0f, 0.0f, 0.0f } }, +}; + /* 8052A7BC-8052A838 000B7C 007C+00 1/2 0/0 0/0 .text s_other_bait_sub__FPvPv */ -static void s_other_bait_sub(void* param_0, void* param_1) { - // NONMATCHING +static void* s_other_bait_sub(void* a, void* b) { + if (fopAc_IsActor(a) && b != a && fopAcM_GetName(a) == PROC_MG_FISH) { + mg_fish_class* fish = (mg_fish_class*)a; + if (fish->mCurAction == ACTION_MG_FISH_MF_BAIT_SEARCH && + fish->mBaitId == ((mg_fish_class*)b)->mBaitId) { + return fish; + } + } + return NULL; } /* 8052A838-8052A9F0 000BF8 01B8+00 1/1 0/0 0/0 .text search_bait__FP13mg_fish_class */ -static void search_bait(mg_fish_class* param_0) { - // NONMATCHING +static s32 search_bait(mg_fish_class* i_this) { + void* searchRes = fpcM_Search(s_bait_sub, i_this); + if (searchRes != NULL) { + i_this->mBaitId = fopAcM_GetID(searchRes); + if (fpcM_Search(s_other_bait_sub, i_this) == NULL) { + f32 fVar1 = i_this->field_0x5ec + KREG_F(8); + cXyz acStack_38 = ((fopAc_ac_c*)searchRes)->current.pos - i_this->actor.current.pos; + f32 fVar5 = acStack_38.abs(); + if (fVar5 < fVar1) { + return i_this->mBaitId; + } + } + } + return -1; } /* 8052A9F0-8052ADBC 000DB0 03CC+00 2/2 0/0 0/0 .text nodeCallBack__FP8J3DJointi */ -static void nodeCallBack(J3DJoint* param_0, int param_1) { - // NONMATCHING +static int nodeCallBack(J3DJoint* joint, int param_1) { + if (param_1 == 0) { + s32 jointNo = joint->getJntNo(); + J3DModel* model = j3dSys.getModel(); + mg_fish_class* fish = (mg_fish_class*)model->getUserArea(); + dComIfGp_getPlayer(0); + if (fish != 0) { + if (jointNo <= fish->mNumJoints) { + MtxTrans(fish->mJointTranslations[jointNo].x, fish->mJointTranslations[jointNo].y, + fish->mJointTranslations[jointNo].z, 0); + cMtx_YrotM(*calc_mtx, fish->mJointRotations[jointNo].y); + cMtx_XrotM(*calc_mtx, fish->mJointRotations[jointNo].x); + cMtx_ZrotM(*calc_mtx, fish->mJointRotations[jointNo].z - fish->actor.shape_angle.z); + cMtx_YrotM(*calc_mtx, -16384); + MtxScale(fish->mJointScale, fish->mJointScale, fish->mJointScale, 1); + model->setAnmMtx(jointNo, *calc_mtx); + } else { + if (fish->mKind2 == 3 && jointNo >= 9 && jointNo <= 12) { + MTXCopy(model->getAnmMtx(jointNo), *calc_mtx); + MtxScale(0.0f, 0.0f, + 0.0f, 1); + model->setAnmMtx(jointNo, *calc_mtx); + } + + if (fish->mKind2 == 1 || fish->mKind2 == 2 || fish->mKind2 == 4) { + MTXCopy(model->getAnmMtx(jointNo), *calc_mtx); + if (jointNo == 7 || jointNo == 8) { + cMtx_YrotM(*calc_mtx, fish->jointYaws2[jointNo - 3]); + } + model->setAnmMtx(jointNo, *calc_mtx); + MTXCopy(*calc_mtx, &J3DSys::mCurrentMtx[0]); + } else if (fish->mKind2 == 0) { + MTXCopy(model->getAnmMtx(jointNo), *calc_mtx); + if (jointNo == 5 || jointNo == 6) { + cMtx_YrotM(*calc_mtx, fish->jointYaws2[jointNo - 1]); + } + model->setAnmMtx(jointNo, *calc_mtx); + MTXCopy(*calc_mtx, &J3DSys::mCurrentMtx[0]); + } else if (fish->mGedouKind == GEDOU_KIND_BG) { + MTXCopy(model->getAnmMtx(jointNo), *calc_mtx); + if (jointNo == 5 || jointNo == 6) { + cMtx_YrotM(*calc_mtx, fish->jointYaws2[jointNo - 1]); + } + model->setAnmMtx(jointNo, *calc_mtx); + MTXCopy(*calc_mtx, &J3DSys::mCurrentMtx[0]); + } + + if ((fish->mKind2 == 4 || fish->mKind2 == 2) && jointNo == 10) { + MTXCopy(model->getAnmMtx(jointNo), *calc_mtx); + cMtx_ZrotM(*calc_mtx, fish->mRotZ); + model->setAnmMtx(jointNo, *calc_mtx); + MTXCopy(*calc_mtx, &J3DSys::mCurrentMtx[0]); + } + } + } + } + + return 1; } /* 8052ADBC-8052AFA0 00117C 01E4+00 2/2 0/0 0/0 .text nodeCallBack2__FP8J3DJointi */ -static void nodeCallBack2(J3DJoint* param_0, int param_1) { - // NONMATCHING +static int nodeCallBack2(J3DJoint* joint, int param_1) { + if (param_1 == 0) { + s32 jointNo = joint->getJntNo(); + J3DModel* model = j3dSys.getModel(); + mg_fish_class* fish = (mg_fish_class*)model->getUserArea(); + dComIfGp_getPlayer(0); + if (fish != NULL) { + MTXCopy(model->getAnmMtx(jointNo), *calc_mtx); + if (fish->mKind2 == 3 && jointNo >= 9 && jointNo <= 12) { + MtxScale(0.0f, 0.0f, 0.0f, 1.0f); + model->setAnmMtx(jointNo, *calc_mtx); + } + + if (jointNo >= 1 && jointNo <= fish->mNumJoints) { + cMtx_YrotM(*calc_mtx, fish->jointYaws1[jointNo - 1]); + } + + if (fish->mKind2 == 1 || fish->mKind2 == 2 || fish->mKind2 == 4) { + if (jointNo == 7 || jointNo == 8) { + cMtx_YrotM(*calc_mtx, fish->jointYaws2[jointNo - 3]); + } + } else if (fish->mKind2 == 0) { + if (jointNo == 5 || jointNo == 6) { + cMtx_YrotM(*calc_mtx, fish->jointYaws2[jointNo - 1]); + } + } else if (fish->mGedouKind == GEDOU_KIND_BG && (jointNo == 5 || jointNo == 6)) { + cMtx_YrotM(*calc_mtx, fish->jointYaws2[jointNo - 1]); + } + model->setAnmMtx(jointNo, *calc_mtx); + MTXCopy(*calc_mtx, &J3DSys::mCurrentMtx[0]); + } + } + return 1; } /* 8052AFA0-8052B070 001360 00D0+00 1/1 0/0 0/0 .text nodeCallBackLH__FP8J3DJointi */ -static void nodeCallBackLH(J3DJoint* param_0, int param_1) { - // NONMATCHING +static int nodeCallBackLH(J3DJoint* joint, int param_1) { + if (param_1 == 0) { + s32 jointNo = joint->getJntNo(); + J3DModel* model = j3dSys.getModel(); + mg_fish_class* fish = (mg_fish_class*)model->getUserArea(); + if (fish != NULL && jointNo == 1) { + MTXCopy(model->getAnmMtx(jointNo), *calc_mtx); + f32 dVar4 = fish->field_0x74c + 1.0f; + MtxScale(1.0f / dVar4, dVar4, dVar4, 1.0f); + model->setAnmMtx(jointNo, *calc_mtx); + MTXCopy(*calc_mtx, &J3DSys::mCurrentMtx[0]); + } + } + return 1; } /* 8052B070-8052B148 001430 00D8+00 1/1 0/0 0/0 .text nodeCallBackBB__FP8J3DJointi */ -static void nodeCallBackBB(J3DJoint* param_0, int param_1) { - // NONMATCHING +static int nodeCallBackBB(J3DJoint* joint, int param_1) { + if (param_1 == 0) { + s32 jointNo = joint->getJntNo(); + J3DModel* model = j3dSys.getModel(); + mg_fish_class* fish = (mg_fish_class*)model->getUserArea(); + if (fish != NULL && (jointNo == 2 || jointNo == 3 || jointNo == 4)) { + MTXCopy(model->getAnmMtx(jointNo), *calc_mtx); + cMtx_YrotM(*calc_mtx, fish->jointYaws1[jointNo - 2]); + model->setAnmMtx(jointNo, *calc_mtx); + MTXCopy(*calc_mtx, &J3DSys::mCurrentMtx[0]); + } + } + return 1; } /* 8052B148-8052B1A0 001508 0058+00 3/3 0/0 0/0 .text s_bt_sub__FPvPv */ -static void s_bt_sub(void* param_0, void* param_1) { - // NONMATCHING +static void* s_bt_sub(void* a, void* b) { + if (fopAc_IsActor(a) && fopAcM_GetName(a) == PROC_MG_FISH) { + mg_fish_class* fish = (mg_fish_class*)a; + if (fish->mGedouKind == GEDOU_KIND_BT) { + return fish; + } + } + return NULL; } /* 8052B1A0-8052B1F8 001560 0058+00 2/2 0/0 0/0 .text s_sp_sub__FPvPv */ -static void s_sp_sub(void* param_0, void* param_1) { - // NONMATCHING +static void* s_sp_sub(void* a, void* b) { + if (fopAc_IsActor(a) && fopAcM_GetName(a) == PROC_MG_FISH) { + mg_fish_class* fish = (mg_fish_class*)a; + if (fish->mGedouKind == GEDOU_KIND_SP) { + return fish; + } + } + return NULL; } /* 8052B1F8-8052B264 0015B8 006C+00 2/2 0/0 0/0 .text s_lh_sub__FPvPv */ -static void s_lh_sub(void* param_0, void* param_1) { - // NONMATCHING +static void* s_lh_sub(void* a, void* b) { + if (fopAc_IsActor(a) && fopAcM_GetName(a) == PROC_MG_FISH) { + mg_fish_class* fish = (mg_fish_class*)a; + if (fish->mGedouKind == GEDOU_KIND_LH) { + fish->field_0x74c = ((mg_fish_class*)b)->field_0x74c; + return fish; + } + } + return NULL; } /* 8052B264-8052B2BC 001624 0058+00 2/2 0/0 0/0 .text s_bin_sub__FPvPv */ -static void s_bin_sub(void* param_0, void* param_1) { - // NONMATCHING +static void* s_bin_sub(void* a, void* b) { + if (fopAc_IsActor(a) && fopAcM_GetName(a) == PROC_MG_FISH) { + mg_fish_class* fish = (mg_fish_class*)a; + if (fish->mGedouKind == GEDOU_KIND_O_GD_BOTT) { + return fish; + } + } + return NULL; } /* 8052B2BC-8052B314 00167C 0058+00 2/2 0/0 0/0 .text s_kn_sub__FPvPv */ -static void s_kn_sub(void* param_0, void* param_1) { - // NONMATCHING +static void* s_kn_sub(void* a, void* b) { + if (fopAc_IsActor(a) && fopAcM_GetName(a) == PROC_MG_FISH) { + mg_fish_class* fish = (mg_fish_class*)a; + if (fish->mGedouKind == GEDOU_KIND_KN) { + return fish; + } + } + return NULL; } /* 8052B314-8052B36C 0016D4 0058+00 2/3 0/0 0/0 .text s_ed_sub__FPvPv */ -static void s_ed_sub(void* param_0, void* param_1) { - // NONMATCHING +static void* s_ed_sub(void* a, void* b) { + if (fopAc_IsActor(a) && fopAcM_GetName(a) == PROC_MG_FISH) { + mg_fish_class* fish = (mg_fish_class*)a; + if (fish->mGedouKind == GEDOU_KIND_ED) { + return fish; + } + } + return NULL; } /* 8052B36C-8052B3C4 00172C 0058+00 2/2 0/0 0/0 .text s_sy_sub__FPvPv */ -static void s_sy_sub(void* param_0, void* param_1) { - // NONMATCHING +static void* s_sy_sub(void* a, void* b) { + if (fopAc_IsActor(a) && fopAcM_GetName(a) == PROC_MG_FISH) { + mg_fish_class* fish = (mg_fish_class*)a; + if (fish->mGedouKind == GEDOU_KIND_SY) { + return fish; + } + } + return NULL; } /* 8052B3C4-8052B41C 001784 0058+00 3/3 0/0 0/0 .text s_bb_sub__FPvPv */ -static void s_bb_sub(void* param_0, void* param_1) { - // NONMATCHING +static void* s_bb_sub(void* a, void* b) { + if (fopAc_IsActor(a) && fopAcM_GetName(a) == PROC_MG_FISH) { + mg_fish_class* fish = (mg_fish_class*)a; + if (fish->mGedouKind == GEDOU_KIND_BB) { + return fish; + } + } + return NULL; } /* 8052B41C-8052B468 0017DC 004C+00 1/1 0/0 0/0 .text s_bb2_sub__FPvPv */ -static void s_bb2_sub(void* param_0, void* param_1) { - // NONMATCHING +static void* s_bb2_sub(void* a, void* b) { + if (fopAc_IsActor(a) && fopAcM_GetName(a) == PROC_E_BG) { + return a; + } + return NULL; } /* 8052B468-8052B4B4 001828 004C+00 1/1 0/0 0/0 .text s_sg_sub__FPvPv */ -static void s_sg_sub(void* param_0, void* param_1) { - // NONMATCHING +static void* s_sg_sub(void* a, void* b) { + if (fopAc_IsActor(a) && fopAcM_GetName(a) == PROC_E_SG) { + return a; + } + return NULL; } -/* ############################################################################################## */ -/* 805361D0-805361D4 000068 0004+00 0/5 0/0 0/0 .rodata @4523 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4523 = 10000.0f; -COMPILER_STRIP_GATE(0x805361D0, &lit_4523); -#pragma pop - -/* 805361D4-805361D8 00006C 0004+00 0/13 0/0 0/0 .rodata @4524 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4524 = 50.0f; -COMPILER_STRIP_GATE(0x805361D4, &lit_4524); -#pragma pop - -/* 805361D8-805361DC 000070 0004+00 0/2 0/0 0/0 .rodata @4525 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4525 = 600.0f; -COMPILER_STRIP_GATE(0x805361D8, &lit_4525); -#pragma pop - /* 8052B4B4-8052B928 001874 0474+00 1/1 0/0 0/0 .text daMg_Fish_Draw__FP13mg_fish_class */ -static void daMg_Fish_Draw(mg_fish_class* param_0) { - // NONMATCHING +s32 daMg_Fish_Draw(mg_fish_class* i_this) { + if (i_this->mGedouKind == GEDOU_KIND_BT || + i_this->mGedouKind == GEDOU_KIND_SP || + i_this->mGedouKind == GEDOU_KIND_LH || + i_this->mGedouKind == GEDOU_KIND_O_GD_BOTT || + i_this->mGedouKind == GEDOU_KIND_BB || + i_this->mGedouKind == GEDOU_KIND_KN || + i_this->mGedouKind == GEDOU_KIND_ED || + i_this->mGedouKind == GEDOU_KIND_SY) { + return 1; + } + + g_env_light.settingTevStruct(0, &i_this->actor.current.pos, &i_this->actor.tevStr); + if (i_this->mCaughtType != 0) { + mg_fish_class* fish; + if (i_this->mCaughtType == 1) { + fish = (mg_fish_class*)fpcEx_Search(s_bt_sub, i_this); + if (fish != NULL) { + g_env_light.setLightTevColorType_MAJI(fish->mpModel[0], &i_this->actor.tevStr); + mDoExt_modelUpdateDL(fish->mpModel[0]); + } + } else if (i_this->mCaughtType == 2) { + fish = (mg_fish_class*)fpcEx_Search(s_sp_sub, i_this); + if (fish != NULL) { + for (s32 i = 0; i < 3; i++) { + g_env_light.setLightTevColorType_MAJI(fish->mpModel[i], &i_this->actor.tevStr); + mDoExt_modelUpdateDL(fish->mpModel[i]); + } + } + } else if (i_this->mCaughtType == 3) { + fish = (mg_fish_class*)fpcEx_Search(s_lh_sub, i_this); + if (fish != NULL) { + g_env_light.setLightTevColorType_MAJI(fish->mpModel[0], &i_this->actor.tevStr); + mDoExt_modelUpdateDL(fish->mpModel[0]); + } + } else if (i_this->mCaughtType == 5) { + fish = (mg_fish_class*)fpcEx_Search(s_bb_sub, i_this); + if (fish != NULL) { + g_env_light.setLightTevColorType_MAJI(fish->mpModel[0], &i_this->actor.tevStr); + mDoExt_modelUpdateDL(fish->mpModel[0]); + } + } else if (i_this->mCaughtType == 6) { + fish = (mg_fish_class*)fpcEx_Search(s_bin_sub, i_this); + if (fish != NULL) { + g_env_light.setLightTevColorType_MAJI(fish->mpModel[0], &i_this->actor.tevStr); + fish->mpBtpAnm->setFrame(2.0f); + fish->mpBtpAnm->entry(fish->mpModel[0]->getModelData()); + mDoExt_modelUpdateDL(fish->mpModel[0]); + } + } else if (i_this->mCaughtType == 7) { + fish = (mg_fish_class*)fpcEx_Search(s_kn_sub, i_this); + if (fish != NULL) { + g_env_light.setLightTevColorType_MAJI(fish->mpModel[0], &i_this->actor.tevStr); + mDoExt_modelUpdateDL(fish->mpModel[0]); + } + } else if (i_this->mCaughtType == 8) { + fish = (mg_fish_class*)fpcEx_Search(s_ed_sub, i_this); + if (fish != NULL) { + g_env_light.setLightTevColorType_MAJI(fish->mpModel[0], &i_this->actor.tevStr); + mDoExt_modelUpdateDL(fish->mpModel[0]); + } + } else if (i_this->mCaughtType == 9) { + fish = (mg_fish_class*)fpcEx_Search(s_sy_sub, i_this); + if (fish != NULL) { + g_env_light.setLightTevColorType_MAJI(fish->mpModel[0], &i_this->actor.tevStr); + mDoExt_modelUpdateDL(fish->mpModel[0]); + } + } + } else { + if (i_this->field_0x5ec > 10000.0f) { + return 1; + } + + J3DModel* i_model = i_this->mpMorf->getModel(); + g_env_light.setLightTevColorType_MAJI(i_model, &i_this->actor.tevStr); + if (i_this->mpBrkAnm != NULL) { + i_this->mpBrkAnm->entry(i_model->getModelData()); + } + i_this->mpMorf->entryDL(); + if (i_this->field_0xc3c == 0 && i_this->mCurAction == ACTION_MG_FISH_MF_JUMP && + i_this->mActionPhase >= 10) { + cXyz pos; + pos.set(i_this->actor.current.pos.x, 50.0f + i_this->actor.current.pos.y, + i_this->actor.current.pos.z); + i_this->mShadowId = dComIfGd_setShadow(i_this->mShadowId, 1, i_model, &pos, + 600.0f * i_this->mJointScale, 0.0f, + i_this->actor.current.pos.y, i_this->mAcch.m_ground_h, i_this->mAcch.m_gnd, + &i_this->actor.tevStr, 0, 1.0f, &dDlst_shadowControl_c::mSimpleTexObj); + } + if (i_this->mKind2 == 3) { + _GXColor color; + color.r = 0x32; + color.g = 0x2d; + color.b = 0x14; + color.a = 0xff; + i_this->mLineMat.update(5, color, &i_this->actor.tevStr); + dComIfGd_set3DlineMat(&i_this->mLineMat); + } + } + return 1; } -/* ############################################################################################## */ -/* 805361DC-805361E0 000074 0004+00 2/7 0/0 0/0 .rodata @4538 */ -SECTION_RODATA static f32 const lit_4538 = 1500.0f; -COMPILER_STRIP_GATE(0x805361DC, &lit_4538); - -/* 805361E0-805361E4 000078 0004+00 1/1 0/0 0/0 .rodata @4539 */ -SECTION_RODATA static f32 const lit_4539 = -100000.0f; -COMPILER_STRIP_GATE(0x805361E0, &lit_4539); - /* 8052B928-8052B9CC 001CE8 00A4+00 1/1 0/0 0/0 .text get_surface_y__FP13mg_fish_classP4cXyz */ -static void get_surface_y(mg_fish_class* param_0, cXyz* param_1) { - // NONMATCHING +static void get_surface_y(mg_fish_class* i_this, cXyz* param_2) { + dBgS_ObjGndChk_Spl gndChk; + cXyz pos = *param_2; + pos.y += 1500.0f; + gndChk.SetPos(&pos); + dBgS& bgs = dComIfG_Bgsp(); + f32 gndCross = bgs.GroundCross(&gndChk); + if (!(gndCross < -100000.0f)) { + i_this->mSurfaceY = gndCross; + } } /* 8052B9CC-8052BAB8 001D8C 00EC+00 7/7 0/0 0/0 .text get_ground_y__FP13mg_fish_classP4cXyz */ -static void get_ground_y(mg_fish_class* param_0, cXyz* param_1) { - // NONMATCHING +static f32 get_ground_y(mg_fish_class* i_this, cXyz* param_2) { + dBgS_ObjGndChk gndChk; + cXyz pos = *param_2; + pos.y += 1500.0f; + gndChk.SetPos(&pos); + return dComIfG_Bgsp().GroundCross(&gndChk); } -/* 8052BAB8-8052BB30 001E78 0078+00 4/3 0/0 0/0 .text __dt__14dBgS_ObjGndChkFv */ -// dBgS_ObjGndChk::~dBgS_ObjGndChk() { -extern "C" void __dt__14dBgS_ObjGndChkFv() { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 805361E4-805361E8 00007C 0004+00 0/10 0/0 0/0 .rodata @4647 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4647 = 2000.0f; -COMPILER_STRIP_GATE(0x805361E4, &lit_4647); -#pragma pop - -/* 805361E8-805361EC 000080 0004+00 0/14 0/0 0/0 .rodata @4648 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4648 = 1.0f / 10.0f; -COMPILER_STRIP_GATE(0x805361E8, &lit_4648); -#pragma pop - /* 8052BB30-8052BF68 001EF0 0438+00 1/1 0/0 0/0 .text mf_swim__FP13mg_fish_class */ -static void mf_swim(mg_fish_class* param_0) { - // NONMATCHING +static void mf_swim(mg_fish_class* i_this) { + cXyz delta; + switch (i_this->mActionPhase) { + case 0: + i_this->mNextPos.x = i_this->actor.home.pos.x + cM_rndFX(1000.0f); + i_this->mNextPos.z = i_this->actor.home.pos.z + cM_rndFX(1000.0f); + if (i_this->field_0x624[2] == 0) { + i_this->mNextPos.y = i_this->mSurfaceY; + i_this->mActionPhase = 2; + } else { + i_this->mNextPos.y = i_this->actor.home.pos.y; + i_this->mActionPhase = 1; + } + i_this->mGroundY = get_ground_y(i_this, &i_this->mNextPos); + f32 deltaY = i_this->mSurfaceY - i_this->mGroundY; + if (deltaY > 0.0f && deltaY < 2000.0f) { + if (i_this->mActionPhase == 1) { + i_this->mNextPos.y = i_this->mGroundY + + (cM_rndFX(0.2f) + 0.5f) * + (i_this->mSurfaceY - i_this->mGroundY); + } + i_this->field_0x624[0] = cM_rndF(50.0f) + 50.0f; + } else { + i_this->mActionPhase = 0; + break; + } + case 1: + delta = i_this->mNextPos - i_this->actor.current.pos; + if ((i_this->mBobTimer & 3) == 0) { + i_this->mMovementYaw = cM_atan2s(delta.x, delta.z); + f32 latMoveDist = JMAFastSqrt(delta.x * delta.x + delta.z * delta.z); + i_this->mMovementPitch = -cM_atan2s(delta.y, latMoveDist); + } + if (i_this->field_0x624[0] == 0 || delta.abs() < 100.0f) { + i_this->mActionPhase = 0; + } + break; + case 2: + delta = i_this->mNextPos - i_this->actor.current.pos; + if ((i_this->mBobTimer & 3) == 0) { + i_this->mMovementYaw = cM_atan2s(delta.x, delta.z); + f32 latMoveDist = JMAFastSqrt(delta.x * delta.x + delta.z * delta.z); + i_this->mMovementPitch = -cM_atan2s(delta.y, latMoveDist); + } + if (i_this->actor.current.pos.y > i_this->mSurfaceY - 10.0f) { + sibuki_set(i_this, 1.5f, i_this->field_0x638); + i_this->mSound.startCreatureSound(Z2SE_AL_FISH_JUMP_UP_S, 0, -1); + i_this->actor.current.angle.x = 0x2000; + i_this->mMovementYaw = 0x2000; + i_this->mActionPhase = 0; + i_this->field_0x624[2] = cM_rndF(1000.0f) + 1000.0f; + } + break; + } + + cLib_addCalc2(&i_this->actor.speedF, 1.0f, 1.0f, 0.1f); + i_this->mMaxStep = 0x400; + cLib_addCalcAngleS2(&i_this->actor.current.angle.y, i_this->mMovementYaw, 2, i_this->mMaxStep); + cLib_addCalcAngleS2(&i_this->actor.current.angle.x, i_this->mMovementPitch, 2, i_this->mMaxStep); } /* 8052BF68-8052BFF8 002328 0090+00 1/1 0/0 0/0 .text pos_bg_check__FP4cXyzP4cXyz */ -static void pos_bg_check(cXyz* param_0, cXyz* param_1) { - // NONMATCHING +static s32 pos_bg_check(cXyz* param_1, cXyz* param_2) { + dBgS_LinChk dStack_80; + dStack_80.Set(param_1, param_2, NULL); + dBgS& foo = dComIfG_Bgsp(); + s32 iVar1 = foo.LineCross(&dStack_80); + if (iVar1 != 0) { + return 1; + } else { + return 0; + } } -/* ############################################################################################## */ -/* 805361EC-805361F0 000084 0004+00 0/6 0/0 0/0 .rodata @4738 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4738 = 500.0f; -COMPILER_STRIP_GATE(0x805361EC, &lit_4738); -#pragma pop - -/* 805361F0-805361F4 000088 0004+00 0/3 0/0 0/0 .rodata @4739 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4739 = 7000.0f; -COMPILER_STRIP_GATE(0x805361F0, &lit_4739); -#pragma pop - /* 8052BFF8-8052C230 0023B8 0238+00 1/1 0/0 0/0 .text path_search__FP13mg_fish_class */ -static void path_search(mg_fish_class* param_0) { - // NONMATCHING +static s16 path_search(mg_fish_class* i_this) { + f32 maxSpeed = 500.0f; + + s32 visited[50]; + for (s32 i = 0; i < 50; i++) { + visited[i] = 0; + } + + for (s16 i = 0; i < 50; i++) { + if (swim_path[i].index >= 0 && visited[i] == 0) { + cXyz pos_offset; + cXyz path_pos = swim_path[i].pos; + pos_offset = i_this->actor.current.pos - path_pos; + f32 speedMagnitude = pos_offset.abs(); + if (speedMagnitude < maxSpeed) { + if (pos_bg_check(&i_this->actor.current.pos, &path_pos)) { + visited[i] = 1; + } else { + return i; + } + } + } else { + i = -1; + maxSpeed += 300.0f; + if (maxSpeed > 7000.0f) { + return -1; + } + } + } + return -1; } -/* ############################################################################################## */ -/* 805361F4-805361F8 00008C 0004+00 0/8 0/0 0/0 .rodata @4806 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4806 = 200.0f; -COMPILER_STRIP_GATE(0x805361F4, &lit_4806); -#pragma pop - -/* 805361F8-805361FC 000090 0004+00 0/5 0/0 0/0 .rodata @4807 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4807 = 40.0f; -COMPILER_STRIP_GATE(0x805361F8, &lit_4807); -#pragma pop - /* 8052C230-8052C574 0025F0 0344+00 1/1 0/0 0/0 .text mf_swim_p__FP13mg_fish_class */ -static void mf_swim_p(mg_fish_class* param_0) { - // NONMATCHING +static void mf_swim_p(mg_fish_class* i_this) { + f32 targetSpeed = 1.0f; + switch (i_this->mActionPhase) { + case 0: + i_this->mCurSwimStep = path_search(i_this); + if (i_this->mCurSwimStep < 0) { + i_this->actor.home.pos = i_this->actor.current.pos; + i_this->mActionPhase = 10; + return; + } + + i_this->mActionPhase = 1; + case 1: + i_this->mNextPos.x = swim_path[i_this->mCurSwimStep].pos.x + cM_rndFX(200.0f); + i_this->mNextPos.y = swim_path[i_this->mCurSwimStep].pos.y + cM_rndFX(40.0f); + i_this->mNextPos.z = swim_path[i_this->mCurSwimStep].pos.z + cM_rndFX(200.0f); + + i_this->mActionPhase = 2; + case 2: + cXyz delta = i_this->mNextPos - i_this->actor.current.pos; + i_this->mMovementYaw = cM_atan2s(delta.x, delta.z); + f32 latMoveDist = JMAFastSqrt(delta.x * delta.x + delta.z * delta.z); + i_this->mMovementPitch = -cM_atan2s(delta.y, latMoveDist); + + f32 distToNextPos = delta.abs(); + if (distToNextPos < 100.0f) { + i_this->mActionPhase = 1; + i_this->mCurSwimStep += 1; + i_this->mMaxStep = 0; + if (swim_path[i_this->mCurSwimStep].index < 0) { + i_this->mCurSwimStep = 0; + } + } else if (i_this->mAcch.ChkWallHit()) { + i_this->mActionPhase = 0; + } + break; + case 10: + targetSpeed = 0.0f; + break; + } + + cLib_addCalc2(&i_this->actor.speedF, targetSpeed, 1.0f, 0.1f); + cLib_addCalcAngleS2(&i_this->mMaxStep, 0x400, 4, 0x20); + cLib_addCalcAngleS2(&i_this->actor.current.angle.y, i_this->mMovementYaw, 2, i_this->mMaxStep); + cLib_addCalcAngleS2(&i_this->actor.current.angle.x, i_this->mMovementPitch, 2, i_this->mMaxStep); } /* 8052C574-8052CAA0 002934 052C+00 1/1 0/0 0/0 .text mf_swim_s__FP13mg_fish_class */ -static void mf_swim_s(mg_fish_class* param_0) { - // NONMATCHING -} +static void mf_swim_s(mg_fish_class* i_this) { + cXyz delta; -/* ############################################################################################## */ -/* 805361FC-80536200 000094 0004+00 0/5 0/0 0/0 .rodata @4976 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4976 = 1.0f / 100.0f; -COMPILER_STRIP_GATE(0x805361FC, &lit_4976); -#pragma pop + switch (i_this->mActionPhase) { + case 0: + i_this->mNextPos.x = i_this->actor.home.pos.x + cM_rndFX(1000.0f); + i_this->mNextPos.z = i_this->actor.home.pos.z + cM_rndFX(1000.0f); + if (i_this->field_0x5ec < 10000.0f && i_this->field_0x624[2] == 0) { + i_this->mNextPos.y = i_this->mSurfaceY; + i_this->mActionPhase = 2; + } else { + i_this->mNextPos.y = i_this->actor.home.pos.y; + i_this->mActionPhase = 1; + } + i_this->mGroundY = get_ground_y(i_this, &i_this->mNextPos); + if (i_this->mSurfaceY - i_this->mGroundY > 400.0f) { + i_this->mGroundY = i_this->mSurfaceY - 400.0f; + } + if (i_this->mSurfaceY - i_this->mGroundY > 0.0f && + i_this->mSurfaceY - i_this->mGroundY < 2000.0f) { + if (i_this->mActionPhase == 1) { + i_this->mNextPos.y = i_this->mGroundY + (i_this->mSurfaceY - i_this->mGroundY) * + (cM_rndFX(0.2f) + 0.5f); + } + i_this->field_0x624[0] = cM_rndF(50.0f) + 50.0f; + // intentional fall-through + } else { + i_this->mActionPhase = 0; + break; + } + case 1: + delta = i_this->mNextPos - i_this->actor.current.pos; + if ((i_this->mBobTimer & 3) == 0) { + i_this->mMovementYaw = cM_atan2s(delta.x, delta.z); + f32 latMoveDist = JMAFastSqrt(delta.x * delta.x + delta.z * delta.z); + i_this->mMovementPitch = -cM_atan2s(delta.y, latMoveDist); + } + if (i_this->field_0x624[0] == 0 || delta.abs() < 100.0f) { + i_this->mActionPhase = 0; + } + break; + case 2: + delta = i_this->mNextPos - i_this->actor.current.pos; + if ((i_this->mBobTimer & 3) == 0) { + i_this->mMovementYaw = cM_atan2s(delta.x, delta.z); + f32 latMoveDist = JMAFastSqrt(delta.x * delta.x + delta.z * delta.z); + i_this->mMovementPitch = -cM_atan2s(delta.y, latMoveDist); + } + if (i_this->actor.current.pos.y > i_this->mSurfaceY - 10.0f) { + sibuki_set(i_this, 1.5f, i_this->field_0x638); + i_this->mSound.startCreatureSound(Z2SE_AL_FISH_JUMP_UP_S, 0, -1); + i_this->actor.current.angle.x = 0x2000; + i_this->mMovementYaw = 0x2000; + i_this->mActionPhase = 0; + i_this->field_0x624[2] = cM_rndF(1000.0f) + 1000.0f; + } + break; + } + + cLib_addCalc2(&i_this->actor.speedF, 1.0f, 1.0f, 0.1f); + i_this->mMaxStep = 0x400; + cLib_addCalcAngleS2(&i_this->actor.current.angle.y, i_this->mMovementYaw, 2, i_this->mMaxStep); + cLib_addCalcAngleS2(&i_this->actor.current.angle.x, i_this->mMovementPitch, 2, i_this->mMaxStep); + + if (i_this->field_0x632 == 0 && + i_this->mGedouKind == GEDOU_KIND_BG && + i_this->field_0x5ec > 10000.0f && + (i_this->mBobTimer & 0xF) == 0) { + if (fpcEx_Search(s_sg_sub, i_this) != NULL || + fpcEx_Search(s_bb2_sub, i_this) != NULL) { + if (fpcEx_Search(s_bb2_sub, i_this) != NULL && + fpcEx_Search(s_bb_sub, i_this) == NULL) { + fopAcM_create(PROC_MG_FISH, 0x17, &i_this->actor.current.pos, + fopAcM_GetRoomNo(&i_this->actor), NULL, NULL, -1); + } + } else { + fopAcM_delete(&i_this->actor); + } + } +} /* 8052CAA0-8052CD68 002E60 02C8+00 1/1 0/0 0/0 .text mf_stay__FP13mg_fish_class */ -static void mf_stay(mg_fish_class* param_0) { - // NONMATCHING +static void mf_stay(mg_fish_class* i_this) { + f32 f31 = 0.0f; + f32 f30 = 0.01f; + switch (i_this->mActionPhase) { + case 0: + i_this->mNextPos = i_this->actor.home.pos; + i_this->mGroundY = get_ground_y(i_this, &i_this->mNextPos); + i_this->mActionPhase += 1; + i_this->mMaxStep = 0; + break; + case 1: + f31 = 0.4f; + f30 = 0.02f; + cXyz delta = i_this->mNextPos - i_this->actor.current.pos; + f32 fVar6 = delta.abs(); + if (fVar6 < 60.0f) { + i_this->mActionPhase = 2; + break; + } + i_this->mMovementYaw = cM_atan2s(delta.x, delta.z); + f32 mag = JMAFastSqrt(delta.x * delta.x + delta.z * delta.z); + i_this->mMovementPitch = -cM_atan2s(delta.y, mag); + break; + case 2: + cLib_addCalcAngleS2(&i_this->mMovementPitch, 0, 16, 0xa0); + if (i_this->field_0x624[0] == 1 && i_this->field_0xc44 < 10) { + i_this->mActionPhase = 0; + } + break; + } + + cLib_addCalc2(&i_this->actor.speedF, f31, 1.0f, f30); + cLib_addCalcAngleS2(&i_this->actor.current.angle.y, i_this->mMovementYaw, 2, i_this->mMaxStep); + cLib_addCalcAngleS2(&i_this->actor.current.angle.x, i_this->mMovementPitch, 2, i_this->mMaxStep); + cLib_addCalcAngleS2(&i_this->mMaxStep, 0x300, 1, 0x20); } -/* ############################################################################################## */ -/* 80536200-80536204 000098 0004+00 0/1 0/0 0/0 .rodata @5103 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5103 = 14000.0f; -COMPILER_STRIP_GATE(0x80536200, &lit_5103); -#pragma pop - -/* 80536204-80536208 00009C 0004+00 0/6 0/0 0/0 .rodata @5104 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5104 = 150.0f; -COMPILER_STRIP_GATE(0x80536204, &lit_5104); -#pragma pop - -/* 80536208-8053620C 0000A0 0004+00 1/6 0/0 0/0 .rodata @5105 */ -SECTION_RODATA static f32 const lit_5105 = 3.0f / 10.0f; -COMPILER_STRIP_GATE(0x80536208, &lit_5105); - /* 8052CD68-8052D3BC 003128 0654+00 1/1 0/0 0/0 .text mf_away__FP13mg_fish_class */ -static void mf_away(mg_fish_class* param_0) { - // NONMATCHING +static void mf_away(mg_fish_class* i_this) { + cXyz offsetToNext; + + switch (i_this->mActionPhase) { + case -1: + dKy_Sound_set(i_this->actor.current.pos, 30.0f * i_this->mJointScale, + fopAcM_GetID(i_this), 5); + i_this->field_0x624[1] = 0; + i_this->field_0x624[0] = 0; + i_this->mActionPhase = 0; + case 0: + mouth_close(i_this); + mDoMtx_YrotS(*calc_mtx, i_this->mYawToPlayer + 0x8000 + (s16)cM_rndFX(14000.0f)); + offsetToNext.x = 0.0f; + offsetToNext.y = 0.0f; + offsetToNext.z = cM_rndF(150.0f) + 200.0f; + MtxPosition(&offsetToNext, &i_this->mNextPos); + i_this->mNextPos += i_this->actor.current.pos; + i_this->mGroundY = get_ground_y(i_this, &i_this->mNextPos); + if (i_this->mSurfaceY - i_this->mGroundY > 400.0f) { + i_this->mGroundY = i_this->mSurfaceY - 400.0f; + } + if (i_this->mSurfaceY - i_this->mGroundY > 0.0f && + i_this->mSurfaceY - i_this->mGroundY < 2000.0f) { + i_this->mNextPos.y = i_this->mGroundY + (i_this->mSurfaceY - i_this->mGroundY) * + (cM_rndF(0.2f) + 0.1f); + if (i_this->mGedouKind >= GEDOU_KIND_BG) { + i_this->field_0x624[0] = cM_rndF(50.0f) + 50.0f; + i_this->mActionPhase += 1; + } else { + if (i_this->field_0x624[0] == 0) { + i_this->field_0x624[0] = cM_rndF(200.0f) + 500.0f; + } + i_this->mActionPhase = 5; + break; + } + } else { + break; + } + case 1: + offsetToNext = i_this->mNextPos - i_this->actor.current.pos; + i_this->mMovementYaw = cM_atan2s(offsetToNext.x, offsetToNext.z); + i_this->mMovementPitch = + -cM_atan2s(offsetToNext.y, JMAFastSqrt(offsetToNext.x * offsetToNext.x + offsetToNext.z * offsetToNext.z)); + if (i_this->field_0x624[0] == 0 || offsetToNext.abs() < 100.0f) { + if (pl_check(i_this, 500.0f) == 0) { + i_this->mCurAction = ACTION_MG_FISH_MF_SWIM_S; + i_this->mActionPhase = 0; + i_this->field_0x624[0] = cM_rndF(100.0f) + 100.0f; + i_this->field_0x62e = cM_rndF(100.0f) + 200.0f; + } else { + i_this->mActionPhase = 0; + } + } + break; + case 5: + if (i_this->mGedouKind < GEDOU_KIND_BG) { + if ((i_this->mAcch.m_flags & (1 << 4)) != 0) { + if (i_this->field_0x624[1] == 0) { + i_this->mActionPhase = 0; + i_this->field_0x624[1] = 40; + break; + } + } + } + + offsetToNext = i_this->mNextPos - i_this->actor.current.pos; + i_this->mMovementYaw = cM_atan2s(offsetToNext.x, offsetToNext.z); + i_this->mMovementPitch = + -cM_atan2s(offsetToNext.y, JMAFastSqrt(offsetToNext.x * offsetToNext.x + offsetToNext.z * offsetToNext.z)); + if (i_this->field_0x624[0] == 0 || offsetToNext.abs() < 100.0f) { + i_this->mCurAction = ACTION_MG_FISH_MF_STAY; + i_this->mActionPhase = 2; + i_this->field_0x624[0] = cM_rndF(1000.0f) + 2000.0f; + i_this->field_0x62e = cM_rndF(100.0f) + 200.0f; + } + break; + } + + cLib_addCalc2(&i_this->actor.speedF, 1.5f, 1.0f, + 0.3f); + i_this->mMaxStep = 0x800; + cLib_addCalcAngleS2(&i_this->actor.current.angle.y, i_this->mMovementYaw, 2, i_this->mMaxStep); + cLib_addCalcAngleS2(&i_this->actor.current.angle.x, i_this->mMovementPitch, 2,i_this-> mMaxStep); } -/* ############################################################################################## */ -/* 8053620C-80536210 0000A4 0004+00 0/2 0/0 0/0 .rodata @5280 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5280 = 8000.0f; -COMPILER_STRIP_GATE(0x8053620C, &lit_5280); -#pragma pop - -/* 80536210-80536214 0000A8 0004+00 0/4 0/0 0/0 .rodata @5281 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5281 = 0.25f; -COMPILER_STRIP_GATE(0x80536210, &lit_5281); -#pragma pop - -/* 80536214-80536218 0000AC 0004+00 0/4 0/0 0/0 .rodata @5282 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5282 = 65536.0f; -COMPILER_STRIP_GATE(0x80536214, &lit_5282); -#pragma pop - -/* 80536218-8053621C 0000B0 0004+00 0/3 0/0 0/0 .rodata @5283 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5283 = -30.0f; -COMPILER_STRIP_GATE(0x80536218, &lit_5283); -#pragma pop - -/* 8053621C-80536220 0000B4 0004+00 0/9 0/0 0/0 .rodata @5284 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5284 = 1.0f / 20.0f; -COMPILER_STRIP_GATE(0x8053621C, &lit_5284); -#pragma pop - -/* 80536220-80536224 0000B8 0004+00 0/2 0/0 0/0 .rodata @5285 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5285 = -10.0f; -COMPILER_STRIP_GATE(0x80536220, &lit_5285); -#pragma pop - -/* 80536224-80536228 0000BC 0004+00 0/4 0/0 0/0 .rodata @5286 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5286 = -1.0f / 10.0f; -COMPILER_STRIP_GATE(0x80536224, &lit_5286); -#pragma pop - -/* 80536228-8053622C 0000C0 0004+00 0/2 0/0 0/0 .rodata @5287 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u32 const lit_5287 = 0x3B03126F; -COMPILER_STRIP_GATE(0x80536228, &lit_5287); -#pragma pop - -/* 8053622C-80536230 0000C4 0004+00 0/3 0/0 0/0 .rodata @5288 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5288 = 1300.0f; -COMPILER_STRIP_GATE(0x8053622C, &lit_5288); -#pragma pop - /* 8052D3BC-8052DAE4 00377C 0728+00 1/1 0/0 0/0 .text ri_swim__FP13mg_fish_class */ -static void ri_swim(mg_fish_class* param_0) { - // NONMATCHING +static void ri_swim(mg_fish_class* i_this) { + cXyz offsetToNext; + + f32 target = 0.0f; + f32 maxStep = 0.01f; + switch (i_this->mActionPhase) { + case 0: + s16 foo = cM_rndFX(8000.0f); + foo += i_this->actor.shape_angle.y + 0x8000; + mDoMtx_YrotS(*calc_mtx, foo); + offsetToNext.x = 0.0f; + offsetToNext.y = 0.0f; + offsetToNext.z = cM_rndF(150.0f) + 300.0f; + MtxPosition(&offsetToNext, &i_this->mNextPos); + i_this->mNextPos += i_this->actor.current.pos; + i_this->mNextPos.y = i_this->actor.home.pos.y; + i_this->mGroundY = get_ground_y(i_this, &i_this->mNextPos); + f32 waterDepth = i_this->mSurfaceY - i_this->mGroundY; + if (waterDepth > 0.0f && + waterDepth < 2000.0f) { + i_this->mNextPos.y = i_this->mGroundY; + i_this->mActionPhase += 1; + } else { + break; + } + i_this->mMaxStep = 0; + case 1: + target = 0.25f; + maxStep = 0.01f; + offsetToNext = i_this->mNextPos - i_this->actor.current.pos; + i_this->mMovementYaw = cM_atan2s(offsetToNext.x, offsetToNext.z); + i_this->mMovementPitch = + -cM_atan2s(offsetToNext.y, JMAFastSqrt(offsetToNext.x * offsetToNext.x + offsetToNext.z * offsetToNext.z)); + offsetToNext.y = 0.0f; + if (offsetToNext.abs() < 100.0f) { + i_this->mActionPhase = 2; + } else { + break; + } + i_this->field_0x624[0] = cM_rndF(200.0f) + 300.0f; + break; + case 2: + cLib_addCalcAngleS2(&i_this->mMovementPitch, 0, 0x20, 0x50); + if (i_this->field_0x624[0] == 0) { + mDoMtx_YrotS(*calc_mtx, cM_rndF(65536.0f)); + offsetToNext.x = 0.0f; + offsetToNext.y = 0.0f; + offsetToNext.z = cM_rndF(150.0f) + 150.0f; + MtxPosition(&offsetToNext, &i_this->mNextPos); + i_this->mNextPos += i_this->actor.home.pos; + i_this->mGroundY = get_ground_y(i_this, &i_this->mNextPos); + f32 waterDepth = i_this->mSurfaceY - i_this->mGroundY; + if (waterDepth > 0.0f && + waterDepth < 2000.0f) { + i_this->mNextPos.y = i_this->mSurfaceY; + i_this->mActionPhase = 3; + i_this->mMaxStep = 0; + } + } + break; + case 3: + target = 0.25f; + offsetToNext = i_this->mNextPos - i_this->actor.current.pos; + i_this->mMovementYaw = cM_atan2s(offsetToNext.x, offsetToNext.z); + i_this->mMovementPitch = -cM_atan2s(offsetToNext.y, + JMAFastSqrt(offsetToNext.x * offsetToNext.x + offsetToNext.z * offsetToNext.z)); + offsetToNext.y = 0.0f; + if (i_this->actor.current.pos.y >= i_this->mSurfaceY + i_this->mJointScale * -30.0f) { + if (offsetToNext.abs() < 100.0f) { + i_this->mActionPhase = 4; + i_this->field_0x624[0] = cM_rndF(50.0f) + 150.0f; + i_this->actor.speedF = 0.0f; + i_this->field_0x5e0 = i_this->actor.speed; + target = 0.0f; + } else { + break; + } + } else { + break; + } + case 4: + cLib_addCalc2(&i_this->actor.current.pos.x, i_this->mNextPos.x, 0.05f, + fabsf(i_this->field_0x5e0.x)); + cLib_addCalc2(&i_this->actor.current.pos.y, + i_this->mSurfaceY + i_this->mJointScale * -10.0f, 0.05f, + fabsf(i_this->field_0x5e0.y)); + cLib_addCalc2(&i_this->actor.current.pos.z, i_this->mNextPos.z, 0.05f, + fabsf(i_this->field_0x5e0.z)); + cLib_addCalcAngleS2(&i_this->mMovementPitch, -0xA00, 0x20, 0x50); + if (i_this->field_0x624[0] == 0) { + i_this->mActionPhase = 5; + i_this->field_0x624[0] = cM_rndF(20.0f) + 50.0f; + } + break; + case 5: + target = -0.1f; + maxStep = 0.002f; + cLib_addCalcAngleS2(&i_this->mMovementPitch, -0xA00, 0x20, 0x50); + if (i_this->field_0x624[0] != 0) { + break; + } + i_this->mActionPhase = 0; + break; + } + cLib_addCalc2(&i_this->actor.speedF, target, 1.0f, maxStep); + cLib_addCalcAngleS2(&i_this->actor.current.angle.y, i_this->mMovementYaw, 8, i_this->mMaxStep); + cLib_addCalcAngleS2(&i_this->actor.current.angle.x, i_this->mMovementPitch, 8, i_this->mMaxStep); + cLib_addCalcAngleS2(&i_this->mMaxStep, 0x300, 1, 0x10); + for (s32 i = 0; i < 3; i++) { + i_this->mJointRotations[i + 3].z = + cM_ssin(i_this->mBobTimer * 1300 + i * 16000) * 1300.0f; + } } -/* ############################################################################################## */ -/* 80536794-805367A0 0002F0 000C+00 1/0 0/0 0/0 .data joint_offset_LM$5310 */ -extern "C" u8 joint_offset_LM[12]; - -/* 805367A0-805367A8 0002FC 0008+00 1/0 0/0 0/0 .data joint_offset_BG$5311 */ -extern "C" u8 joint_offset_BG[8]; - -/* 805367A8-805367C0 000304 0018+00 1/0 0/0 0/0 .data joint_offset_NP$5312 */ -extern "C" u8 joint_offset_NP[24]; - -/* 805367C0-805367D8 00031C 0018+00 1/0 0/0 0/0 .data joint_offset_KS$5313 */ -extern "C" u8 joint_offset_KS[24]; - -/* 805367D8-805367F0 000334 0018+00 1/0 0/0 0/0 .data joint_offset_CF$5314 */ -extern "C" u8 joint_offset_CF[24]; - -/* 805367F0-80536808 00034C 0018+00 1/0 0/0 0/0 .data joint_offset_RI$5315 */ -extern "C" u8 joint_offset_RI[24]; - -/* 80536230-8053625C -00001 002C+00 0/1 0/0 0/0 .rodata @5316 */ -#pragma push -#pragma force_active on -SECTION_RODATA static void* const lit_5316[11] = { - (void*)&joint_offset_LM, (void*)&joint_offset_RI, (void*)&joint_offset_NP, - (void*)&joint_offset_CF, (void*)&joint_offset_KS, (void*)&joint_offset_BG, - (void*)&joint_offset_LM, (void*)&joint_offset_RI, (void*)&joint_offset_NP, - (void*)&joint_offset_CF, (void*)&joint_offset_KS, +struct JointOffsets { + f32 * const offsets[11]; }; -COMPILER_STRIP_GATE(0x80536230, &lit_5316); -#pragma pop - -/* 8053625C-80536260 0000F4 0004+00 0/4 0/0 0/0 .rodata @5379 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5379 = 7.0f; -COMPILER_STRIP_GATE(0x8053625C, &lit_5379); -#pragma pop - -/* 80536260-80536264 0000F8 0004+00 0/6 0/0 0/0 .rodata @5380 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5380 = 3.0f; -COMPILER_STRIP_GATE(0x80536260, &lit_5380); -#pragma pop - -/* 80536264-80536268 0000FC 0004+00 0/1 0/0 0/0 .rodata @5381 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5381 = 2.75f; -COMPILER_STRIP_GATE(0x80536264, &lit_5381); -#pragma pop - -/* 80536268-8053626C 000100 0004+00 0/3 0/0 0/0 .rodata @5382 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5382 = 13.0f / 10.0f; -COMPILER_STRIP_GATE(0x80536268, &lit_5382); -#pragma pop /* 8052DAE4-8052DEB8 003EA4 03D4+00 1/1 0/0 0/0 .text dmcalc__FP13mg_fish_class */ -static void dmcalc(mg_fish_class* param_0) { - // NONMATCHING +static void dmcalc(mg_fish_class* i_this) { + static f32 joint_offset_LM[3] = { 20.0f, 20.0f, 20.0f }; + static f32 joint_offset_BG[2] = { 20.0f, 20.0f }; + static f32 joint_offset_NP[6] = { + 31.0f / 2.0f, 31.0f / 2.0f, 31.0f / 2.0f, + 10.0f, 10.0f, 15.0f, + }; + static f32 joint_offset_KS[6] = { + 31.0f / 2.0f, 31.0f / 2.0f, 10.0f, + 5.0f, 10.0f, 15.0f, + }; + static f32 joint_offset_CF[6] = { + 15.0f, 15.0f, 15.0f, + 15.0f, 15.0f, 15.0f, + }; + static f32 joint_offset_RI[6] = { + 33.0f / 2.0f, 22.0f, 22.0f, + 10.0f, 15.0f, 15.0f, + }; + static const JointOffsets jointOffsets = {{ + joint_offset_LM, joint_offset_RI, joint_offset_NP, + joint_offset_CF, joint_offset_KS, joint_offset_BG, + joint_offset_LM, joint_offset_RI, joint_offset_NP, + joint_offset_CF, joint_offset_KS, + }}; + + s32 i; + s16 pitch; + s16 yaw; + s16 yawOffset; + f32 yawOffsetScalar1; + f32 yawOffsetScalar2; + f32 yawScalar1; + s16 yawScalar2; + cXyz* trans; + csXyz* rots; + f32 mult; + f32 x; + f32 y; + f32 z; + f32 zScalar1; + f32* jointOffset; + cXyz sp20; + cXyz sp14; + cXyz sp08; + + i_this->mJointTranslations[0] = i_this->actor.current.pos; + + trans = i_this->mJointTranslations + 1; + rots = i_this->mJointRotations + 1; + + if (i_this->mGedouKind == GEDOU_KIND_RI_1) { + zScalar1 = 1.0f; + } else { + zScalar1 = 1.5f; + } + + if (i_this->mGedouKind >= GEDOU_KIND_BG) { + zScalar1 = 7.0f; + } else if (i_this->actor.speedF > 0.5f) { + zScalar1 = 3.0f; + } else if (i_this->mCurAction == ACTION_MG_FISH_MF_LURE_SEARCH || + i_this->mCurAction == ACTION_MG_FISH_MF_BAIT_SEARCH) { + if (i_this->mGedouKind == GEDOU_KIND_CF_1) { + zScalar1 = 2.75f; + } else { + zScalar1 = 3.0f; + } + } + if (i_this->field_0x65d != 0) { + i_this->field_0x65d--; + zScalar1 = 30.0f; + } + + mDoMtx_YrotS(*calc_mtx, i_this->actor.shape_angle.y); + mDoMtx_XrotM(*calc_mtx, i_this->actor.shape_angle.x); + mDoMtx_ZrotM(*calc_mtx, i_this->actor.shape_angle.z); + mDoMtx_YrotM(*calc_mtx, i_this->jointYaws2[0]); + + sp20.x = 0.0f; + sp20.y = 0.0f; + sp20.z = -zScalar1 * i_this->mJointScale; + + MtxPosition(&sp20, &sp08); + + yawOffsetScalar1 = 1.0f; + yawOffsetScalar2 = 500.0f * i_this->field_0x5d4; + + JointOffsets jointOffsets2 = jointOffsets; + jointOffset = jointOffsets2.offsets[i_this->mGedouKind]; + + yawScalar1 = 1.3f; + if (i_this->mNumJoints != 4 && i_this->mNumJoints < 6) { + yawScalar1 = 1.5f; + } + + yawScalar2 = 11000; + if (i_this->mNumJoints == 4) { + yawScalar2 = 12000; + } else if (i_this->mNumJoints < 4) { + yawScalar2 = 14000; + } + + mult = 1.0f; + i = 1; + while (i <= i_this->mNumJoints) { + if (i == 1) { + sp20.z = 0.0f; + } else { + sp20.z = i_this->mJointScale * jointOffset[i - 2]; + } + x = trans[0].x - trans[-1].x + sp08.x * mult; + y = trans[0].y - trans[-1].y + sp08.y * mult; + z = trans[0].z - trans[-1].z + sp08.z * mult; + yaw = (s16)cM_atan2s(x, z); + pitch = -cM_atan2s(y, JMAFastSqrt(x * x + z * z)); + yawOffset = cM_ssin(i_this->jointYaws2[1] + i * -yawScalar2) * yawOffsetScalar2 * yawOffsetScalar1; + yaw += yawOffset; + yawOffsetScalar1 *= yawScalar1; + cMtx_YrotS(*calc_mtx, yaw); + cMtx_XrotM(*calc_mtx, pitch); + + MtxPosition(&sp20, &sp14); + trans[0].x = trans[-1].x + sp14.x; + trans[0].y = trans[-1].y + sp14.y; + trans[0].z = trans[-1].z + sp14.z; + rots[0].x = pitch; + rots[0].y = yaw; + + i++; + trans++; + rots++; + } } -/* ############################################################################################## */ -/* 8053626C-80536270 000104 0004+00 0/1 0/0 0/0 .rodata @5632 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5632 = 1.0f / 40.0f; -COMPILER_STRIP_GATE(0x8053626C, &lit_5632); -#pragma pop - -/* 80536270-80536274 000108 0004+00 0/4 0/0 0/0 .rodata @5633 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5633 = 3.0f / 20.0f; -COMPILER_STRIP_GATE(0x80536270, &lit_5633); -#pragma pop - -/* 80536274-80536278 00010C 0004+00 0/7 0/0 0/0 .rodata @5634 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5634 = 15.0f; -COMPILER_STRIP_GATE(0x80536274, &lit_5634); -#pragma pop - -/* 80536278-8053627C 000110 0004+00 0/1 0/0 0/0 .rodata @5635 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5635 = 1.75f; -COMPILER_STRIP_GATE(0x80536278, &lit_5635); -#pragma pop - -/* 8053627C-80536280 000114 0004+00 0/2 0/0 0/0 .rodata @5636 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5636 = 12.0f; -COMPILER_STRIP_GATE(0x8053627C, &lit_5636); -#pragma pop - -/* 80536280-80536284 000118 0004+00 0/6 0/0 0/0 .rodata @5637 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5637 = 3.0f / 5.0f; -COMPILER_STRIP_GATE(0x80536280, &lit_5637); -#pragma pop - -/* 80536284-80536288 00011C 0004+00 0/2 0/0 0/0 .rodata @5638 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5638 = 25.0f; -COMPILER_STRIP_GATE(0x80536284, &lit_5638); -#pragma pop - -/* 80536288-8053628C 000120 0004+00 0/5 0/0 0/0 .rodata @5639 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5639 = 2.5f; -COMPILER_STRIP_GATE(0x80536288, &lit_5639); -#pragma pop - -/* 8053628C-80536290 000124 0004+00 0/1 0/0 0/0 .rodata @5640 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5640 = -3.0f / 20.0f; -COMPILER_STRIP_GATE(0x8053628C, &lit_5640); -#pragma pop - /* 8052DEB8-8052EAA0 004278 0BE8+00 1/1 0/0 0/0 .text mf_lure_search__FP13mg_fish_class */ -static void mf_lure_search(mg_fish_class* param_0) { - // NONMATCHING -} +static void mf_lure_search(mg_fish_class* i_this) { + s32 foundLure = false; -/* ############################################################################################## */ -/* 80536290-80536294 000128 0004+00 0/5 0/0 0/0 .rodata @5781 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5781 = 7.0f / 10.0f; -COMPILER_STRIP_GATE(0x80536290, &lit_5781); -#pragma pop + dmg_rod_class* rod = (dmg_rod_class*)fopAcM_SearchByID(i_this->mRodId); + if (rod == NULL || rod->field_0x1008 != 0) { + foundLure = true; + } else if (rod->field_0x100a != 0 || rod->field_0x100d == 0) { + foundLure = true; + } else if (rod->field_0xf7e != 4) { + if (rod->field_0xf7e >= 5 && + rod->mFishId == fopAcM_GetID(i_this)) { + foundLure = false; + } else { + foundLure = true; + } + } + + if (foundLure) { + i_this->mActionPhase = 100; + } + + i_this->mMaxStep = 0x800; + f32 target = 0.0f; + f32 maxStep = 0.1f; + s16 sVar10 = 0; + cXyz rodSep; + switch (i_this->mActionPhase) { + case 0: + i_this->field_0x624[0] = 0; + i_this->mActionPhase++; + i_this->field_0x5f8 = 0; + case 1: + i_this->mActionPhase = 2; + case 2: { + rodSep = rod->current.pos - i_this->actor.current.pos; + rodSep.y -= 10.0f; + i_this->mMovementYaw = cM_atan2s(rodSep.x, rodSep.z); + i_this->mMovementPitch = -cM_atan2s(rodSep.y, JMAFastSqrt(rodSep.x * rodSep.x + rodSep.z * rodSep.z)); + if (i_this->mMovementPitch < -0x2000) { + i_this->mMovementPitch = -0x2000; + } + f32 rodDist = sqrtf(VECSquareMag(&rodSep)); + if (rod->field_0xf80 != 4 && rod->field_0xf80 != 2 && + rodDist > 2.0f * i_this->field_0x5ec) { + foundLure = true; + } else { + if (rodDist > 100.0f) { + target = 1.5f; + i_this->field_0x624[0] = cM_rndF(100.0f); + i_this->field_0x624[1] = cM_rndF(200.0f) + 100.0f; + if (i_this->mGedouKind == GEDOU_KIND_NP_1 || i_this->mGedouKind == GEDOU_KIND_LM_1) { + if (rod->field_0x14f0 != 0) { + target = 2.0f; + } + f32 fVar11; + if (i_this->mGedouKind == GEDOU_KIND_NP_1) { + fVar11 = 0.1f; + } else { + fVar11 = 0.025f; + } + if (rodDist < 1.3f * i_this->field_0x5ec && + (rod->field_0xf80 == 4 || rod->field_0xf80 == 3) && + rod->field_0x14f0 != 0 && + (i_this->mBobTimer & 0x1f) == 0 && + cM_rndF(1.0f) < fVar11) { + sVar10 = 0x5a; + } + } + } else { + if (rodDist < 50.0f) { + target = -0.1f; + i_this->field_0x624[0] = cM_rndF(30.0f) + 10.0f; + } else { + if (i_this->field_0x624[0] == 0) { + if (rod->field_0x1009 != 0) { + i_this->field_0x624[0] = cM_rndF(30.0f) + 10.0f; + i_this->field_0x624[1] = cM_rndF(200.0f) + 100.0f; + } + } else if (i_this->field_0x624[0] == 1) { + f32 limit1 = 0.15f; + f32 limit2 = 0.3f; + + i_this->field_0x5f8++; + + if (i_this->mGedouKind == GEDOU_KIND_CF_1) { + limit1 *= 2.0f; + limit2 *= 2.0f; + } else if (i_this->mGedouKind == GEDOU_KIND_RI_1 && + rod->field_0xf80 != 0 && + i_this->field_0x5f8 < 10) { + limit1 = limit2 = -1.0f; + } + + dScnKy_env_light_c* envlight = dKy_getEnvlight(); + s32 iVar6 = (s32)(envlight->daytime / 15.0f); + if (iVar6 < 8 || iVar6 > 16) { + limit1 *= 1.5f; + limit2 *= 1.5f; + } + + if (envlight->raincnt > 10) { + limit1 *= 1.75f; + limit2 *= 1.75f; + } + + if (l_HIO.field_0x18 != 0 || rod->field_0x10a4 != 0) { + limit1 = limit2 = 1.0f; + } + + if ((rod->field_0x1009 != 0 && cM_rndF(1.0f) < limit2) || + cM_rndF(1.0f) < limit1) { + sVar10 = 0x3c; + } + } + } + } + } + + if (sVar10 != 0) { + i_this->mActionPhase = 3; + i_this->field_0x624[2] = sVar10; + } + + cLib_addCalc2(&i_this->actor.current.pos.y, rod->current.pos.y - 20.0f, + 0.05f, 2.0f); + + if (i_this->field_0x624[1] == 1) { + i_this->mActionPhase = 5; + i_this->field_0x624[0] = cM_rndF(20.0f) + 10.0f; + if (i_this->field_0x624[2] == 0) { + break; + } + } + break; + } + case 3: { + if (i_this->field_0x624[2] == 0) { + foundLure = true; + break; + } + + rodSep = rod->current.pos - i_this->actor.current.pos; + i_this->mMovementYaw = cM_atan2s(rodSep.x, rodSep.z); + i_this->mMovementPitch = -cM_atan2s(rodSep.y, JMAFastSqrt(rodSep.x * rodSep.x + rodSep.z * rodSep.z)); + + target = 3.0f; + if (rod->field_0x14f0 != 0) { + target = 5.0f; + } + + maxStep = 1.0f; + + f32 rodDist = sqrtf(VECSquareMag(&rodSep)); + if (rodDist < i_this->mJointScale * 150.0f) { + mouth_open(i_this); + } + + if (rodDist < i_this->mJointScale * 40.0f) { + if (i_this->mGedouKind == GEDOU_KIND_CF_1) { + if (rod->field_0xf80 == 4) { + i_this->mRemainingHookTime = cM_rndF(10.0f) + 20.0f; + } else { + i_this->mRemainingHookTime = cM_rndF(12.0f) + 30.0f; + } + } else if (rod->field_0xf80 == 4) { + if (i_this->mJointScale >= 0.6f) { + if (sVar10 != 0) { + i_this->mActionPhase = 3; + i_this->field_0x624[2] = sVar10; + } + i_this->mRemainingHookTime = cM_rndF(5.0f) + 10.0f; + } else if (i_this->mJointScale >= 0.5f) { + i_this->mRemainingHookTime = cM_rndF(7.0f) + 15.0f; + } else { + i_this->mRemainingHookTime = cM_rndF(10.0f) + 20.0f; + } + } else if (i_this->mJointScale >= 0.6f) { + i_this->mRemainingHookTime = cM_rndF(10.0f) + 15.0f; + } else { + i_this->mRemainingHookTime = cM_rndF(10.0f) + 25.0f; + } + } else { + break; + } + + if (rod->field_0xf80 == 0) { + i_this->mRemainingHookTime = cM_rndF(10.0f) + 40.0f; + } + + rod->field_0xf7e = 5; + rod->field_0x10a5 = 2; + rod->mFishId = fopAcM_GetID(i_this); + rod->field_0x1006 = cM_rndFX(7000.0f) + 1000.0f; + i_this->mHookedState = 1; + i_this->mMovementYaw = cM_rndFX(65536.0f); + i_this->mMovementPitch = 0x2000; + i_this->mMaxStep = 0x1000; + i_this->mActionPhase = 4; + mouth_close(i_this); + + if (rod->current.pos.y > i_this->mSurfaceY - 15.0f) { + sibuki_set(i_this, 2.5f, i_this->field_0x638); + if (i_this->mGedouKind == GEDOU_KIND_RI_1) { + i_this->mSound.startCreatureSound(Z2SE_AL_DOJOU_EAT_IMPACT, 0, -1); + } else { + i_this->mSound.startCreatureSound(Z2SE_AL_FISH_RELEASE, 0, -1); + } + } + + rod->field_0x1410 = 0.0f; + dKy_Sound_set(i_this->actor.current.pos, 40.0f * i_this->mJointScale, + fopAcM_GetID(i_this), 5); + rod->field_0x10ab = 5; + rod->field_0x10aa = 3; + + break; + } + case 4: { + rod->field_0x10a5 = 2; + target = 2.5f; + maxStep = 0.5f; + i_this->mHookedState = 2; + if (i_this->mRemainingHookTime == 0) { + if (rod->field_0xf80 != 4) { + rod->field_0x10a6 = 30; + if (rod->field_0x10a7 != 4) { + rod->field_0x10a7 = 1; + } + } + i_this->mCurAction = ACTION_MG_FISH_MF_AWAY; + i_this->mActionPhase = -1; + return; + } + break; + } + case 5: { + target = -0.15f; + maxStep = 0.01f; + if (i_this->field_0x624[0] == 0) { + foundLure = true; + } + break; + } + case 0x64: // ??? + default: + break; + } + + cLib_addCalc2(&i_this->actor.speedF, target, 1.0f, maxStep); + cLib_addCalcAngleS2(&i_this->actor.current.angle.y, i_this->mMovementYaw, 2, i_this->mMaxStep); + cLib_addCalcAngleS2(&i_this->actor.current.angle.x, i_this->mMovementPitch, 2, i_this->mMaxStep); + + if (foundLure) { + i_this->mCurAction = ACTION_MG_FISH_MF_STAY; + i_this->mActionPhase = 0; + i_this->field_0x624[0] = 0; + i_this->field_0x62e = cM_rndF(1000.0f) + 2000.0f; + mouth_close(i_this); + } +} /* 8052EAA0-8052F120 004E60 0680+00 1/1 0/0 0/0 .text mf_bait_search__FP13mg_fish_class */ -static void mf_bait_search(mg_fish_class* param_0) { - // NONMATCHING +static void mf_bait_search(mg_fish_class* i_this) { + s32 foundBait = false; + dmg_rod_class* rod = (dmg_rod_class*)fopAcM_SearchByID(i_this->mBaitId); + if (rod == NULL) { + i_this->mActionPhase = 100; + foundBait = true; + } + i_this->mMaxStep = 0x800; + f32 targetSpeed = 0.0f; + f32 speedMaxStep = 0.1f; + cXyz offsetToRod; + switch (i_this->mActionPhase) { + case 0: { + i_this->field_0x624[0] = 0; + i_this->mActionPhase++; + } + case 1: { + i_this->mActionPhase = 2; + } + case 2: { + offsetToRod = rod->current.pos - i_this->actor.current.pos; + offsetToRod.y = offsetToRod.y - 10.0f; + i_this->mMovementYaw = cM_atan2s(offsetToRod.x, offsetToRod.z); + i_this->mMovementPitch = -cM_atan2s(offsetToRod.y, + JMAFastSqrt(offsetToRod.x * offsetToRod.x + offsetToRod.z * offsetToRod.z)); + if (i_this->mMovementPitch < -0x2000) { + i_this->mMovementPitch = -0x2000; + } + f32 fVar5 = offsetToRod.abs(); + if (fVar5 > 2.0f * i_this->field_0x5ec) { + foundBait = true; + } else if (fVar5 > 100.0f) { + targetSpeed = 0.7f; + speedMaxStep = 0.05f; + i_this->field_0x624[0] = cM_rndF(100.0f); + } else if (fVar5 < 50.0f) { + targetSpeed = -0.1f; + } else if (i_this->field_0x624[0] == 0) { + i_this->field_0x624[0] = cM_rndF(30.0f) + 10.0f; + } else if (i_this->field_0x624[0] == 1 && cM_rndF(1.0f) < 0.5f) { + i_this->mActionPhase = 3; + i_this->field_0x624[3] = 7; + i_this->field_0x624[2] = 0x3c; + } + cLib_addCalc2(&i_this->actor.current.pos.y, rod->current.pos.y - 20.0f, + 0.05f, 2.0f); + break; + } + case 3: { + if (i_this->field_0x624[2] == 0) { + foundBait = 1; + break; + } + + offsetToRod = rod->current.pos - i_this->actor.current.pos; + i_this->mMovementYaw = cM_atan2s(offsetToRod.x, offsetToRod.z); + i_this->mMovementPitch = -cM_atan2s(offsetToRod.y, + JMAFastSqrt(offsetToRod.x * offsetToRod.x + offsetToRod.z * offsetToRod.z)); + targetSpeed = 3.0f; + speedMaxStep = 1.0f; + f32 fVar10 = offsetToRod.abs(); + if (fVar10 < 40.0f * i_this->mJointScale) { + rod->field_0x5a4.field_0x2e = 0x32; + rod->field_0x5a4.field_0x30 = 0; + rod->field_0x5a4.field_0x54 = fopAcM_GetID(i_this); + fVar10 = cM_rndFX(65536.0f); + i_this->mMovementYaw = fVar10; + i_this->mMovementPitch = 0x2000; + i_this->mMaxStep = 0x1000; + i_this->mActionPhase = 4; + mouth_close(i_this); + sibuki_set(i_this, 2.5f, i_this->field_0x638); + i_this->mSound.startCreatureSound(Z2SE_CM_BODYFALL_WATER_S, 0, -1); + dKy_Sound_set(i_this->actor.current.pos, 40.0f * i_this->mJointScale, + fopAcM_GetID(i_this), 5); + i_this->field_0x624[0] = cM_rndF(10.0f) + 10.0f; + } + break; + } + case 4: { + targetSpeed = 1.5f; + speedMaxStep = 0.2f; + if (i_this->field_0x624[0] == 0) { + foundBait = true; + } + } + } + + cLib_addCalc2(&i_this->actor.speedF, targetSpeed, 1.0f, speedMaxStep); + cLib_addCalcAngleS2(&i_this->actor.current.angle.y, + i_this->mMovementYaw, 2, i_this->mMaxStep); + cLib_addCalcAngleS2(&i_this->actor.current.angle.x, + i_this->mMovementPitch, 2, i_this->mMaxStep); + if (foundBait) { + i_this->mCurAction = ACTION_MG_FISH_MF_STAY; + i_this->mActionPhase = 0; + i_this->field_0x624[0] = 0; + targetSpeed = cM_rndF(100.0f); + i_this->field_0x62e = targetSpeed + 300.0f; + mouth_close(i_this); + } } -/* ############################################################################################## */ -/* 80536294-80536298 00012C 0004+00 0/6 0/0 0/0 .rodata @5957 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5957 = 4.0f / 5.0f; -COMPILER_STRIP_GATE(0x80536294, &lit_5957); -#pragma pop - -/* 80536298-8053629C 000130 0004+00 0/3 0/0 0/0 .rodata @5958 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5958 = 7.0f / 20.0f; -COMPILER_STRIP_GATE(0x80536298, &lit_5958); -#pragma pop - -/* 8053629C-805362A0 000134 0004+00 0/1 0/0 0/0 .rodata @5959 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5959 = 11.0f / 20.0f; -COMPILER_STRIP_GATE(0x8053629C, &lit_5959); -#pragma pop - -/* 805362A0-805362A4 000138 0004+00 0/1 0/0 0/0 .rodata @5960 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5960 = 13.0f; -COMPILER_STRIP_GATE(0x805362A0, &lit_5960); -#pragma pop - -/* 805362A4-805362A8 00013C 0004+00 0/1 0/0 0/0 .rodata @5961 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5961 = 13.0f / 20.0f; -COMPILER_STRIP_GATE(0x805362A4, &lit_5961); -#pragma pop - -/* 805362A8-805362AC 000140 0004+00 0/1 0/0 0/0 .rodata @5962 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5962 = 45.0f; -COMPILER_STRIP_GATE(0x805362A8, &lit_5962); -#pragma pop - -/* 805362AC-805362B0 000144 0004+00 0/2 0/0 0/0 .rodata @5963 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5963 = 11.0f; -COMPILER_STRIP_GATE(0x805362AC, &lit_5963); -#pragma pop - -/* 805362B0-805362B4 000148 0004+00 0/1 0/0 0/0 .rodata @5964 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5964 = 9.0f; -COMPILER_STRIP_GATE(0x805362B0, &lit_5964); -#pragma pop - -/* 805362B4-805362B8 00014C 0004+00 0/2 0/0 0/0 .rodata @5965 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5965 = 8.0f; -COMPILER_STRIP_GATE(0x805362B4, &lit_5965); -#pragma pop - -/* 805362B8-805362BC 000150 0004+00 0/2 0/0 0/0 .rodata @5966 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5966 = 6.0f; -COMPILER_STRIP_GATE(0x805362B8, &lit_5966); -#pragma pop - -/* 805362BC-805362C0 000154 0004+00 0/1 0/0 0/0 .rodata @5967 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5967 = 90.0f; -COMPILER_STRIP_GATE(0x805362BC, &lit_5967); -#pragma pop - -/* 805362C0-805362C4 000158 0004+00 0/5 0/0 0/0 .rodata @5968 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5968 = 4000.0f; -COMPILER_STRIP_GATE(0x805362C0, &lit_5968); -#pragma pop - /* 8052F120-8052FA4C 0054E0 092C+00 1/1 0/0 0/0 .text mf_hit__FP13mg_fish_class */ -static void mf_hit(mg_fish_class* param_0) { - // NONMATCHING +static void mf_hit(mg_fish_class* i_this) { + dmg_rod_class* pvVar5 = (dmg_rod_class*)fopAcM_SearchByID(i_this->mRodId); + if (pvVar5 == NULL) { + i_this->mCurAction = ACTION_MG_FISH_MF_STAY; + i_this->mActionPhase = 0; + i_this->field_0x62e = cM_rndF(1000.0f) + 2000.0f; + return; + } + + i_this->mHookedState = 2; + pvVar5->field_0x10a5 = 2; + + s32 iVar1 = 0; + s32 didCatch = false; + cXyz commonXyz; + switch (i_this->mActionPhase) { + case 0: { + i_this->field_0x624[1] = cM_rndF(100.0f) + 100.0f; + i_this->mActionPhase = 1; + i_this->field_0x65b = 0; + } + case 1: { + cMtx_YrotS(*calc_mtx, i_this->mYawToPlayer + 0x8000 + (s16)cM_rndFX(10000.0f)); + commonXyz.x = 0.0f; + commonXyz.y = 0.0f; + commonXyz.z = cM_rndF(150.0f) + 200.0f; + MtxPosition(&commonXyz, &i_this->mNextPos); + i_this->mNextPos += i_this->actor.current.pos; + i_this->mGroundY = get_ground_y(i_this, &i_this->mNextPos); + if (i_this->mSurfaceY - i_this->mGroundY > 0.0f && i_this->mSurfaceY - i_this->mGroundY < 2000.0f) { + if (i_this->mGedouKind == GEDOU_KIND_CF_1 || i_this->mGedouKind == GEDOU_KIND_RI_1) { + i_this->mNextPos.y = i_this->mGroundY + + (i_this->mSurfaceY - i_this->mGroundY) * + (cM_rndF(0.2f) + 0.1f); + } else { + i_this->mNextPos.y = i_this->mGroundY + + (i_this->mSurfaceY - i_this->mGroundY) * + (cM_rndF(0.8f) + 0.1f); + } + i_this->field_0x624[0] = cM_rndF(40.0f) + 10.0f; + dKy_Sound_set(i_this->actor.current.pos, 30.0f * i_this->mJointScale, + fopAcM_GetID(i_this), 5); + i_this->mActionPhase = 2; + if (i_this->field_0x624[1] == 0 && + i_this->mDistToPlayer > 400.0f && + i_this->field_0x660 > 0.6f) + { + f32 threshold = -1.0f; + if (i_this->mGedouKind == GEDOU_KIND_LM_1) { + if (i_this->mJointScale >= 0.6f) { + threshold = 0.5f; + } else { + threshold = 0.25f; + } + } else if (i_this->mGedouKind == GEDOU_KIND_NP_1 || i_this->mGedouKind == GEDOU_KIND_KS_1) { + threshold = 0.35f; + } else if (i_this->mGedouKind == GEDOU_KIND_RI_1) { + threshold = 0.1f; + } + if (cM_rndF(1.0f) < threshold) { + i_this->mCurAction = ACTION_MG_FISH_MF_JUMP; + i_this->mActionPhase = 0; + mouth_open(i_this); + } + } + } else { + break; + } + } + case 2: { + commonXyz = i_this->mNextPos - i_this->actor.current.pos; + i_this->mMovementYaw = cM_atan2s(commonXyz.x, commonXyz.z); + i_this->mMovementPitch = -cM_atan2s(commonXyz.y, + JMAFastSqrt(commonXyz.x * commonXyz.x + commonXyz.z * commonXyz.z)); + if (i_this->field_0x624[0] == 0) { + i_this->mActionPhase = 1; + } + if (cM_ssin(i_this->jointYaws2[1]) > 0.8f) { + hit_vib_set(i_this); + } + break; + } + } + cLib_addCalc2(&i_this->actor.speedF, 1.5f, 1.0f, 0.5f); + i_this->mMaxStep = 0x800; + cLib_addCalcAngleS2(&i_this->actor.current.angle.y, i_this->mMovementYaw, 2, i_this->mMaxStep); + cLib_addCalcAngleS2(&i_this->actor.current.angle.x, i_this->mMovementPitch, 2, i_this->mMaxStep); + if (l_HIO.field_0x19 != 0) { + didCatch = true; + } + if (i_this->mDistToPlayer < 200.0f && + i_this->actor.current.pos.y > i_this->mSurfaceY - 50.0f * i_this->mJointScale) + { + if ((mDoCPd_c::m_cpadInfo[0].mPressedButtonFlags & 0x100) != 0) { + i_this->field_0x624[4] = 60; + } + if (i_this->field_0x624[4] == 0) { + if (i_this->mKind2 == 3) { + i_this->field_0x624[4] = cM_rndF(20.0f) + 50.0f; + i_this->field_0x624[2] = cM_rndF(15.0f) + 15.0f; + } else { + f32 jointScale = i_this->mJointScale; + if (i_this->mKind2 == 2) { + jointScale -= 0.15f; + } + if (jointScale < 0.5f) { + i_this->field_0x624[4] = cM_rndF(20.0f) + 50.0f; + i_this->field_0x624[2] = cM_rndF(15.0f) + 15.0f; + } else if (jointScale < 0.55f) { + i_this->field_0x624[4] = cM_rndF(30.0f) + 40.0f; + i_this->field_0x624[2] = cM_rndF(15.0f) + 13.0f; + } else if (jointScale < 0.6f) { + i_this->field_0x624[4] = cM_rndF(40.0f) + 30.0f; + i_this->field_0x624[2] = cM_rndF(10.0f) + 12.0f; + } else if (jointScale < 0.65f) { + i_this->field_0x624[4] = cM_rndF(45.0f) + 30.0f; + i_this->field_0x624[2] = cM_rndF(9.0f) + 11.0f; + } else if (jointScale < 0.65f) { + i_this->field_0x624[4] = cM_rndF(50.0f) + 30.0f; + i_this->field_0x624[2] = cM_rndF(8.0f) + 10.0f; + } else if (jointScale < 0.7f) { + i_this->field_0x624[4] = cM_rndF(50.0f) + 40.0f; + i_this->field_0x624[2] = cM_rndF(7.0f) + 9.0f; + } else { + i_this->field_0x624[4] = cM_rndF(50.0f) + 50.0f; + i_this->field_0x624[2] = cM_rndF(6.0f) + 8.0f; + } + } + } + i_this->field_0x65b++; + if (i_this->field_0x65b == 200) { + iVar1 = 2; + pvVar5->field_0xf5c = 0.5f; + } else if (i_this->field_0x624[2] != 0) { + pvVar5->field_0x100f = 1; + if ((mDoCPd_c::m_cpadInfo[0].mPressedButtonFlags & 0x100) != 0) { + didCatch = true; + } + } + } else { + if (pvVar5->field_0x14f0 == 0 || + pvVar5->field_0x1515 == 0 || + pvVar5->field_0xf60 < 100.0f) + { + i_this->field_0x65c++; + } else { + i_this->field_0x65c = 0; + } + if (i_this->field_0x65c == 90) { + iVar1 = 1; + } + } + if (didCatch) { + i_this->mCurAction = ACTION_MG_FISH_MF_CATCH; + i_this->mActionPhase = 0; + g_dComIfG_gameInfo.play.mVibration.StartShock(4, 1, cXyz(0.0f, 1.0f, 0.0f)); + Z2AudioMgr::getInterface()->changeBgmStatus(4); + pvVar5->field_0xf7e = 6; + pvVar5->field_0x13b4 = 10; + pvVar5->field_0x13b6 = 0; + pvVar5->field_0x14c2 = 0; + pvVar5->field_0x1408 = 90.0f; + pvVar5->field_0x146d = 0; + pvVar5->field_0x10b0 = 0; + daPy_py_c* player = daPy_getLinkPlayerActorClass(); + player->onFishingRodGetFish(); + if (pvVar5->field_0xf80 == 4) { + u8 bVar7 = g_dComIfG_gameInfo.info.mSavedata.mEvent.getEventReg(0xf11f); + if (bVar7 < 0x1f) { + bVar7++; + } + g_dComIfG_gameInfo.info.mSavedata.mEvent.setEventReg(0xf11f, bVar7); + } + } else if (iVar1 != 0) { + if (iVar1 == 2) { + pvVar5->field_0x10a7 = 3; + pvVar5->field_0x57e = cM_rndF(13.0f) + 30.0f; + pvVar5->field_0x10a6 = 1; + } else { + pvVar5->field_0x10a7 = 2; + pvVar5->field_0x10a6 = 0x19; + pvVar5->field_0x57e = 0; + } + i_this->mCurAction = ACTION_MG_FISH_MF_AWAY; + i_this->mActionPhase = -1; + i_this->mHookedState = 0; + i_this->field_0x62e = cM_rndF(1500.0f) + 4000.0f; + } } -/* ############################################################################################## */ -/* 805362C4-805362C8 00015C 0004+00 0/1 0/0 0/0 .rodata @6132 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6132 = 16384.0f; -COMPILER_STRIP_GATE(0x805362C4, &lit_6132); -#pragma pop - -/* 805362C8-805362CC 000160 0004+00 0/1 0/0 0/0 .rodata @6133 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6133 = 384.0f; -COMPILER_STRIP_GATE(0x805362C8, &lit_6133); -#pragma pop - -/* 805362CC-805362D0 000164 0004+00 0/1 0/0 0/0 .rodata @6134 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6134 = 23.0f; -COMPILER_STRIP_GATE(0x805362CC, &lit_6134); -#pragma pop - -/* 805362D0-805362D4 000168 0004+00 0/1 0/0 0/0 .rodata @6135 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6135 = -0.5f; -COMPILER_STRIP_GATE(0x805362D0, &lit_6135); -#pragma pop - -/* 805362D4-805362D8 00016C 0004+00 0/1 0/0 0/0 .rodata @6136 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6136 = 13000.0f; -COMPILER_STRIP_GATE(0x805362D4, &lit_6136); -#pragma pop - /* 8052FA4C-8053036C 005E0C 0920+00 1/1 0/0 0/0 .text mf_jump__FP13mg_fish_class */ -static void mf_jump(mg_fish_class* param_0) { - // NONMATCHING +static void mf_jump(mg_fish_class* i_this) { + cXyz commonXyz1; + cXyz commonXyz2; + + dmg_rod_class* rod = (dmg_rod_class*)fopAcM_SearchByID(i_this->mRodId); + if (i_this->mActionPhase < 10) { + if (rod == NULL) { + i_this->mCurAction = ACTION_MG_FISH_MF_STAY; + i_this->mActionPhase = 0; + return; + } + if (i_this->field_0x65a == 0) { + i_this->mHookedState = 2; + rod->field_0x10a5 = 2; + i_this->field_0x62e = cM_rndF(1500.0f) + 4000.0f; + } + } + i_this->mMaxStep = 0x800; + switch (i_this->mActionPhase) { + case 0: { + i_this->mMovementPitch = (s16)cM_rndFX(2000.0f) + -0x2800; + i_this->mMovementYaw = i_this->mYawToPlayer + 0x8000 + (s16)cM_rndFX(16384.0f); + i_this->mActionPhase = 1; + } + case 1: { + i_this->actor.speedF = 1.5f; + if (cM_ssin(i_this->mBobTimer * 7000) > 0.8f) { + hit_vib_set(i_this); + } + if (i_this->actor.current.pos.y > i_this->mSurfaceY) { + i_this->actor.speedF = 0.0f; + i_this->field_0x5e0 = i_this->actor.speed; + i_this->field_0x5e0.y = 15.0f; + i_this->jointYaws2[2] = cM_rndFX(1000.0f); + i_this->jointYaws2[3] = cM_rndF(384.0f); + i_this->mActionPhase = 2; + i_this->field_0x624[0] = cM_rndF(10.0f) + 23.0f; + sibuki_set(i_this, 2.0f, i_this->field_0x638); + i_this->mSound.startCreatureSound(Z2SE_AL_FISH_JUMP_UP, 0, -1); + } else { + break; + } + } + case 2: { + rod->field_0x100f = 2; + if (i_this->field_0x65a == 0 && (i_this->mBobTimer & 0xf) == 0) { + hit_vib_set(i_this); + } + i_this->actor.current.angle.z = i_this->actor.current.angle.z + i_this->jointYaws2[2]; + i_this->actor.shape_angle.z = i_this->actor.current.angle.z; + i_this->mMovementPitch = i_this->mMovementPitch + i_this->jointYaws2[3]; + if (i_this->field_0x624[0] == 1 && rod->mRodStickY <= -0.5f && cM_rndF(1.0f) < 0.35f) { + i_this->field_0x65a = 1; + i_this->mHookedState = 0; + } + i_this->actor.current.pos += i_this->field_0x5e0; + for (s32 i = 0; i <= i_this->mNumJoints; i++) { + i_this->mJointTranslations[i] += i_this->field_0x5e0; + } + i_this->field_0x5e0.y = i_this->field_0x5e0.y - 1.0f; + if (i_this->field_0x65a != 0) { + rod->field_0x10a6 = 0x19; + rod->field_0x10a7 = 0; + } + if (i_this->field_0x5e0.y < 0.0f && i_this->actor.current.pos.y < i_this->mSurfaceY) { + if (i_this->field_0x65a != 0) { + i_this->mCurAction = ACTION_MG_FISH_MF_AWAY; + i_this->mActionPhase = -1; + } else { + i_this->mCurAction = ACTION_MG_FISH_MF_HIT; + i_this->mActionPhase = 1; + } + i_this->field_0x624[1] = 30; + sibuki_set(i_this, 2.5f, i_this->field_0x638); + i_this->mSound.startCreatureSound(Z2SE_AL_FISH_JUMP_DOWN, 0, -1); + i_this->actor.speedF = 0.5f; + i_this->mMovementPitch = 0; + i_this->actor.current.angle.z = 0; + i_this->field_0x65d = 5; + mouth_close(i_this); + } + break; + } + case 10: { + if (i_this->mGedouKind == GEDOU_KIND_KS_2) { + i_this->mBaitId = fopAcM_createChild(PROC_KYTAG03, fopAcM_GetID(i_this), 0x10000b3, + &commonXyz2, fopAcM_GetRoomNo(&i_this->actor), NULL, NULL, -1, 0); + } + i_this->mActionPhase = 0xb; + } + case 11: { + daPy_py_c::setLookPos(&i_this->actor.current.pos); + if (i_this->mGedouKind == GEDOU_KIND_KS_2) { + fopAc_ac_c* actor = fopAcM_SearchByID(i_this->mBaitId); + if (actor != NULL) { + actor->current.pos = i_this->actor.current.pos; + } + } + i_this->field_0x659 = 0; + i_this->mHookedState = 0; + if (rod != NULL) { + rod->field_0x10a5 = 0; + } + i_this->mMaxStep = 0x600; + i_this->actor.current.pos += i_this->field_0x5e0; + i_this->field_0x5e0.y = i_this->field_0x5e0.y - 2.0f; + if ((i_this->mAcch.m_flags & 0x20) != 0) { + i_this->actor.current.pos.x = i_this->actor.old.pos.x; + i_this->actor.current.pos.y = i_this->actor.old.pos.y; + i_this->actor.current.pos.z = i_this->actor.old.pos.z; + mDoMtx_YrotS(*calc_mtx, i_this->field_0x5f6); + + if (i_this->field_0x624[2] == 0) { + commonXyz1.x = cM_rndFX(3.0f); + commonXyz1.z = cM_rndFX(2.0f) + 6.0f; + } else { + commonXyz1.x = cM_rndFX(3.0f); + commonXyz1.z = cM_rndFX(3.0f); + } + commonXyz1.y = cM_rndF(5.0f) + 10.0f; + MtxPosition(&commonXyz1, &i_this->field_0x5e0); + + if (i_this->actor.shape_angle.z < 0) { + i_this->actor.shape_angle.z = -0x4000; + } else { + i_this->actor.shape_angle.z = 0x4000; + } + + if (cM_rndF(1.0f) < 0.5f) { + i_this->actor.current.angle.z = 0x4000; + } else { + i_this->actor.current.angle.z = -0x4000; + } + + i_this->mMovementYaw = i_this->mMovementYaw + (s16)cM_rndFX(13000.0f); + + fopAcM_effSmokeSet1(&i_this->field_0xc34, &i_this->field_0xc38, &i_this->actor.current.pos, + NULL, 0.6f * i_this->mJointScale, &i_this->actor.tevStr, 1); + + Z2AudioMgr::getInterface()->seStart(Z2SE_OBJ_NIOIMASU_BOUND, (Vec*)&i_this->actor.current, + 0x14, 0,1.0f, 1.0f, + -1.0f, -1.0f, 0); + } + cLib_addCalcAngleS2(&i_this->actor.shape_angle.z, i_this->actor.current.angle.z, 2, 0xb00); + if (i_this->field_0x5e0.y < 0.0f && i_this->actor.current.pos.y < i_this->mSurfaceY) { + sibuki_set(i_this, 2.0f, i_this->field_0x638); + i_this->mSound.startCreatureSound(Z2SE_AL_FISH_JUMP_DOWN, 0, -1); + i_this->mCurAction = ACTION_MG_FISH_MF_AWAY; + i_this->mActionPhase = -1; + i_this->actor.current.angle.z = 0; + if (i_this->mGedouKind == GEDOU_KIND_KS_2) { + fopAc_ac_c* actor = fopAcM_SearchByID(i_this->mBaitId); + if (actor != NULL) { + fopAcM_delete(actor); + } + } + mDoMtx_YrotS(*calc_mtx, i_this->mYawToPlayer); + commonXyz1.x = 0.0f; + commonXyz1.y = 0.0f; + commonXyz1.z = 100.0f; + MtxPosition(&commonXyz1, &commonXyz2); + commonXyz2.x += i_this->actor.current.pos.x; + commonXyz2.z += i_this->actor.current.pos.z; + commonXyz2.y = 10.0f + i_this->mSurfaceY; + fopAcM_createItem(&commonXyz2, 0, -1, -1, NULL, NULL, 0); + g_dComIfG_gameInfo.info.mSavedata.mEvent.onEventBit( + dSv_event_flag_c::saveBitLabels[0x1d6]); + } + break; + } + } + cLib_addCalcAngleS2(&i_this->actor.current.angle.y, i_this->mMovementYaw, 2, i_this->mMaxStep); + cLib_addCalcAngleS2(&i_this->actor.current.angle.x, i_this->mMovementPitch, 2, i_this->mMaxStep); + + s16 sVar1 = 7000; + if (i_this->mJointScale >= 0.7f) { + sVar1 = 5000; + } else if (i_this->mJointScale >= 0.6f) { + sVar1 = 6000; + } else if (i_this->mJointScale >= 0.5f) { + sVar1 = 6500; + } + + s32 numJoints; + for (s32 i = 0; i <= i_this->mNumJoints; i++) { + numJoints = i_this->mNumJoints; + if (numJoints <= 4) { + i_this->jointYaws1[i] = + cM_ssin(i_this->mBobTimer * sVar1 + -8500 * i) * 7000.0f; + } else { + i_this->jointYaws1[i] = + cM_ssin(i_this->mBobTimer * (sVar1 - 500) + -7000 * i) * 4000.0f; + } + } } /* 8053036C-8053055C 00672C 01F0+00 2/2 0/0 0/0 .text pota_set__FP13mg_fish_class */ -static void pota_set(mg_fish_class* param_0) { - // NONMATCHING -} +static void pota_set(mg_fish_class* i_this) { + static u16 b_id[3] = { + 0x873A, + 0x873B, + 0x873C, + }; + static u16 h_id[11] = { + 0x8738, + 0x8739, + 0x8739, + 0x8737, + 0x8739, + 0x8736, + 0x8738, + 0x8739, + 0x8739, + 0x8737, + 0x8739, + }; + static u32 h_jnt[11] = { + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 2, + 2, + 2, + 2, + }; -/* ############################################################################################## */ -/* 805362D8-805362DC 000170 0004+00 0/3 0/0 0/0 .rodata @6293 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6293 = 3000.0f; -COMPILER_STRIP_GATE(0x805362D8, &lit_6293); -#pragma pop + if (i_this->mCaughtType == 1) { + for (s32 i = 0; i < 3; i++) { + u32 uVar2 = dComIfGp_particle_set(i_this->mEmitterIds[i], + b_id[i], &i_this->actor.current.pos, NULL, NULL); + i_this->mEmitterIds[i] = uVar2; + JPABaseEmitter* emitter = dComIfGp_particle_getEmitter(i_this->mEmitterIds[i]); + if (emitter != NULL) { + mg_fish_class* found = (mg_fish_class*)fpcEx_Search(s_bt_sub, i_this); + if (found != NULL) { + emitter->setGlobalSRTMatrix(found->mpModel[0]->getBaseTRMtx()); + } + } + } + } else { + u32 uVar2 = dComIfGp_particle_set(i_this->mEmitterIds[0], + h_id[i_this->mGedouKind], &i_this->actor.current.pos, NULL, NULL); + i_this->mEmitterIds[0] = uVar2; + JPABaseEmitter* emitter = dComIfGp_particle_getEmitter(i_this->mEmitterIds[0]); + if (emitter != NULL) { + emitter->setGlobalSRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(h_jnt[i_this->mGedouKind])); + } + } +} /* 8053055C-80530924 00691C 03C8+00 1/1 0/0 0/0 .text mf_catch__FP13mg_fish_class */ -static void mf_catch(mg_fish_class* param_0) { - // NONMATCHING +static void mf_catch(mg_fish_class* i_this) { + daAlink_c* player = g_dComIfG_gameInfo.play.mPlayer[0]; + if (i_this->actor.health == 2) { + fopAcM_delete(&i_this->actor); + return; + } + dmg_rod_class* rod = (dmg_rod_class*)fopAcM_SearchByID(i_this->mRodId); + rod->field_0x10a5 = 0; + i_this->mHookedState = 2; + i_this->actor.speed.set(0.0f, 0.0f, 0.0f); + i_this->actor.speedF = 0.0f; + switch (i_this->mActionPhase) { + case 0: { + i_this->mActionPhase = 1; + mouth_open(i_this); + i_this->field_0x624[0] = 100; + i_this->field_0x740 = 0.0f; + i_this->actor.health = 0; + } + case 1: { + if (i_this->field_0x624[0] == 70) { + i_this->mSound.startCreatureSound(Z2SE_AL_FISH_CATCH, 0, -1); + i_this->field_0x624[1] = 50; + sibuki_set(i_this, 1.5f, i_this->field_0x638); + } + if (i_this->field_0x624[0] == 80) { + i_this->field_0x740 = cM_rndF(2000.0f) + 4000.0f; + } + if (i_this->field_0x624[0] == 0 && i_this->actor.health == 1) { + i_this->actor.health = 0; + i_this->mActionPhase = 2; + i_this->field_0x624[0] = 1; + } + i_this->actor.current.angle.x = -0x4000; + break; + } + case 2: { + if (i_this->field_0x624[0] == 0) { + i_this->mActionPhase = 3; + i_this->field_0x624[0] = 40; + player->onFishingRelease(); + rod->health = 1; + rod->field_0x13b4 = 11; + rod->field_0x13b6 = 0; + rod->field_0x146d = 0; + i_this->field_0x740 = cM_rndF(1000.0f) + 3000.0f; + } + break; + } + case 3: { + i_this->mHookedState = 0; + if (i_this->field_0x624[0] <= 25) { + cXyz local_24 = i_this->actor.current.pos; + local_24.y = i_this->mSurfaceY; + fopAcM_effHamonSet(&i_this->field_0xc20, &local_24, + 0.5f, 0.1f); + } + if (i_this->field_0x624[0] <= 15) { + cLib_addCalcAngleS2(&i_this->actor.current.angle.x, 0, 8, 0x800); + } + if (i_this->field_0x624[0] == 0) { + i_this->mCurAction = ACTION_MG_FISH_MF_AWAY; + i_this->mActionPhase = -1; + mouth_close(i_this); + sibuki_set(i_this, 1.3f, i_this->field_0x638); + i_this->mSound.startCreatureSound(Z2SE_AL_FISH_RELEASE, 0, -1); + i_this->field_0x624[1] = 0; + i_this->field_0x65d = 5; + i_this->field_0x62e = cM_rndF(1500.0f) + 4000.0f; + } + break; + } + default: + break; + } + + i_this->actor.current.angle.y = 26000 + + (s16)(daPy_getLinkPlayerActorClass()->shape_angle.y + + daPy_getLinkPlayerActorClass()->mBodyAngle.y); + int iVar1 = i_this->field_0x740 * cM_ssin(i_this->mBobTimer * 2000); + cLib_addCalc2(&i_this->field_0x740, + 200.0f, 0.05f, 100.0f); + + for (s32 i = 0; i <= i_this->mNumJoints; i++) { + if (i == 0) { + i_this->jointYaws1[i] = 0; + } else { + i_this->jointYaws1[i] = iVar1; + } + } + + if (i_this->field_0x624[1] != 0) { + pota_set(i_this); + } } -/* ############################################################################################## */ -/* 805362DC-805362E0 000174 0004+00 0/1 0/0 0/0 .rodata @6455 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6455 = 80.0f; -COMPILER_STRIP_GATE(0x805362DC, &lit_6455); -#pragma pop - -/* 805362E0-805362E4 000178 0004+00 0/1 0/0 0/0 .rodata @6456 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u32 const lit_6456 = 0xBB03126F; -COMPILER_STRIP_GATE(0x805362E0, &lit_6456); -#pragma pop - -/* 805362E4-805362E8 00017C 0004+00 0/1 0/0 0/0 .rodata @6457 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6457 = -1.0f / 5.0f; -COMPILER_STRIP_GATE(0x805362E4, &lit_6457); -#pragma pop - -/* 805362E8-805362EC 000180 0004+00 0/1 0/0 0/0 .rodata @6458 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6458 = 14.0f; -COMPILER_STRIP_GATE(0x805362E8, &lit_6458); -#pragma pop - -/* 805362EC-805362F0 000184 0004+00 0/1 0/0 0/0 .rodata @6459 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6459 = 32768.0f; -COMPILER_STRIP_GATE(0x805362EC, &lit_6459); -#pragma pop - /* 80530924-8053109C 006CE4 0778+00 1/1 0/0 0/0 .text mf_esa_search__FP13mg_fish_class */ -static void mf_esa_search(mg_fish_class* param_0) { - // NONMATCHING +static void mf_esa_search(mg_fish_class* i_this) { + s32 flag1 = 0; + s32 flag2 = 0; + + fopAc_ac_c* rod_actor = (fopAc_ac_c*)fopAcM_SearchByID(i_this->mRodId); + dmg_rod_class* rod = (dmg_rod_class*)rod_actor; + + if (rod_actor == NULL) { + flag1 = 1; + } else if (rod->field_0x100d == 0) { + flag1 = 1; + } else if (rod->field_0xf7e == 5) { + flag1 = 1; + } + if (flag1) { + i_this->mCurAction = ACTION_MG_FISH_MF_SWIM_S; + i_this->mActionPhase = 0; + i_this->field_0x62e = cM_rndF(100.0f) + 300.0f; + mouth_close(i_this); + i_this->field_0x659 = 0; + return; + } + i_this->mMaxStep = 0x800; + f32 fVar9 = 0.0f; + switch (i_this->mActionPhase) { + case 0: { + i_this->field_0x624[0] = 0; + i_this->mActionPhase++; + } + case 1: { + i_this->mActionPhase = 2; + } + case 2: { + cXyz xyz = rod->current.pos - i_this->actor.current.pos; + i_this->mMovementYaw = cM_atan2s(xyz.x, xyz.z); + i_this->mMovementPitch = -cM_atan2s(xyz.y, + JMAFastSqrt(xyz.x * xyz.x + xyz.z * xyz.z)); + f32 distFromRod = sqrtf(VECSquareMag(&xyz)); + if (distFromRod > i_this->field_0x5ec + 100.0f) { + flag2 = 1; + } else if (distFromRod > i_this->mJointScale * 80.0f) { + fVar9 = 1.5f; + } else { + if (distFromRod < i_this->mJointScale * 50.0f) { + fVar9 = -0.002f - (i_this->mJointScale * 50.0f - distFromRod) * 0.1f; + if (fVar9 < -0.2f) { + fVar9 = -0.2f; + } + } else if (i_this->field_0x5ec > 10000.0f || + ((i_this->mBobTimer & 0x3f) == 0 && cM_rndF(1.0f) > 0.5f)) { + i_this->actor.speedF = 1.0f; + fVar9 = i_this->actor.speedF; + i_this->field_0x624[0] = 0; + i_this->field_0x654 = -(cM_rndF(0.5f) + 0.2f); + } + } + + xyz = i_this->field_0x638 - rod->current.pos; + if (sqrtf(VECSquareMag(&xyz)) < i_this->mJointScale * 14.0f) { + fVar9 = i_this->field_0x654; + i_this->mMaxStep = 0; + if (i_this->field_0x624[0] == 0) { + rod->mFishId = fopAcM_GetID(i_this); + f32 fVar10 = 0.5f; + if (dComIfGs_getFishNum(5) <= 5) { + fVar10 = 1.5f; + } + if (i_this->mGedouKind != GEDOU_KIND_BG) { + if (rod->field_0x102d == 1) { + fVar10 = 1.0f; + } + if (rod->field_0x102c == 1) { + fVar10 *= 1.5f; + } else if (rod->field_0x102c == 2) { + fVar10 *= 2.0f; + } + } + if (fVar10 > 2.5f) { + fVar10 = 2.5f; + } + if (cM_rndF(1.0f) < fVar10 * 0.35f || + i_this->field_0x5ec > 10000.0f) { + i_this->mActionPhase = 3; + i_this->mMovementPitch = i_this->mMovementPitch + 0x2000; + i_this->mMovementYaw += (s16)cM_rndFX(32768.0f); + rod->field_0x10a5 = fVar10 * (cM_rndF(20.0f) + 15.0f); + i_this->field_0x659 = rod->field_0x10a5; + } else { + rod->field_0x10a5 = fVar10 * (cM_rndF(15.0f) + 15.0f); + i_this->field_0x659 = rod->field_0x10a5; + i_this->field_0x650 = 0.0f; + if (rod->field_0x102d == 0 && rod->field_0x102c == 0) { + i_this->field_0x624[0] = cM_rndF(80.0f) + 50.0f; + } else { + i_this->field_0x624[0] = cM_rndF(20.0f) + 30.0f; + } + } + } + } + if (i_this->field_0x659 == 0) { + cLib_addCalc2(&i_this->actor.current.pos.y, rod->current.pos.y, 0.05f, 2.0f); + } else { + cLib_addCalc2(&i_this->actor.current.pos.y, rod->current.pos.y - 20.0f, 0.05f, 2.0f); + } + break; + } + case 3: { + fVar9 = 1.5f; + i_this->mMaxStep = 0x1000; + cLib_addCalc2(&rod->field_0x1090, 0.5f, 1.0f, 0.2f); + if (i_this->field_0x659 == 0) { + flag2 = 1; + } + break; + } + } + + cLib_addCalc2(&i_this->actor.speedF, fVar9, 1.0f, 0.1f); + cLib_addCalcAngleS2(&i_this->actor.current.angle.y, i_this->mMovementYaw, 2, i_this->mMaxStep); + cLib_addCalcAngleS2(&i_this->actor.current.angle.x, i_this->mMovementPitch, 2, i_this->mMaxStep); + if (i_this->field_0x5ec > 10000.0f) { + cLib_addCalc2(&i_this->actor.current.pos.x, rod->current.pos.x, 0.1f, 50.0f); + cLib_addCalc2(&i_this->actor.current.pos.z, rod->current.pos.z, 0.1f, 50.0f); + } + if (flag2) { + i_this->mCurAction = ACTION_MG_FISH_MF_SWIM_S; + i_this->mActionPhase = 0; + i_this->field_0x62e = cM_rndF(30.0f) + 30.0f; + mouth_close(i_this); + } } /* 8053109C-805313D8 00745C 033C+00 1/1 0/0 0/0 .text mf_esa_hit__FP13mg_fish_class */ -static void mf_esa_hit(mg_fish_class* param_0) { - // NONMATCHING +static void mf_esa_hit(mg_fish_class* i_this) { + dmg_rod_class* rod = (dmg_rod_class*)fopAcM_SearchByID(i_this->mRodId); + if (rod == NULL || (rod != NULL && rod->field_0xf7e != 5)) { + i_this->mCurAction = ACTION_MG_FISH_MF_SWIM_S; + i_this->mActionPhase = 0; + i_this->field_0x62e = cM_rndF(100.0f) + 100.0f; + return; + } + + i_this->field_0x659 = 2; + rod->field_0x10a5 = 2; + i_this->field_0x62e = 500; + + cXyz commonXyz; + switch (i_this->mActionPhase) { + case 0: + i_this->mActionPhase = 1; + case 1: + mDoMtx_YrotS(*calc_mtx, i_this->mYawToPlayer + 0x8000 + (s16)cM_rndFX(10000.0f)); + commonXyz.x = 0.0f; + commonXyz.y = 0.0f; + commonXyz.z = cM_rndF(150.0f) + 200.0f; + MtxPosition(&commonXyz, &i_this->mNextPos); + i_this->mNextPos += i_this->actor.current.pos; + + i_this->mGroundY = get_ground_y(i_this, &i_this->mNextPos); + if (i_this->mSurfaceY - i_this->mGroundY > 300.0f) { + i_this->mGroundY = i_this->mSurfaceY - 300.0f; + } + + if (i_this->mSurfaceY - i_this->mGroundY > 0.0f && + i_this->mSurfaceY - i_this->mGroundY < 2000.0f) { + i_this->mNextPos.y = i_this->mGroundY + (i_this->mSurfaceY - i_this->mGroundY) * + (cM_rndF(0.2f) + 0.1f); + i_this->field_0x624[0] = cM_rndF(40.0f) + 10.0f; + dKy_Sound_set(i_this->actor.current.pos, (s32)(30.0f * i_this->mJointScale), + fopAcM_GetID(i_this), 5); + i_this->mActionPhase = 2; + } else { + break; + } + case 2: + commonXyz = i_this->mNextPos - i_this->actor.current.pos; + i_this->mMovementYaw = cM_atan2s(commonXyz.x, commonXyz.z); + i_this->mMovementPitch = + -cM_atan2s(commonXyz.y, + JMAFastSqrt(commonXyz.x * commonXyz.x + commonXyz.z * commonXyz.z)); + if (i_this->field_0x624[0] == 0) { + i_this->mActionPhase = 1; + } + if (cM_ssin(i_this->jointYaws2[1]) > 0.8f) + { + hit_vib_set(i_this); + } + } + + cLib_addCalc2(&i_this->actor.speedF, 1.5f, 1.0f, + 0.5f); + i_this->mMaxStep = 0x800; + cLib_addCalcAngleS2(&i_this->actor.current.angle.y, i_this->mMovementYaw, 2, i_this->mMaxStep); + cLib_addCalcAngleS2(&i_this->actor.current.angle.x, i_this->mMovementPitch, 2, i_this->mMaxStep); } -/* ############################################################################################## */ -/* 805362F0-805362F4 000188 0004+00 0/1 0/0 0/0 .rodata @6648 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6648 = 5000.0f; -COMPILER_STRIP_GATE(0x805362F0, &lit_6648); -#pragma pop - -/* 805362F4-805362F8 00018C 0004+00 0/1 0/0 0/0 .rodata @6649 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6649 = 700.0f; -COMPILER_STRIP_GATE(0x805362F4, &lit_6649); -#pragma pop - -/* 805362F8-805362FC 000190 0004+00 0/3 0/0 0/0 .rodata @6650 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6650 = 180.0f; -COMPILER_STRIP_GATE(0x805362F8, &lit_6650); -#pragma pop - -/* 805362FC-80536300 000194 0004+00 0/1 0/0 0/0 .rodata @6651 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6651 = 160.0f; -COMPILER_STRIP_GATE(0x805362FC, &lit_6651); -#pragma pop - -/* 80536300-80536304 000198 0004+00 0/1 0/0 0/0 .rodata @6652 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6652 = 58.0f; -COMPILER_STRIP_GATE(0x80536300, &lit_6652); -#pragma pop - -/* 80536304-80536308 00019C 0004+00 0/1 0/0 0/0 .rodata @6653 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u32 const lit_6653 = 0x3BA3D70A; -COMPILER_STRIP_GATE(0x80536304, &lit_6653); -#pragma pop - /* 805313D8-8053198C 007798 05B4+00 1/1 0/0 0/0 .text mf_esa_catch__FP13mg_fish_class */ -static void mf_esa_catch(mg_fish_class* param_0) { - // NONMATCHING +static s32 mf_esa_catch(mg_fish_class* i_this) { + daAlink_c* player = g_dComIfG_gameInfo.play.mPlayer[0]; + dmg_rod_class* rod = (dmg_rod_class*)fopAcM_SearchByID(i_this->mRodId); + + if (rod == NULL) { + i_this->mCurAction = ACTION_MG_FISH_MF_SWIM_S; + i_this->mActionPhase = 0; + i_this->field_0x62e = cM_rndF(100.0f) + 100.0f; + return 1; + } + + cXyz position; + s32 flag = 1; + + i_this->field_0x659 = 2; + rod->field_0x10a5 = 2; + + switch (i_this->mActionPhase) { + case 0: { + if (i_this->mCaughtType == 4 || i_this->mCaughtType == 5) { + i_this->field_0x740 = 3000.0f; + } else { + if (i_this->mGedouKind == GEDOU_KIND_BG) { + i_this->field_0x740 = cM_rndF(1000.0f) + 8000.0f; + } else if (i_this->mGedouKind == GEDOU_KIND_CF_2) { + i_this->field_0x740 = cM_rndF(500.0f) + 4000.0f; + } else if (i_this->mGedouKind == GEDOU_KIND_NP_2) { + i_this->field_0x740 = cM_rndF(500.0f) + 4000.0f; + } else { + i_this->field_0x740 = cM_rndF(700.0f) + 5000.0f; + } + } + i_this->actor.current.angle.x = -0x3e00; + i_this->field_0x748 = 0.3f; + if (i_this->field_0x624[0] != 0) { + break; + } + position = i_this->actor.current.pos; + position.y = i_this->mSurfaceY; + fopKyM_createWpillar(&position, 0.7f, 0); + Z2AudioMgr::getInterface()->changeFishingBgm(4); + i_this->mActionPhase = 1; + i_this->mBobAmp = 50.0f; + i_this->mSound.startCreatureSound(Z2SE_AL_FISH_CATCH, 0, -1); + if (i_this->mCaughtType == 1) { + i_this->mSound.startCreatureSound(Z2SE_AL_FISHING_BOOTS_GET, 0, -1); + } + i_this->field_0x624[1] = 65; + i_this->field_0x624[2] = 20; + } + case 1: { + if (i_this->field_0x624[2] != 0) { + flag = 0; + } + mDoMtx_YrotS(*calc_mtx, player->shape_angle.y + (s16)(cM_ssin(i_this->mBobTimer * 800) * 1500.0f)); + position.x = 0.0f; + if (i_this->mCaughtType == 2) { + position.y = i_this->mBobAmp * cM_ssin(i_this->mBobTimer * 2000) + 180.0f; + } else { + position.y = i_this->mBobAmp * cM_ssin(i_this->mBobTimer * 2000) + 160.0f; + } + position.z = 58.0f; + cXyz local_3c; + MtxPosition(&position, &local_3c); + local_3c += player->current.pos; + cLib_addCalc2((float*)&i_this->actor.current, local_3c.x, 0.1f, 15.0f); + cLib_addCalc2(&i_this->actor.current.pos.y, local_3c.y, 0.1f, 15.0f); + cLib_addCalc2(&i_this->actor.current.pos.z, local_3c.z, 0.1f, 15.0f); + i_this->actor.current.angle.y = + i_this->actor.current.angle.y + i_this->jointYaws2[2]; + if (i_this->mCaughtType == 2) { + if (g_Counter.mTimer & 0x80) { + cLib_addCalcAngleS2(&i_this->jointYaws2[2], 1000, 4, 0x28); + } else { + cLib_addCalcAngleS2(&i_this->jointYaws2[2], -1000, 4, 0x28); + } + } else if (i_this->mCaughtType >= 7) { + if (g_Counter.mTimer & 0x100) { + cLib_addCalcAngleS2(&i_this->jointYaws2[2], 200, 4, 8); + } else { + cLib_addCalcAngleS2(&i_this->jointYaws2[2], -200, 4, 8); + } + } else if (i_this->mBobTimer & 0x100) { + cLib_addCalcAngleS2(&i_this->jointYaws2[2], 200, 8, 4); + } else { + cLib_addCalcAngleS2(&i_this->jointYaws2[2], -200, 8, 4); + } + i_this->actor.current.angle.x = -0x3e00; + } + } + if (i_this->mCaughtType != 0) { + if (i_this->mCaughtType == 3) { + i_this->field_0x74c = i_this->field_0x748 * cM_ssin(i_this->mBobTimer * 2000); + cLib_addCalc2(&i_this->field_0x748, 0.05f, 0.1f, 0.005f); + } else if (i_this->mCaughtType == 4 || i_this->mCaughtType == 5) { + cLib_addCalc2(&i_this->field_0x740, 500.0f, 0.05f, 100.0f); + } + } else { + f32 target = 1500.0f; + s32 jointYaw = 5000; + if (i_this->mGedouKind == GEDOU_KIND_CF_2) { + target = 300.0f; + jointYaw = 2500; + } else if (i_this->mGedouKind != GEDOU_KIND_BG) { + target = 500.0f; + jointYaw = 3000; + } + jointYaw = i_this->field_0x740 * cM_ssin(i_this->mBobTimer * jointYaw); + cLib_addCalc2(&i_this->field_0x740, target, 0.05f, 100.0f); + for (s32 i = 0; i <= i_this->mNumJoints; i++) { + if (i == 0) { + i_this->jointYaws1[i] = 0; + } else { + i_this->jointYaws1[i] = jointYaw; + } + } + } + cLib_addCalc2(&i_this->mBobAmp, 5.0f, 0.05f, 1.0f); + i_this->actor.speedF = 0.0f; + if (i_this->field_0x624[1] != 0) { + pota_set(i_this); + } + return flag; } -/* ############################################################################################## */ -/* 80536308-8053630C 0001A0 0004+00 0/4 0/0 0/0 .rodata @6722 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6722 = 70.0f; -COMPILER_STRIP_GATE(0x80536308, &lit_6722); -#pragma pop - -/* 8053630C-80536310 0001A4 0004+00 0/1 0/0 0/0 .rodata @6723 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6723 = 190.0f; -COMPILER_STRIP_GATE(0x8053630C, &lit_6723); -#pragma pop - -/* 80536310-80536314 0001A8 0004+00 0/4 0/0 0/0 .rodata @6724 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6724 = -720.0f; -COMPILER_STRIP_GATE(0x80536310, &lit_6724); -#pragma pop - -/* 80536314-80536318 0001AC 0004+00 0/1 0/0 0/0 .rodata @6725 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u32 const lit_6725 = 0x3B83126F; -COMPILER_STRIP_GATE(0x80536314, &lit_6725); -#pragma pop - /* 8053198C-80531CD4 007D4C 0348+00 1/1 0/0 0/0 .text mf_aqua__FP13mg_fish_class */ -static void mf_aqua(mg_fish_class* param_0) { - // NONMATCHING +static void mf_aqua(mg_fish_class* i_this) { + f32 targetSpeed = 0.0f; + switch (i_this->mActionPhase) { + case 0: + i_this->mNextPos.z = cM_rndFX(190.0f) + 70.0f; + i_this->mNextPos.x = cM_rndFX(30.0f) + -720.0f; + i_this->mNextPos.y = cM_rndF(100.0f) + 70.0f; + i_this->mActionPhase = 1; + i_this->field_0x624[0] = cM_rndF(100.0f) + 100.0f; + i_this->mMaxStep = 0; + case 1: + targetSpeed = 0.4f; + cXyz local_44 = i_this->mNextPos - i_this->actor.current.pos; + i_this->mMovementYaw = cM_atan2s(local_44.x, local_44.z); + f32 fVar7 = JMAFastSqrt(local_44.x * local_44.x + local_44.z * local_44.z); + i_this->mMovementPitch = -cM_atan2s(local_44.y, fVar7); + if (i_this->mMovementPitch > 0xc00) { + i_this->mMovementPitch = 0xc00; + } else if (i_this->mMovementPitch < -0xc00) { + i_this->mMovementPitch = -0xc00; + } + if (i_this->field_0x624[0] == 0 || sqrtf(VECSquareMag(&local_44)) < 50.0f) { + if (cM_rndF(1.0f) < 0.2f && i_this->mGedouKind != GEDOU_KIND_BG) { + i_this->mActionPhase = 2; + i_this->field_0x624[0] = cM_rndF(100.0f) + 70.0f; + } else { + i_this->mActionPhase = 0; + } + } + break; + case 2: + cLib_addCalcAngleS2(&i_this->mMovementPitch, 0, 0x10, 100); + if (i_this->field_0x624[0] == 0) { + i_this->mActionPhase = 0; + } + } + + cLib_addCalc2(&i_this->actor.speedF, targetSpeed, 0.05f, 0.004f); + cLib_addCalcAngleS2(&i_this->actor.current.angle.y, i_this->mMovementYaw, 8, i_this->mMaxStep); + cLib_addCalcAngleS2(&i_this->actor.current.angle.x, i_this->mMovementPitch, 8, i_this->mMaxStep); + cLib_addCalcAngleS2(&i_this->mMaxStep, 0x400, 1, 0x20); } -/* ############################################################################################## */ -/* 80536318-8053631C 0001B0 0004+00 0/1 0/0 0/0 .rodata @6847 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6847 = 120.0f; -COMPILER_STRIP_GATE(0x80536318, &lit_6847); -#pragma pop - -/* 8053631C-80536320 0001B4 0004+00 0/1 0/0 0/0 .rodata @6848 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6848 = 140.0f; -COMPILER_STRIP_GATE(0x8053631C, &lit_6848); -#pragma pop - -/* 80536320-80536324 0001B8 0004+00 0/1 0/0 0/0 .rodata @6849 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6849 = 220.0f; -COMPILER_STRIP_GATE(0x80536320, &lit_6849); -#pragma pop /* 80531CD4-805322E0 008094 060C+00 1/1 0/0 0/0 .text ri_aqua__FP13mg_fish_class */ -static void ri_aqua(mg_fish_class* param_0) { - // NONMATCHING -} +// NONMATCHING - equivalent, but missing fmr instruction +static void ri_aqua(mg_fish_class* i_this) { + // Two different vectors in Debug, but this messes up the stack for GZ2E01. + // cXyz commonXyz2; + cXyz commonXyz; + f32 targetSpeed = 0.0f; + f32 speedMaxStep = NREG_F(0) + 0.01f; + switch (i_this->mActionPhase) { + case 0: { + if (i_this->actor.current.pos.z < 70.0f) { + i_this->mNextPos.z = 120.0f + cM_rndF(140.0f); + } else { + i_this->mNextPos.z = 70.0f - (cM_rndF(140.0f) + 50.0f); + } + i_this->mNextPos.x = cM_rndFX(30.0f) + -720.0f; + commonXyz.x = -30.0f - i_this->mNextPos.z; + commonXyz.z = 220.0f - i_this->mNextPos.z; + if (fabsf(commonXyz.x) < 70.0f || fabsf(commonXyz.z) < 50.0f) { + i_this->mNextPos.y = i_this->mGroundY + (15.0f + hREG_F(7)); + } else { + i_this->mNextPos.y = i_this->mGroundY + hREG_F(6); + } + i_this->mActionPhase++; + i_this->mMaxStep = 0; + } + case 1: { + targetSpeed = NREG_F(1) + 0.25f; + speedMaxStep = NREG_F(2) + 0.01f; + commonXyz = i_this->mNextPos - i_this->actor.current.pos; + i_this->mMovementYaw = cM_atan2s(commonXyz.x, commonXyz.z); + i_this->mMovementPitch = -cM_atan2s( + commonXyz.y, JMAFastSqrt(commonXyz.x * commonXyz.x + commonXyz.z * commonXyz.z)); + if (i_this->actor.current.pos.y < i_this->mNextPos.y + (15.0f + hREG_F(8))) { + i_this->mActionPhase = 2; + i_this->field_0x624[0] = cM_rndF(500.0f) + 1000.0f; + } -/* ############################################################################################## */ -/* 80536324-80536328 0001BC 0004+00 0/1 0/0 0/0 .rodata @6893 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6893 = 6.0f / 5.0f; -COMPILER_STRIP_GATE(0x80536324, &lit_6893); -#pragma pop + break; + } + case 2: { + cLib_addCalcAngleS2(&i_this->mMovementPitch, 0, 0x20, 0x50); + if (i_this->field_0x624[0] == 0) { + if (i_this->actor.current.pos.z < 70.0f) { + i_this->mNextPos.z = cM_rndF(150.0f) + 120.0f; + } else { + i_this->mNextPos.z = 70.0f - (cM_rndF(150.0f) + 50.0f); + } + i_this->mNextPos.x = cM_rndFX(30.0f) + -720.0f; + i_this->mNextPos.y = i_this->mSurfaceY; + i_this->mActionPhase = 3; + i_this->mMaxStep = 0; + } + break; + } + case 3: + targetSpeed = NREG_F(1) + 0.25f; + speedMaxStep = NREG_F(1) + 0.01f; + commonXyz = i_this->mNextPos - i_this->actor.current.pos; + i_this->mMovementYaw = cM_atan2s(commonXyz.x, commonXyz.z); + i_this->mMovementPitch = -cM_atan2s( + commonXyz.y, JMAFastSqrt(commonXyz.x * commonXyz.x + commonXyz.z * commonXyz.z)); + commonXyz.y = 0.0f; + if (i_this->actor.current.pos.y >= + i_this->mSurfaceY + (KREG_F(15) + -30.0f) * i_this->mJointScale && + commonXyz.abs() < 100.0f) { + i_this->mActionPhase = 4; + i_this->field_0x624[0] = cM_rndF(50.0f) + 150.0f; + i_this->actor.speedF = 0.0f; + i_this->field_0x5e0 = i_this->actor.speed; + targetSpeed = 0.0f; + } else { + break; + } + case 4: + cLib_addCalc2(&i_this->actor.current.pos.x, i_this->mNextPos.x, 0.05f, + fabsf(i_this->field_0x5e0.x)); + cLib_addCalc2(&i_this->actor.current.pos.y, + i_this->mSurfaceY + (KREG_F(11) + -10.0f) * i_this->mJointScale, 0.05f, + fabsf(i_this->field_0x5e0.y)); + cLib_addCalc2(&i_this->actor.current.pos.z, i_this->mNextPos.z, 0.05f, + fabsf(i_this->field_0x5e0.z)); + cLib_addCalcAngleS2(&i_this->mMovementPitch, -0xa00, 0x20, 0x50); + if (i_this->field_0x624[0] == 0) { + i_this->mActionPhase = 5; + i_this->field_0x624[0] = cM_rndF(20.0f) + 50.0f; + } + + break; + case 5: { + targetSpeed = TREG_F(4) + -0.1f; + speedMaxStep = 0.002f; + cLib_addCalcAngleS2(&i_this->mMovementPitch, -0xa00, 0x20, 0x50); + if (i_this->field_0x624[0] == 0) { + i_this->mActionPhase = 0; + } + + break; + } + default: + break; + } + + cLib_addCalc2(&i_this->actor.speedF, targetSpeed, 0.1f, speedMaxStep); + cLib_addCalcAngleS2(&i_this->actor.current.angle.y, i_this->mMovementYaw, 8, i_this->mMaxStep); + cLib_addCalcAngleS2(&i_this->actor.current.angle.x, i_this->mMovementPitch, 8, i_this->mMaxStep); + cLib_addCalcAngleS2(&i_this->mMaxStep, 0x300, 1, 0x10); + for (s32 i = 0; i < 3; i++) { + i_this->mJointRotations[i + 3].z = + cM_ssin(i_this->mBobTimer * (YREG_S(0) + 1300) + i * (YREG_S(1) + 16000)) * + (YREG_F(2) + 1300.0f); + } +} /* 805322E0-805324D8 0086A0 01F8+00 1/1 0/0 0/0 .text mf_aqua_tilt__FP13mg_fish_class */ -static void mf_aqua_tilt(mg_fish_class* param_0) { - // NONMATCHING +static void mf_aqua_tilt(mg_fish_class* i_this) { + float targetSpeed = 0.0f; + + switch (i_this->mActionPhase) { + case 0: { + i_this->mNextPos.z = cM_rndFX(180.0f) + 70.0f; + i_this->mNextPos.x = cM_rndFX(30.0f) + -720.0f; + i_this->mNextPos.y = cM_rndF(100.0f) + 70.0f; + i_this->mActionPhase = 1; + i_this->field_0x624[0] = cM_rndF(20.0f) + 20.0f; + } + case 1: { + targetSpeed = 1.2f; + cXyz movement = i_this->mNextPos - i_this->actor.current.pos; + + i_this->mMovementYaw = cM_atan2s(movement.x, movement.z); + i_this->mMovementPitch = -cM_atan2s(movement.y, + JMAFastSqrt(movement.x * movement.x + movement.z * movement.z)); + + if (i_this->mMovementPitch > 0xc00) { + i_this->mMovementPitch = 0xc00; + } else if (i_this->mMovementPitch < -0xc00) { + i_this->mMovementPitch = 0xf400; + } + + if (i_this->field_0x624[0] == 0) { + i_this->mActionPhase = 0; + } + break; + } + default: + break; + } + + cLib_addCalc2(&i_this->actor.speedF, targetSpeed, 0.8f, 0.6f); + cLib_addCalcAngleS2(&i_this->actor.current.angle.y, + i_this->mMovementYaw, 4, i_this->mMaxStep); + cLib_addCalcAngleS2(&i_this->actor.current.angle.x, + i_this->mMovementPitch, 4, i_this->mMaxStep); + cLib_addCalcAngleS2(&i_this->mMaxStep, 0x800, 1, 0x100); + if (i_this->field_0x624[1] == 0) { + if (i_this->mGedouKind == GEDOU_KIND_RI_1) { + i_this->mCurAction = ACTION_MG_FISH_RI_AQUA; + } else { + i_this->mCurAction = ACTION_MG_FISH_MF_AQUA; + } + i_this->mActionPhase = 0; + } } -/* ############################################################################################## */ -/* 80536328-8053632C 0001C0 0004+00 0/1 0/0 0/0 .rodata @7221 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_7221 = 4500.0f; -COMPILER_STRIP_GATE(0x80536328, &lit_7221); -#pragma pop - -/* 8053632C-80536330 0001C4 0004+00 0/1 0/0 0/0 .rodata @7222 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_7222 = 27.0f / 10.0f; -COMPILER_STRIP_GATE(0x8053632C, &lit_7222); -#pragma pop - -/* 80536438-80536438 0002D0 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80536438 = "F_SP127"; -#pragma pop - /* 805324D8-80533268 008898 0D90+00 2/1 0/0 0/0 .text action__FP13mg_fish_class */ -static void action(mg_fish_class* param_0) { - // NONMATCHING +static void action(mg_fish_class* i_this) { + i_this->mDistToPlayer = fopAcM_searchPlayerDistanceXZ(&i_this->actor); + const char* stageName = dComIfGp_getStartStageName(); + if (strcmp(stageName, "F_SP127") == 0) { + if (i_this->mCurAction == ACTION_MG_FISH_MF_SWIM_S) { + if (i_this->mDistToPlayer > 2000.0f) { + return; + } + } else if (i_this->mCurAction == ACTION_MG_FISH_MF_STAY) { + if (i_this->mGedouKind == GEDOU_KIND_RI_1) { + i_this->mCurAction = ACTION_MG_FISH_RI_SWIM; + i_this->mActionPhase = 0; + } else if (i_this->mGedouKind == GEDOU_KIND_CF_1) { + i_this->mCurAction = ACTION_MG_FISH_MF_SWIM_P; + i_this->mActionPhase = 0; + } else if (i_this->mDistToPlayer > 4500.0f) { + return; + } + } + } + i_this->mBobTimer += 1; + for (s32 i = 0; i < 5; i++) { + if (i_this->field_0x624[i] != 0) { + i_this->field_0x624[i] -= 1; + } + } + if (i_this->mRemainingHookTime != 0) { + i_this->mRemainingHookTime -= 1; + } + if (i_this->field_0x632 != 0) { + i_this->field_0x632 -= 1; + } + i_this->field_0x5d4 = i_this->actor.speedF; + if (i_this->field_0x5d4 > 2.7f) { + i_this->field_0x5d4 = 2.7f; + } + if (i_this->mCurAction == ACTION_MG_FISH_RI_AQUA) { + if (i_this->field_0x5d4 <= TREG_F(2) + 0.1f) { + i_this->field_0x5d4 = TREG_F(2) + 0.1f; + } + } else if (i_this->field_0x5d4 <= TREG_F(2) + 0.15f) { + i_this->field_0x5d4 = TREG_F(2) + 0.15f; + } + i_this->mYawToPlayer = fopAcM_searchPlayerAngleY(&i_this->actor); + s32 unkFlag1 = false; + s32 unkFlag2 = false; + s32 canBeginSearch = false; + s32 isInUnderwaterState = true; + s32 unkFlag5 = false; + s32 unkFlag6 = false; + s32 unkFlag7 = true; + s32 isAqua = false; + switch (i_this->mCurAction) { + case ACTION_MG_FISH_MF_SWIM: + mf_swim(i_this); + unkFlag1 = true; + unkFlag2 = true; + canBeginSearch = true; + unkFlag6 = true; + break; + case ACTION_MG_FISH_MF_STAY: + mf_stay(i_this); + unkFlag1 = true; + unkFlag2 = true; + canBeginSearch = true; + unkFlag6 = true; + if (i_this->actor.speedF <= 0.05f) { + unkFlag7 = false; + } + break; + case ACTION_MG_FISH_MF_AWAY: + mf_away(i_this); + unkFlag2 = true; + break; + case ACTION_MG_FISH_MF_SWIM_P: + mf_swim_p(i_this); + canBeginSearch = true; + unkFlag6 = true; + break; + case ACTION_MG_FISH_MF_SWIM_S: + mf_swim_s(i_this); + unkFlag1 = true; + unkFlag2 = true; + unkFlag6 = true; + canBeginSearch = true; + break; + case ACTION_MG_FISH_RI_SWIM: + ri_swim((i_this)); + unkFlag1 = true; + unkFlag2 = true; + canBeginSearch = true; + if (i_this->actor.speedF <= 0.05f) { + unkFlag7 = false; + } + break; + case ACTION_MG_FISH_MF_AQUA: + mf_aqua(i_this); + unkFlag7 = false; + isAqua = true; + break; + case ACTION_MG_FISH_RI_AQUA: + ri_aqua(i_this); + unkFlag7 = false; + isAqua = true; + break; + case ACTION_MG_FISH_MF_AQUA_TILT: + mf_aqua_tilt(i_this); + unkFlag7 = false; + isAqua = true; + break; + case ACTION_MG_FISH_MF_LURE_SEARCH: + mf_lure_search(i_this); + unkFlag2 = true; + break; + case ACTION_MG_FISH_MF_BAIT_SEARCH: + mf_bait_search(i_this); + unkFlag2 = true; + break; + case ACTION_MG_FISH_MF_HIT: + mf_hit(i_this); + unkFlag5 = true; + break; + case ACTION_MG_FISH_MF_JUMP: + mf_jump(i_this); + isInUnderwaterState = false; + unkFlag5 = true; + break; + case ACTION_MG_FISH_MF_CATCH: + mf_catch(i_this); + unkFlag6 = true; + unkFlag7 = false; + isInUnderwaterState = false; + break; + case ACTION_MG_FISH_MF_ESA_SEARCH: + mf_esa_search(i_this); + unkFlag2 = true; + unkFlag6 = true; + break; + case ACTION_MG_FISH_MF_ESA_HIT: + mf_esa_hit(i_this); + unkFlag5 = true; + break; + case ACTION_MG_FISH_MF_ESA_CATCH: + unkFlag6 = mf_esa_catch(i_this); + unkFlag7 = true; + isInUnderwaterState = false; + break; + } + + if (unkFlag6 != 0) { + i_this->mCcCyl.OffCoSetBit(); + } else { + i_this->mCcCyl.OnCoSetBit(); + } + + if (unkFlag5) { + f32 jointScale; + if (i_this->mGedouKind == GEDOU_KIND_LM_1) { + jointScale = i_this->mJointScale; + if (jointScale >= 0.7f) { + jointScale = 0.0001f; + } else if (jointScale >= 0.65f) { + jointScale = 0.00015f; + } else if (jointScale >= 0.6f) { + jointScale = 0.0002f; + } else if (jointScale >= 0.55f) { + jointScale = 0.0003f; + } else { + jointScale = 0.0004f; + } + } else if (i_this->mGedouKind == GEDOU_KIND_NP_1) { + jointScale = i_this->mJointScale; + if (jointScale >= 0.7f) { + jointScale = 0.00015f; + } else if (jointScale >= 0.65f) { + jointScale = 0.0002f; + } else if (jointScale >= 0.6f) { + jointScale = 0.00025f; + } else if (jointScale >= 0.55f) { + jointScale = 0.0003f; + } else { + jointScale = 0.0004f; + } + } else if (i_this->mGedouKind == GEDOU_KIND_RI_1) { + if (i_this->mJointScale >= 0.8f) { + jointScale = 0.0001f; + } else { + jointScale = 0.00015f; + } + } else { + jointScale = 0.0003f; + } + cLib_addCalc2(&i_this->field_0x660, 0.5f, 1.0f, jointScale); + } else { + cLib_addCalc2(&i_this->field_0x660, 1.0f, 1.0f, 0.002f); + } + + if (TREG_S(7) == 0 && unkFlag1 && pl_check(i_this, i_this->field_0xc40) != 0) { + i_this->mCurAction = ACTION_MG_FISH_MF_AWAY; + i_this->mActionPhase = -1; + } + + if (unkFlag2 && + i_this->mSurfaceY - i_this->mAcch.GetGroundH() < i_this->mJointScale * (TREG_F(5) + 35.0f)) { + i_this->mCurAction = ACTION_MG_FISH_MF_AWAY; + i_this->mActionPhase = 1; + i_this->field_0x624[0] = cM_rndF(30.0f) + 40.0f; + i_this->mNextPos = i_this->actor.home.pos; + } + + if (canBeginSearch) { + if (i_this->field_0x62e == 0 || i_this->field_0x5ec > 10000.0f) { + s32 unkSint2 = 0; + if (i_this->mGedouKind >= GEDOU_KIND_BG) { + unkSint2 = 1; + } + i_this->mRodId = search_lure(i_this, unkSint2); + if (fopAcM_SearchByID(i_this->mRodId) != NULL) { + if (unkSint2 == 0) { + i_this->mCurAction = ACTION_MG_FISH_MF_LURE_SEARCH; + } else { + i_this->mCurAction = ACTION_MG_FISH_MF_ESA_SEARCH; + } + i_this->mActionPhase = 0; + } else { + if (unkSint2 == 0) { + i_this->mBaitId = search_bait(i_this); + if (fopAcM_SearchByID(i_this->mBaitId) != NULL) { + i_this->mCurAction = ACTION_MG_FISH_MF_BAIT_SEARCH; + i_this->mActionPhase = 0; + } + } + } + } else { + i_this->field_0x62e -= 1; + } + } + + if (i_this->mCurAction == ACTION_MG_FISH_MF_JUMP && i_this->actor.speedF == 0.0f) { + s32 unkSint2 = 7000; + if (i_this->mJointScale >= 0.7f) { + unkSint2 = 5000; + } else if (i_this->mJointScale >= 0.6f) { + unkSint2 = 6000; + } else if (i_this->mJointScale >= 0.5f) { + unkSint2 = 6500; + } + if (i_this->mNumJoints <= 4) { + i_this->jointYaws2[0] = cM_ssin(i_this->mBobTimer * unkSint2) * + (ZREG_F(10) + -9000.0f); + } else { + i_this->jointYaws2[0] = cM_ssin(i_this->mBobTimer * (unkSint2 + -500)) * + (ZREG_F(10) + -9000.0f); + } + } else { + f32 unkFloat0 = -1000.0f * i_this->field_0x5d4 * i_this->field_0x660; + i_this->jointYaws2[1] += (s16)(i_this->field_0x5d4 * 2500.0f / i_this->mJointScale); + if (i_this->mGedouKind >= GEDOU_KIND_BG) { + i_this->jointYaws2[1] += 2000; + } + i_this->jointYaws2[0] = unkFloat0 * cM_ssin(i_this->jointYaws2[1]); + } + + cMtx_YrotS(*calc_mtx, i_this->actor.current.angle.y); + cMtx_XrotM(*calc_mtx, i_this->actor.current.angle.x); + cMtx_YrotM(*calc_mtx, i_this->jointYaws2[0]); + + cXyz commonXyz; + commonXyz.x = 0.0f; + commonXyz.y = 0.0f; + commonXyz.z = i_this->actor.speedF * l_HIO.field_0xc * i_this->mJointScale * i_this->field_0x660; + if (i_this->mGedouKind >= GEDOU_KIND_BG && i_this->mGedouKind != GEDOU_KIND_KS_2) { + commonXyz.z *= 1.3f; + } + + f32 unkFloat1 = 10.0f; + if (i_this->mGedouKind == GEDOU_KIND_CF_1) { + unkFloat1 = 4.5f; + } else if (i_this->mGedouKind == GEDOU_KIND_RI_1) { + unkFloat1 = 5.0f; + } else if (i_this->mGedouKind == GEDOU_KIND_NP_1 || i_this->mGedouKind == GEDOU_KIND_KS_1) { + unkFloat1 = 7.0f; + } + if (commonXyz.z > unkFloat1) { + commonXyz.z = unkFloat1; + } + + MtxPosition(&commonXyz, &i_this->actor.speed); + i_this->actor.current.pos += i_this->actor.speed; + + i_this->actor.eyePos = i_this->actor.current.pos; + commonXyz = i_this->actor.eyePos; + commonXyz.y -= 10.0f; + + i_this->mCcCyl.SetC(commonXyz); + + if (i_this->mCurAction == ACTION_MG_FISH_MF_HIT || + i_this->mCurAction >= ACTION_MG_FISH_MF_ESA_HIT) { + i_this->mCcCyl.SetH(KREG_F(17) + 500.0f); + if (i_this->mCurAction >= ACTION_MG_FISH_MF_ESA_HIT) { + i_this->mCcCyl.SetR(30.0f); + } else { + i_this->mCcCyl.SetR(hREG_F(16) + 40.0f); + } + } else { + f32 radius = i_this->mJointScale * (KREG_F(13) + 20.0f); + if (radius > 15.0f) { + radius = 15.0f; + } + i_this->mCcCyl.SetR(radius); + i_this->mCcCyl.SetH((KREG_F(13) + 30.0f) * i_this->mJointScale); + } + + dComIfG_Ccsp()->Set(&i_this->mCcCyl); + + if (unkFlag6 == 0) { + cXyz* ccMoveP = i_this->mCcStatus.GetCCMoveP(); + if (ccMoveP != NULL) { + if (isAqua) { + f32 scalar = XREG_F(15) + 0.04f; + i_this->actor.current.pos.x += ccMoveP->x * scalar; + i_this->actor.current.pos.z += ccMoveP->z * scalar; + for (s32 i = 0; i <= i_this->mNumJoints; i++) { + i_this->mJointTranslations[i].x += ccMoveP->x * scalar; + i_this->mJointTranslations[i].z += ccMoveP->z * scalar; + } + } else if (i_this->mCurAction == ACTION_MG_FISH_MF_HIT || + i_this->mCurAction >= ACTION_MG_FISH_MF_ESA_HIT) { + i_this->actor.current.pos.x += ccMoveP->x; + i_this->actor.current.pos.z += ccMoveP->z; + } else { + i_this->actor.current.pos.x += ccMoveP->x * 0.5f; + i_this->actor.current.pos.z += ccMoveP->z * 0.5f; + } + } + } + + if (unkFlag7) { + f32 unkFloat2 = i_this->mJointScale * (TREG_F(3) + 10.0f); + unkFloat2 += fabsf(unkFloat2 * cM_ssin(i_this->actor.current.angle.x) * 2.0f); + i_this->actor.current.pos.y = i_this->actor.current.pos.y - unkFloat2; + i_this->actor.old.pos.y = i_this->actor.old.pos.y - unkFloat2; + i_this->mAcch.CrrPos(dComIfG_Bgsp()); + i_this->actor.current.pos.y = i_this->actor.current.pos.y + unkFloat2; + i_this->actor.old.pos.y = i_this->actor.old.pos.y + unkFloat2; + + if (i_this->mAcch.ChkGroundHit() && i_this->actor.current.angle.x > 0x800) { + i_this->mMovementPitch = 0x800; + i_this->actor.current.angle.x = 0x800; + } + } + + if (isAqua) { + if (i_this->actor.current.pos.x > -675.0f || i_this->actor.current.pos.x < -765.0f) { + i_this->actor.current.pos.x = i_this->actor.old.pos.x; + } + if (i_this->actor.current.pos.z > 290.0f || i_this->actor.current.pos.z < -150.0f) { + i_this->actor.current.pos.z = i_this->actor.old.pos.z; + } + if (i_this->actor.current.pos.y < i_this->mGroundY + 5.0f) { + i_this->actor.current.pos.y = i_this->actor.old.pos.y; + } + + if (daPy_getPlayerActorClass()->checkFrontRollCrash() && i_this->mDistToPlayer < 200.0f) { + i_this->mCurAction = ACTION_MG_FISH_MF_AQUA_TILT; + i_this->mActionPhase = 0; + i_this->field_0x624[1] = cM_rndF(30.0f) + 50.0f; + + fopAc_ac_c* henna = fopAcM_SearchByName(PROC_NPC_HENNA); + if (henna != NULL) { + ((npc_henna_class*)henna)->field_0x7b5 = 20; + } + } + } + + // surfaceY access is replaced with subtraction operation in debug rom + if (isInUnderwaterState && i_this->actor.current.pos.y > i_this->mSurfaceY) { + i_this->actor.current.pos.y = i_this->mSurfaceY; + if (i_this->actor.current.angle.x < 0) { + i_this->mMovementPitch = 0; + i_this->actor.current.angle.x = 0; + } + } + + cLib_addCalcAngleS2(&i_this->actor.shape_angle.y, i_this->actor.current.angle.y, 2, 0x1000); + cLib_addCalcAngleS2(&i_this->actor.shape_angle.x, i_this->actor.current.angle.x, 2, 0x1000); + cLib_addCalcAngleS2(&i_this->actor.shape_angle.z, i_this->actor.current.angle.z, 0x10, 0x200); + + if (i_this->mGedouKind != GEDOU_KIND_CF_1) { + f32 unkFloat4 = i_this->actor.speedF * (NREG_F(15) + 4000.0f); + f32 target = 4000.0f; + if (i_this->mGedouKind == GEDOU_KIND_RI_1) { + target = 1000.0f; + } else if (i_this->mGedouKind == GEDOU_KIND_NP_1 || i_this->mGedouKind == GEDOU_KIND_KS_1) { + target = 3500.0f; + } + if (unkFloat4 > target) { + unkFloat4 = target; + } + i_this->jointYaws2[4] = -(i_this->field_0x73c - unkFloat4) + + i_this->field_0x73c * cM_ssin(i_this->mBobTimer * (TREG_S(9) + 1900)); + i_this->jointYaws2[5] = i_this->field_0x73c - unkFloat4 + + i_this->field_0x73c * cM_ssin(i_this->mBobTimer * (TREG_S(9) + 1700)); + target = 0.3f - (NREG_F(14) + i_this->actor.speedF); + if (target < NREG_F(14) + 0.0f) { + target = NREG_F(14) + 0.0f; + } + target *= 23333.0f; + cLib_addCalc2(&i_this->field_0x73c, target, 0.2f, 800.0f); + } } -/* ############################################################################################## */ -/* 80536330-80536334 0001C8 0004+00 0/1 0/0 0/0 .rodata @7223 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u32 const lit_7223 = 0x38D1B717; -COMPILER_STRIP_GATE(0x80536330, &lit_7223); -#pragma pop - -/* 80536334-80536338 0001CC 0004+00 0/0 0/0 0/0 .rodata @7224 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u32 const lit_7224 = 0x391D4952; -COMPILER_STRIP_GATE(0x80536334, &lit_7224); -#pragma pop - -/* 80536338-8053633C 0001D0 0004+00 0/0 0/0 0/0 .rodata @7225 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u32 const lit_7225 = 0x3951B717; -COMPILER_STRIP_GATE(0x80536338, &lit_7225); -#pragma pop - -/* 8053633C-80536340 0001D4 0004+00 0/0 0/0 0/0 .rodata @7226 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u32 const lit_7226 = 0x399D4952; -COMPILER_STRIP_GATE(0x8053633C, &lit_7226); -#pragma pop - -/* 80536340-80536344 0001D8 0004+00 0/0 0/0 0/0 .rodata @7227 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u32 const lit_7227 = 0x39D1B717; -COMPILER_STRIP_GATE(0x80536340, &lit_7227); -#pragma pop - -/* 80536344-80536348 0001DC 0004+00 0/0 0/0 0/0 .rodata @7228 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u32 const lit_7228 = 0x3983126F; -COMPILER_STRIP_GATE(0x80536344, &lit_7228); -#pragma pop - -/* 80536348-8053634C 0001E0 0004+00 0/1 0/0 0/0 .rodata @7229 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_7229 = 35.0f; -COMPILER_STRIP_GATE(0x80536348, &lit_7229); -#pragma pop - -/* 8053634C-80536350 0001E4 0004+00 0/0 0/0 0/0 .rodata @7230 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_7230 = -9000.0f; -COMPILER_STRIP_GATE(0x8053634C, &lit_7230); -#pragma pop - -/* 80536350-80536354 0001E8 0004+00 0/0 0/0 0/0 .rodata @7231 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_7231 = -1000.0f; -COMPILER_STRIP_GATE(0x80536350, &lit_7231); -#pragma pop - -/* 80536354-80536358 0001EC 0004+00 0/0 0/0 0/0 .rodata @7232 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_7232 = 2500.0f; -COMPILER_STRIP_GATE(0x80536354, &lit_7232); -#pragma pop - -/* 80536358-8053635C 0001F0 0004+00 0/0 0/0 0/0 .rodata @7233 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_7233 = 4.5f; -COMPILER_STRIP_GATE(0x80536358, &lit_7233); -#pragma pop - -/* 8053635C-80536360 0001F4 0004+00 0/1 0/0 0/0 .rodata @7234 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_7234 = 1.0f / 25.0f; -COMPILER_STRIP_GATE(0x8053635C, &lit_7234); -#pragma pop - -/* 80536360-80536364 0001F8 0004+00 0/0 0/0 0/0 .rodata @7235 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_7235 = -675.0f; -COMPILER_STRIP_GATE(0x80536360, &lit_7235); -#pragma pop - -/* 80536364-80536368 0001FC 0004+00 0/0 0/0 0/0 .rodata @7236 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_7236 = -765.0f; -COMPILER_STRIP_GATE(0x80536364, &lit_7236); -#pragma pop - -/* 80536368-8053636C 000200 0004+00 0/0 0/0 0/0 .rodata @7237 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_7237 = 290.0f; -COMPILER_STRIP_GATE(0x80536368, &lit_7237); -#pragma pop - -/* 8053636C-80536370 000204 0004+00 0/0 0/0 0/0 .rodata @7238 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_7238 = -150.0f; -COMPILER_STRIP_GATE(0x8053636C, &lit_7238); -#pragma pop - -/* 80536370-80536374 000208 0004+00 0/0 0/0 0/0 .rodata @7239 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_7239 = 3500.0f; -COMPILER_STRIP_GATE(0x80536370, &lit_7239); -#pragma pop - -/* 80536374-80536378 00020C 0004+00 0/0 0/0 0/0 .rodata @7240 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_7240 = 23333.0f; -COMPILER_STRIP_GATE(0x80536374, &lit_7240); -#pragma pop - -/* 80536378-8053637C 000210 0004+00 0/0 0/0 0/0 .rodata @7241 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_7241 = 800.0f; -COMPILER_STRIP_GATE(0x80536378, &lit_7241); -#pragma pop - -/* 8053637C-80536380 000214 0004+00 0/2 0/0 0/0 .rodata @7288 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_7288 = -3.0f; -COMPILER_STRIP_GATE(0x8053637C, &lit_7288); -#pragma pop - /* 80533268-80533484 009628 021C+00 1/1 0/0 0/0 .text ke_control__FP13mg_fish_classP7mf_ke_s */ -static void ke_control(mg_fish_class* param_0, mf_ke_s* param_1) { - // NONMATCHING +static void ke_control(mg_fish_class* i_this, mf_ke_s* rope) { + s32 i; + s16 pitch; + s32 yaw; + cXyz* p1 = rope->mControlPoints + 1; + f32 influence = 1.0f; + + cMtx_YrotS(*calc_mtx, i_this->actor.shape_angle.y); + cMtx_XrotM(*calc_mtx, i_this->actor.shape_angle.x); + + cXyz localOffset(0.0f, 0.0f, -3.0f); + cXyz newSegmentDelta; + cXyz transformedOffset; + MtxPosition(&localOffset, &transformedOffset); + + localOffset.x = 0.0f; + localOffset.y = 0.0f; + localOffset.z = 10.0f * i_this->mJointScale; + + for (i = 1; i < 5; i++, p1++) { + f32 newX = p1->x - p1[-1].x + rope->mMovementDir.x * influence + transformedOffset.x; + f32 newY = p1->y - p1[-1].y + rope->mMovementDir.y * influence + transformedOffset.y; + f32 newZ = p1->z - p1[-1].z + rope->mMovementDir.z * influence + transformedOffset.z; + + influence *= 0.4f; + + yaw = cM_atan2s(newX, newZ); + pitch = -cM_atan2s(newY, JMAFastSqrt(newX * newX + newZ * newZ)); + cMtx_YrotS(*calc_mtx, yaw); + cMtx_XrotM(*calc_mtx, pitch); + MtxPosition(&localOffset, &newSegmentDelta); + p1->x = p1[-1].x + newSegmentDelta.x; + p1->y = p1[-1].y + newSegmentDelta.y; + p1->z = p1[-1].z + newSegmentDelta.z; + } } /* 80533484-80533540 009844 00BC+00 1/1 0/0 0/0 .text ke_move__FP13mg_fish_classP7mf_ke_si */ -static void ke_move(mg_fish_class* param_0, mf_ke_s* param_1, int param_2) { - // NONMATCHING +static void ke_move(mg_fish_class* i_this, mf_ke_s* param_1, int param_2) { + ke_control(i_this, param_1); + cXyz* pos = i_this->mLineMat.getPos(param_2); + f32* size = i_this->mLineMat.getSize(param_2); + for (s32 i = 0; i < 5; i++, pos++, size++) { + *pos = param_1->mControlPoints[i]; + if (i < 3) { + *size = 0.3f * i_this->mJointScale; + } else { + *size = 0.0f; + } + } } -/* ############################################################################################## */ -/* 80536380-8053638C 000218 000C+00 0/1 0/0 0/0 .rodata @7384 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_7384[12] = { - 0x3F, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x60, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x80536380, &lit_7384); -#pragma pop - -/* 8053638C-80536398 000224 000C+00 0/1 0/0 0/0 .rodata @7398 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_7398[12] = { - 0x3F, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x60, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x8053638C, &lit_7398); -#pragma pop - -/* 80536398-8053639C 000230 0004+00 0/1 0/0 0/0 .rodata @8029 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8029 = -5.0f; -COMPILER_STRIP_GATE(0x80536398, &lit_8029); -#pragma pop - -/* 8053639C-805363A0 000234 0004+00 0/1 0/0 0/0 .rodata @8030 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8030 = -100.0f; -COMPILER_STRIP_GATE(0x8053639C, &lit_8030); -#pragma pop - -/* 805363A0-805363A4 000238 0004+00 0/1 0/0 0/0 .rodata @8031 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8031 = 28.0f / 25.0f; -COMPILER_STRIP_GATE(0x805363A0, &lit_8031); -#pragma pop - -/* 805363A4-805363A8 00023C 0004+00 0/1 0/0 0/0 .rodata @8032 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8032 = -25.0f; -COMPILER_STRIP_GATE(0x805363A4, &lit_8032); -#pragma pop - -/* 805363A8-805363AC 000240 0004+00 0/1 0/0 0/0 .rodata @8033 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8033 = -15.0f; -COMPILER_STRIP_GATE(0x805363A8, &lit_8033); -#pragma pop - -/* 805363AC-805363B0 000244 0004+00 0/1 0/0 0/0 .rodata @8034 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8034 = 11.0f / 10.0f; -COMPILER_STRIP_GATE(0x805363AC, &lit_8034); -#pragma pop - -/* 805363B0-805363B4 000248 0004+00 0/1 0/0 0/0 .rodata @8035 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8035 = 29.0f; -COMPILER_STRIP_GATE(0x805363B0, &lit_8035); -#pragma pop - -/* 805363B4-805363B8 00024C 0004+00 0/1 0/0 0/0 .rodata @8036 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8036 = 9.0f / 25.0f; -COMPILER_STRIP_GATE(0x805363B4, &lit_8036); -#pragma pop - -/* 805363B8-805363BC 000250 0004+00 0/1 0/0 0/0 .rodata @8037 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8037 = -40.0f; -COMPILER_STRIP_GATE(0x805363B8, &lit_8037); -#pragma pop - -/* 805363BC-805363C0 000254 0004+00 0/1 0/0 0/0 .rodata @8038 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8038 = 17.0f; -COMPILER_STRIP_GATE(0x805363BC, &lit_8038); -#pragma pop - -/* 805363C0-805363C4 000258 0004+00 0/1 0/0 0/0 .rodata @8039 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8039 = -9.0f; -COMPILER_STRIP_GATE(0x805363C0, &lit_8039); -#pragma pop - -/* 805363C4-805363C8 00025C 0004+00 0/1 0/0 0/0 .rodata @8040 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8040 = 2600.0f; -COMPILER_STRIP_GATE(0x805363C4, &lit_8040); -#pragma pop - -/* 805363C8-805363CC 000260 0004+00 0/1 0/0 0/0 .rodata @8041 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8041 = -8.0f; -COMPILER_STRIP_GATE(0x805363C8, &lit_8041); -#pragma pop - -/* 805363CC-805363D0 000264 0004+00 0/1 0/0 0/0 .rodata @8042 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8042 = -14.0f; -COMPILER_STRIP_GATE(0x805363CC, &lit_8042); -#pragma pop - -/* 805363D0-805363D4 000268 0004+00 0/1 0/0 0/0 .rodata @8043 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8043 = -19.0f; -COMPILER_STRIP_GATE(0x805363D0, &lit_8043); -#pragma pop - -/* 805363D4-805363D8 00026C 0004+00 0/1 0/0 0/0 .rodata @8044 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8044 = -2.0f; -COMPILER_STRIP_GATE(0x805363D4, &lit_8044); -#pragma pop - -/* 805363D8-805363DC 000270 0004+00 0/1 0/0 0/0 .rodata @8045 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8045 = 12.0f / 25.0f; -COMPILER_STRIP_GATE(0x805363D8, &lit_8045); -#pragma pop - -/* 805363DC-805363E0 000274 0004+00 0/1 0/0 0/0 .rodata @8046 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8046 = -45.0f; -COMPILER_STRIP_GATE(0x805363DC, &lit_8046); -#pragma pop - -/* 805363E0-805363E4 000278 0004+00 0/1 0/0 0/0 .rodata @8047 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8047 = -35.0f; -COMPILER_STRIP_GATE(0x805363E0, &lit_8047); -#pragma pop - -/* 80536BEC-80536BFC 000074 000C+04 0/1 0/0 0/0 .bss @7455 */ -#pragma push -#pragma force_active on -static u8 lit_7455[12 + 4 /* padding */]; -#pragma pop - -/* 80536BFC-80536C08 000084 000C+00 0/1 0/0 0/0 .bss @7458 */ -#pragma push -#pragma force_active on -static u8 lit_7458[12]; -#pragma pop - -/* 80536C08-80536C14 000090 000C+00 0/1 0/0 0/0 .bss @7459 */ -#pragma push -#pragma force_active on -static u8 lit_7459[12]; -#pragma pop - -/* 80536C14-80536C20 00009C 000C+00 0/1 0/0 0/0 .bss @7460 */ -#pragma push -#pragma force_active on -static u8 lit_7460[12]; -#pragma pop - -/* 80536C20-80536C2C 0000A8 000C+00 0/1 0/0 0/0 .bss @7461 */ -#pragma push -#pragma force_active on -static u8 lit_7461[12]; -#pragma pop - -/* 80536C2C-80536C38 0000B4 000C+00 0/1 0/0 0/0 .bss @7462 */ -#pragma push -#pragma force_active on -static u8 lit_7462[12]; -#pragma pop - -/* 80536C38-80536C44 0000C0 000C+00 0/1 0/0 0/0 .bss @7463 */ -#pragma push -#pragma force_active on -static u8 lit_7463[12]; -#pragma pop - -/* 80536C44-80536C50 0000CC 000C+00 0/1 0/0 0/0 .bss @7464 */ -#pragma push -#pragma force_active on -static u8 lit_7464[12]; -#pragma pop - -/* 80536C50-80536C5C 0000D8 000C+00 0/1 0/0 0/0 .bss @7465 */ -#pragma push -#pragma force_active on -static u8 lit_7465[12]; -#pragma pop - -/* 80536C5C-80536C68 0000E4 000C+00 0/1 0/0 0/0 .bss @7466 */ -#pragma push -#pragma force_active on -static u8 lit_7466[12]; -#pragma pop - -/* 80536C68-80536C74 0000F0 000C+00 0/1 0/0 0/0 .bss @7467 */ -#pragma push -#pragma force_active on -static u8 lit_7467[12]; -#pragma pop - -/* 80536C74-80536CF8 0000FC 0084+00 0/1 0/0 0/0 .bss mouth_off$7454 */ -#pragma push -#pragma force_active on -static u8 mouth_off[132]; -#pragma pop - /* 80533540-80534964 009900 1424+00 2/1 0/0 0/0 .text daMg_Fish_Execute__FP13mg_fish_class */ -static void daMg_Fish_Execute(mg_fish_class* param_0) { - // NONMATCHING +static int daMg_Fish_Execute(mg_fish_class* i_this) { + static s32 mouth_idx[11] = { 7, 0, 9, 7, 9, 4, 7, 0, 9, 7, 9 }; + + if (i_this->mGedouKind == GEDOU_KIND_BT || i_this->mGedouKind == GEDOU_KIND_SP || + i_this->mGedouKind == GEDOU_KIND_LH || i_this->mGedouKind == GEDOU_KIND_O_GD_BOTT || + i_this->mGedouKind == GEDOU_KIND_BB || i_this->mGedouKind == GEDOU_KIND_KN || + i_this->mGedouKind == GEDOU_KIND_ED || i_this->mGedouKind == GEDOU_KIND_SY || + i_this->field_0xc3c != 0) { + return 1; + } + + cXyz commonXyz; + + daPy_py_c* player = daPy_getPlayerActorClass(); + + if (i_this->mSurfaceY != 0.0f) { + if ((g_Counter.mTimer + fopAcM_GetID(i_this) & 0xf) == 0) { + get_surface_y(i_this, &i_this->actor.current.pos); + } + } + i_this->mHookedState = 0; + action(i_this); + dmcalc(i_this); + + J3DModel* model = i_this->mpMorf->getModel(); + for (u16 i = 1; i < model->mModelData->getJointNum(); i++) { + if ((i_this->mCurAction == ACTION_MG_FISH_MF_JUMP && i_this->actor.speedF == 0.0f) || + i_this->mCurAction == ACTION_MG_FISH_MF_CATCH || + i_this->mCurAction == ACTION_MG_FISH_MF_ESA_CATCH) + { + model->mModelData->getJointNodePointer(i)->setCallBack(nodeCallBack2); + } else { + model->mModelData->getJointNodePointer(i)->setCallBack(nodeCallBack); + } + } + + if (i_this->mCurAction == ACTION_MG_FISH_MF_CATCH) { + if (i_this->field_0x624[0] < 0x50) { + MtxP src = daPy_getLinkPlayerActorClass()->getRightItemMatrix(); + MTXCopy(src, *calc_mtx); + commonXyz.set(0.0f, 5.0f, -5.0f); + MtxPosition(&commonXyz, &i_this->actor.current.pos); + } else { + daPy_py_c* player2 = (daPy_py_c*)dComIfGp_getPlayer(0); + cMtx_YrotS(*calc_mtx, player2->shape_angle.y); + + if (player2->checkCanoeFishingGetRight() != 0) { + commonXyz.x = -100.0f; + } else { + commonXyz.x = 100.0f; + } + commonXyz.y = 0.0f; + commonXyz.z = 0.0f; + MtxPosition(&commonXyz, &i_this->actor.current.pos); + + i_this->actor.current.pos.x = i_this->actor.current.pos.x + player2->current.pos.x; + i_this->actor.current.pos.z = i_this->actor.current.pos.z + player2->current.pos.z; + i_this->actor.current.pos.y = i_this->mSurfaceY - 10.0f; + } + MTXTrans(mDoMtx_stack_c::now, i_this->actor.current.pos.x, i_this->actor.current.pos.y, + i_this->actor.current.pos.z); + cMtx_YrotM(mDoMtx_stack_c::now, i_this->actor.shape_angle.y); + cMtx_XrotM(mDoMtx_stack_c::now, i_this->actor.shape_angle.x); + f32 jointScaleMult = 1.0f; + f32 jointScale = i_this->mJointScale; + if (jointScale < 0.6f) { + jointScaleMult = 0.6f - jointScale + 1.0f; + } + if (jointScaleMult > 1.12f) { + jointScaleMult = 1.12f; + } + jointScale *= jointScaleMult; + mDoMtx_stack_c::scaleM(jointScale, jointScale, jointScale); + if (i_this->mNumJoints <= 4) { + mDoMtx_stack_c::transM(0.0f, 15.0f, -25.0f); + } else { + mDoMtx_stack_c::transM(0.0f, 10.0f, -15.0f); + } + } else { + MTXTrans(mDoMtx_stack_c::now, i_this->actor.current.pos.x, i_this->actor.current.pos.y, + i_this->actor.current.pos.z); + cMtx_YrotM(mDoMtx_stack_c::now, i_this->actor.shape_angle.y); + cMtx_XrotM(mDoMtx_stack_c::now, i_this->actor.shape_angle.x); + cMtx_ZrotM(mDoMtx_stack_c::now, i_this->actor.shape_angle.z); + + f32 jointScale = i_this->mJointScale; + mDoMtx_stack_c::scaleM(jointScale, jointScale, jointScale); + if (i_this->mCurAction == ACTION_MG_FISH_MF_JUMP && i_this->actor.speedF == 0.0f) { + jointScale = 20.0f; + } else { + jointScale = 0.0f; + } + mDoMtx_stack_c::transM(0.0f, 0.0f, -jointScale); + cMtx_YrotM(mDoMtx_stack_c::now, i_this->jointYaws2[0]); + mDoMtx_stack_c::transM(0.0f, 0.0f, jointScale); + if (i_this->mCurAction == ACTION_MG_FISH_MF_ESA_CATCH) { + mDoMtx_stack_c::scaleM(1.1f, 1.1f, 1.1f); + } + } + MTXCopy(mDoMtx_stack_c::now, model->getBaseTRMtx()); + if (i_this->mCaughtType != 0) { + dmg_rod_class* rod = (dmg_rod_class*)fopAcM_SearchByID(i_this->mRodId); + if (i_this->mCaughtType == 1) { + mg_fish_class* fish = (mg_fish_class*)fpcEx_Search(s_bt_sub, i_this); + if (fish != NULL) { + MTXTrans(mDoMtx_stack_c::now, i_this->actor.current.pos.x, i_this->actor.current.pos.y - 10.0f, + i_this->actor.current.pos.z); + cMtx_YrotM(mDoMtx_stack_c::now, i_this->actor.shape_angle.y); + cMtx_XrotM(mDoMtx_stack_c::now, -0x4000); + mDoMtx_stack_c::transM(0.0f, 0.0f, 7.0f); + fish->mpModel[0]->setBaseTRMtx(mDoMtx_stack_c::now); + } + } else if (i_this->mCaughtType == 2) { + mg_fish_class* fish = (mg_fish_class*)fpcEx_Search(s_sp_sub, i_this); + if (fish != NULL) { + MTXTrans(mDoMtx_stack_c::now, i_this->actor.current.pos.x, i_this->actor.current.pos.y, + i_this->actor.current.pos.z); + cMtx_YrotM(mDoMtx_stack_c::now, i_this->actor.shape_angle.y); + cMtx_XrotM(mDoMtx_stack_c::now, 0x4000); + if (rod->field_0x102d == 1) { + mDoMtx_stack_c::transM(0.0f, 0.0f, 35.0f); + } else { + mDoMtx_stack_c::transM(0.0f, 0.0f, 29.0f); + } + mDoMtx_stack_c::scaleM(0.36f, 0.36f, 0.36f); + fish->mpModel[0]->setBaseTRMtx(mDoMtx_stack_c::now); + mDoMtx_stack_c::transM(0.0f, 0.0f, -40.0f); + mDoMtx_stack_c::scaleM(2.5f, 2.5f, 2.5f); + cMtx_XrotM(mDoMtx_stack_c::now, 0x4000); + fish->mpModel[1]->setBaseTRMtx(mDoMtx_stack_c::now); + cMtx_XrotM(mDoMtx_stack_c::now, -0x4000); + mDoMtx_stack_c::transM(0.0f, 0.0f, 17.0f); + mDoMtx_stack_c::scaleM(0.5f, 0.5f, 0.5f); + cMtx_ZrotM(mDoMtx_stack_c::now, 0x4000); + fish->mpModel[2]->setBaseTRMtx(mDoMtx_stack_c::now); + } + } else if (i_this->mCaughtType == 3) { + mg_fish_class* fish = (mg_fish_class*)fpcEx_Search(s_lh_sub, i_this); + if (fish != NULL) { + MTXTrans(mDoMtx_stack_c::now, i_this->actor.current.pos.x, i_this->actor.current.pos.y, + i_this->actor.current.pos.z); + cMtx_YrotM(mDoMtx_stack_c::now, i_this->actor.shape_angle.y); + f32 latScale = 0.5f / (i_this->field_0x74c + 1.0f); + mDoMtx_stack_c::scaleM(latScale, (i_this->field_0x74c + 1.0f) * 0.5f, latScale); + mDoMtx_stack_c::transM(0.0f, -30.0f, 0.0f); + fish->mpModel[0]->setBaseTRMtx(mDoMtx_stack_c::now); + } + } else if (i_this->mCaughtType == 4) { + fopAc_ac_c* skullfish_actor = fopAcM_SearchByID(i_this->mSkullfishId); + if (skullfish_actor != NULL) { + e_sg_class* skullfish = (e_sg_class*)skullfish_actor; + MTXTrans(mDoMtx_stack_c::now, i_this->actor.current.pos.x, i_this->actor.current.pos.y, + i_this->actor.current.pos.z); + cMtx_YrotM(mDoMtx_stack_c::now, i_this->actor.shape_angle.y); + cMtx_XrotM(mDoMtx_stack_c::now, i_this->actor.shape_angle.x); + cMtx_ZrotM(mDoMtx_stack_c::now, i_this->actor.shape_angle.z); + if (i_this->mCurAction == ACTION_MG_FISH_MF_ESA_CATCH) { + mDoMtx_stack_c::scaleM(0.8f, 0.8f, 0.8f); + } + mDoMtx_stack_c::transM(0.0f, 2.5f, 0.0f); + skullfish->mpModel->setBaseTRMtx(mDoMtx_stack_c::now); + + f32 fAVar1[] = { 1.0f, 2.0f, 3.5f }; + + skullfish->mJointYRot = 0.0f; + for (s32 i = 0; i < 3; i++) { + if (i_this->mCurAction == ACTION_MG_FISH_MF_ESA_CATCH) { + skullfish->mJoints[i + 1] = (s32)(i_this->field_0x740 * + cM_ssin(i_this->mBobTimer * 4000 + -15000 * i) * + fAVar1[i]); + } else { + skullfish->mJoints[i + 1] = (s32)(cM_ssin(i_this->mBobTimer * 8000 + -15000 * i) * + 4000.0f * + fAVar1[i]); + } + } + } + } else if (i_this->mCaughtType == 5) { + mg_fish_class* fish = (mg_fish_class*)fpcEx_Search(s_bb_sub, i_this); + if (fish != NULL) { + MTXTrans(mDoMtx_stack_c::now, i_this->actor.current.pos.x, i_this->actor.current.pos.y, + i_this->actor.current.pos.z); + + f32 fAVar2[] = { 1.0f, 2.0f, 3.5f }; + for (s32 i = 0; i < 3; i++) { + if (i_this->mCurAction == ACTION_MG_FISH_MF_ESA_CATCH) { + fish->jointYaws1[i] = (s32)(i_this->field_0x740 * + cM_ssin(i_this->mBobTimer * 4000 + -15000 * i) * + fAVar2[i]); + } else { + fish->jointYaws1[i] = (s32)(cM_ssin(i_this->mBobTimer * 10000 + -15000 * i) * + 3000.0f * + fAVar2[i]); + } + } + if (i_this->mCurAction == ACTION_MG_FISH_MF_ESA_CATCH) { + cMtx_YrotM(mDoMtx_stack_c::now, i_this->actor.shape_angle.y); + } else { + cMtx_YrotM(mDoMtx_stack_c::now, + i_this->actor.shape_angle.y + fish->jointYaws1[0]); + } + cMtx_XrotM(mDoMtx_stack_c::now, i_this->actor.shape_angle.x); + cMtx_ZrotM(mDoMtx_stack_c::now, i_this->actor.shape_angle.z); + if (i_this->mCurAction == ACTION_MG_FISH_MF_ESA_CATCH) { + mDoMtx_stack_c::scaleM(0.7f, 0.7f, 0.7f); + } + fish->mpModel[0]->setBaseTRMtx(mDoMtx_stack_c::now); + } + } else if (i_this->mCaughtType == 6) { + mg_fish_class* fish = (mg_fish_class*)fpcEx_Search(s_bin_sub, i_this); + if (fish != NULL) { + MTXTrans(mDoMtx_stack_c::now, i_this->actor.current.pos.x, i_this->actor.current.pos.y - 10.0f, + i_this->actor.current.pos.z); + cMtx_YrotM(mDoMtx_stack_c::now, i_this->actor.shape_angle.y); + mDoMtx_stack_c::transM(0.0f, -9.0f, 0.0f); + fish->mpModel[0]->setBaseTRMtx(mDoMtx_stack_c::now); + } + } else if (i_this->mCaughtType == 7) { + mg_fish_class* fish = (mg_fish_class*)fpcEx_Search(s_kn_sub, i_this); + if (fish != NULL) { + MTXTrans(mDoMtx_stack_c::now, i_this->actor.current.pos.x, i_this->actor.current.pos.y, + i_this->actor.current.pos.z); + cMtx_YrotM(mDoMtx_stack_c::now, i_this->actor.shape_angle.y); + cMtx_XrotM(mDoMtx_stack_c::now, + (s16)(cM_ssin(i_this->mBobTimer * 0x514) * 600.0f + 2600.0f) + + -0x4000); + mDoMtx_stack_c::scaleM(1.0f, 1.0f, 1.0f); + mDoMtx_stack_c::transM(0.0f, -8.0f, -5.0f); + fish->mpModel[0]->setBaseTRMtx(mDoMtx_stack_c::now); + } + } else if (i_this->mCaughtType == 8) { + mg_fish_class* fish = (mg_fish_class*)fpcEx_Search(s_ed_sub, i_this); + if (fish != NULL) { + MTXTrans(mDoMtx_stack_c::now, i_this->actor.current.pos.x, i_this->actor.current.pos.y, + i_this->actor.current.pos.z); + cMtx_YrotM(mDoMtx_stack_c::now, i_this->actor.shape_angle.y); + cMtx_XrotM(mDoMtx_stack_c::now, -0x4000); + if (rod->field_0x102d == 1) { + mDoMtx_stack_c::transM(0.0f, 0.0f, -14.0f); + } else { + mDoMtx_stack_c::transM(0.0f, 0.0f, -8.0f); + } + + cMtx_YrotM(mDoMtx_stack_c::now, cM_ssin(i_this->mBobTimer * 800) * 1500.0f); + mDoMtx_stack_c::scaleM(0.5f, 0.5f, 0.5f); + fish->mpModel[0]->setBaseTRMtx(mDoMtx_stack_c::now); + } + } else if (i_this->mCaughtType == 9) { + mg_fish_class* fish = (mg_fish_class*)fpcEx_Search(s_sy_sub, i_this); + if (fish != NULL) { + MTXTrans(mDoMtx_stack_c::now, i_this->actor.current.pos.x, i_this->actor.current.pos.y, + i_this->actor.current.pos.z); + cMtx_YrotM(mDoMtx_stack_c::now, i_this->actor.shape_angle.y); + cMtx_XrotM(mDoMtx_stack_c::now, -0x4000); + if (rod->field_0x102d == 1) { + mDoMtx_stack_c::transM(0.0f, 0.0f, -25.0f); + } else { + mDoMtx_stack_c::transM(0.0f, 0.0f, -19.0f); + } + cMtx_YrotM(mDoMtx_stack_c::now, 0xa00); + mDoMtx_stack_c::scaleM(0.3f, 0.3f, 0.3f); + fish->mpModel[0]->setBaseTRMtx(mDoMtx_stack_c::now); + } + } + } + i_this->mpMorf->play(&i_this->actor.eyePos, 0, 0); + if (i_this->mpBrkAnm != NULL) { + i_this->mpBrkAnm->play(); + } + i_this->mpMorf->modelCalc(); + i_this->mSound.framework(0, dComIfGp_getReverb(fopAcM_GetRoomNo(&i_this->actor))); + if (i_this->mKind2 == 3) { + cXyz* ctrlPtMtx; + for (s32 i = 0; i < 2; i++) { + MTXCopy(i_this->mpMorf->getModel()->getAnmMtx(0), *calc_mtx); + + if (i == 0) { + commonXyz.set(3.0f, 0.0f, 17.0f); + } else { + commonXyz.set(-3.0f, 0.0f, 17.0f); + } + + MtxPosition(&commonXyz, &i_this->field_0x754[i].mControlPoints[0]); + + cMtx_YrotS(*calc_mtx, i_this->actor.shape_angle.y); + cMtx_XrotM(*calc_mtx, i_this->actor.shape_angle.x); + cMtx_ZrotM(*calc_mtx, i_this->actor.shape_angle.z); + cMtx_YrotM(*calc_mtx, i_this->jointYaws2[0]); + + commonXyz.set(i == 0 ? 2.0f : -2.0f, 0.0f, 0.0f); + MtxPosition(&commonXyz, &i_this->field_0x754[i].mControlPoints[5]); + + ke_move(i_this, (mf_ke_s*)&i_this->field_0x754[i].mControlPoints[0], i); + } + } + + static cXyz mouth_off[11] = { + cXyz(25.0f, 5.0f, -8.0f), cXyz(25.0f, 0.0f, 2.0f), cXyz(30.0f, 0.0f, 2.0f), + cXyz(25.0f, -2.0f, 2.0f), cXyz(30.0f, 0.0f, 2.0f), cXyz(30.0f, 0.0f, 0.0f), + cXyz(15.0f, 0.0f, 0.0f), cXyz(15.0f, -1.0f, 0.0f), cXyz(15.0f, -1.0f, 0.0f), + cXyz(15.0f, -1.0f, 0.0f), cXyz(15.0f, -1.0f, 0.0f), + }; + MTXCopy(model->getAnmMtx(mouth_idx[i_this->mGedouKind]), *calc_mtx); + commonXyz = mouth_off[i_this->mGedouKind]; + MtxPosition(&commonXyz, &i_this->field_0x638); + if (i_this->mHookedState != 0) { + dmg_rod_class* rod = (dmg_rod_class*)fopAcM_SearchByID(i_this->mRodId); + if (rod->field_0xf80 == 4 && i_this->mCurAction == ACTION_MG_FISH_MF_CATCH) { + if (i_this->mKind2 == 0) { + f32 fVar3 = (i_this->mJointScale - 0.48f) * 100.0f; + if (fVar3 < 0.0f) { + fVar3 = 0.0f; + } + commonXyz.x += fVar3 + -45.0f; + commonXyz.z += -5.0f; + } else if (i_this->mKind2 == 2) { + commonXyz.x += -35.0f; + commonXyz.z += 7.0f; + } else if (i_this->mKind2 == 3) { + commonXyz.x += -35.0f; + commonXyz.y += 11.0f; + commonXyz.z += 5.0f; + } else if (i_this->mKind2 == 1) { + commonXyz.x += -30.0f; + commonXyz.z += 5.0f; + } + MtxPosition(&commonXyz, &i_this->field_0x638); + rod->current.angle.y = 0; + rod->current.angle.x = 0x4000; + rod->current.angle.z = player->shape_angle.y + 8000; + rod->shape_angle.x = rod->current.angle.x; + rod->shape_angle.y = rod->current.angle.y; + rod->shape_angle.z = rod->current.angle.z; + rod->field_0x114a = 0; + rod->field_0x114c = 0; + rod->field_0x1004 = 0; + } else { + if (rod->field_0xf80 == 0 && i_this->mGedouKind == GEDOU_KIND_RI_1) { + commonXyz.y += 8.0f; + commonXyz.z += -3.0f; + MtxPosition(&commonXyz, &i_this->field_0x638); + } + cLib_addCalcAngleS2(&rod->current.angle.y, i_this->actor.shape_angle.y - 0x1710, 2, 0x800); + cLib_addCalcAngleS2(&rod->current.angle.x, + i_this->actor.shape_angle.x + - 0x310c + rod->field_0x1006, 2, 0x800); + cLib_addCalcAngleS2(&rod->current.angle.z, 0x6328, 2, 0x800); + } + rod->current.pos.x = i_this->field_0x638.x; + rod->current.pos.y = i_this->field_0x638.y; + rod->current.pos.z = i_this->field_0x638.z; + rod->field_0x1000 = 0; + rod->field_0xffc = 0; + } + if (i_this->field_0x659 != 0) { + fopAc_ac_c* rod = fopAcM_SearchByID(i_this->mRodId); + if (rod != NULL) { + if (i_this->mCaughtType != 0) { + i_this->field_0x638 = i_this->actor.current.pos; + } + if (i_this->mCurAction >= ACTION_MG_FISH_MF_ESA_HIT) { + rod->current.pos = i_this->field_0x638; + } else { + cLib_addCalc2(&rod->current.pos.x, i_this->field_0x638.x, 1.0f, + i_this->field_0x650); + cLib_addCalc2(&rod->current.pos.y, i_this->field_0x638.y, 1.0f, + i_this->field_0x650); + cLib_addCalc2(&rod->current.pos.z, i_this->field_0x638.z, 1.0f, + i_this->field_0x650); + cLib_addCalc2(&i_this->field_0x650, 100.0f, 1.0f, 2.0f); + } + i_this->field_0x659--; + } else { + i_this->field_0x659 = 0; + } + } + return 1; } /* 80534964-8053496C 00AD24 0008+00 1/0 0/0 0/0 .text daMg_Fish_IsDelete__FP13mg_fish_class */ -static bool daMg_Fish_IsDelete(mg_fish_class* param_0) { - return true; +static int daMg_Fish_IsDelete(mg_fish_class* i_this) { + return 1; } /* 8053496C-805349DC 00AD2C 0070+00 1/0 0/0 0/0 .text daMg_Fish_Delete__FP13mg_fish_class */ -static void daMg_Fish_Delete(mg_fish_class* param_0) { - // NONMATCHING +static int daMg_Fish_Delete(mg_fish_class* i_this) { + fopAcM_GetID(i_this); + dComIfG_resDelete(&i_this->mPhaseReq, i_this->mResName); + if (i_this->field_0xc3f != 0) { + lit_1007 = 0; + } + if (i_this->actor.heap != NULL) { + i_this->mSound.deleteObject(); + } + return 1; } /* 805349DC-80534E90 00AD9C 04B4+00 1/1 0/0 0/0 .text useHeapInit2__FP10fopAc_ac_c */ -static void useHeapInit2(fopAc_ac_c* param_0) { - // NONMATCHING -} +static int useHeapInit2(fopAc_ac_c* i_actor) { + mg_fish_class* i_this = (mg_fish_class*)i_actor; -/* 80534E90-80534ED8 00B250 0048+00 1/0 0/0 0/0 .text __dt__12J3DFrameCtrlFv */ -// J3DFrameCtrl::~J3DFrameCtrl() { -extern "C" void __dt__12J3DFrameCtrlFv() { - // NONMATCHING + if (i_this->mGedouKind == GEDOU_KIND_BT) { + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(i_this->mResName, 3); + i_this->mpModel[0] = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); + if (i_this->mpModel[0] == 0) { + return 0; + } + } else if (i_this->mGedouKind == GEDOU_KIND_SP) { + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(i_this->mResName, 11); + i_this->mpModel[0] = mDoExt_J3DModel__create(modelData, 0, 0x11000084); + if (i_this->mpModel[0] == 0) { + return 0; + } + modelData = (J3DModelData*)dComIfG_getObjectRes(i_this->mResName, 5); + i_this->mpModel[1] = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); + if (i_this->mpModel[1] == 0) { + return 0; + } + modelData = (J3DModelData*)dComIfG_getObjectRes(i_this->mResName, 7); + i_this->mpModel[2] = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); + if (i_this->mpModel[2] == 0) { + return 0; + } + } else if (i_this->mGedouKind == GEDOU_KIND_LH) { + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(i_this->mResName, 3); + i_this->mpModel[0] = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); + if (i_this->mpModel[0] == 0) { + return 0; + } + i_this->mpModel[0]->setUserArea((s32)i_this); + for (u16 i = 0; i < modelData->getJointNum(); i++) { + i_this->mpModel[0]->mModelData->getJointNodePointer(i)->setCallBack(nodeCallBackLH); + } + } else if (i_this->mGedouKind == GEDOU_KIND_O_GD_BOTT) { + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(i_this->mResName, 6); + i_this->mpModel[0] = mDoExt_J3DModel__create(modelData, 0, 0x11020084); + if (i_this->mpModel[0] == NULL) { + return 0; + } + i_this->mpBtpAnm = new mDoExt_btpAnm(); + if (i_this->mpBtpAnm == 0) { + return 0; + } + J3DAnmTexPattern* pattern = (J3DAnmTexPattern*)dComIfG_getObjectRes(i_this->mResName, 15); + if (i_this->mpBtpAnm->init(&modelData->getMaterialTable(), + pattern, 1, 0, 1.0f, 0, -1) == 0) { + return 0; + } + } else if (i_this->mGedouKind == GEDOU_KIND_BB) { + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(i_this->mResName, 3); + i_this->mpModel[0] = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); + if (i_this->mpModel[0] == 0) { + return 0; + } + i_this->mpModel[0]->setUserArea((s32)i_this); + for (u16 i = 0; i < modelData->getJointNum(); i++) { + i_this->mpModel[0]->mModelData->getJointNodePointer(i)->setCallBack(nodeCallBackBB); + } + } else if (i_this->mGedouKind == GEDOU_KIND_KN) { + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(i_this->mResName, 6); + i_this->mpModel[0] = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); + if (i_this->mpModel[0] == 0) { + return 0; + } + } else if (i_this->mGedouKind == GEDOU_KIND_ED) { + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(i_this->mResName, 4); + i_this->mpModel[0] = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); + if (i_this->mpModel[0] == 0) { + return 0; + } + } else if (i_this->mGedouKind == GEDOU_KIND_SY) { + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(i_this->mResName, 8); + i_this->mpModel[0] = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); + if (i_this->mpModel[0] == NULL) { + return 0; + } + } + for (s32 i = 0; i < 3; i++) { + if (i_this->mpModel[i] != NULL) { + mDoMtx_stack_c::scaleS(0.0f, 0.0f, 0.0f); + mDoMtx_copy(mDoMtx_stack_c::now, i_this->mpModel[i]->mBaseTransformMtx); + } + } + return 1; } /* 80534ED8-80535138 00B298 0260+00 1/1 0/0 0/0 .text useHeapImg_fisht__FP10fopAc_ac_c */ -static void useHeapImg_fisht(fopAc_ac_c* param_0) { - // NONMATCHING +static int useHeapImg_fisht(fopAc_ac_c* i_actor) { + static u32 fish_bmd[11] = { + 8, 3, 3, 3, 4, 3, 8, 3, + 3, 3, 4, + }; + static u32 fish_joint[11] = { + 4, 6, 6, 6, 6, 3, 4, 6, + 6, 6, 6, + }; + + mg_fish_class* i_this = (mg_fish_class*)i_actor; + + if (i_this->mGedouKind == GEDOU_KIND_LM_1) { + i_this->mAnmTransform = (J3DAnmTransform*)dComIfG_getObjectRes(i_this->mResName, 4); + } else { + i_this->mAnmTransform = 0; + } + i_this->mpMorf = new mDoExt_McaMorf( + (J3DModelData*)dComIfG_getObjectRes(i_this->mResName, fish_bmd[i_this->mGedouKind]), + NULL, NULL, i_this->mAnmTransform, 0, 1.0f, 0, -1, 1, NULL, + 0x80000, 0x11000084); + if (i_this->mpMorf == NULL || i_this->mpMorf->getModel() == NULL) { + return 0; + } + + J3DModel* model = i_this->mpMorf->getModel(); + model->setUserArea((s32)i_this); + i_this->mNumJoints = fish_joint[i_this->mGedouKind]; + for (u16 i = 1; i < model->getModelData()->getJointNum(); i++) { + model->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack); + } + if (i_this->mKind2 == 3 && i_this->mLineMat.init(2, 5, 1) == 0) { + return 0; + } + + if (i_this->mKind2 == 4) { + i_this->mpBrkAnm = new mDoExt_brkAnm(); + if (i_this->mpBrkAnm == NULL) { + return 0; + } + J3DAnmTevRegKey* brk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(i_this->mResName, 7); + J3DModelData* modelData = model->getModelData(); + s32 iVar7 = i_this->mpBrkAnm->init(&modelData->getMaterialTable(), brk, 1, 2, + 1.0f, 0, -1); + if (iVar7 == 0) { + return 0; + } + i_this->mRotZ = 5000; + } + return 1; } -/* ############################################################################################## */ -/* 805363E4-805363E8 00027C 0004+00 0/1 0/0 0/0 .rodata @8763 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8763 = -200.0f; -COMPILER_STRIP_GATE(0x805363E4, &lit_8763); -#pragma pop - -/* 805363E8-805363EC 000280 0004+00 0/1 0/0 0/0 .rodata @8764 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8764 = 127.0f / 50.0f; -COMPILER_STRIP_GATE(0x805363E8, &lit_8764); -#pragma pop - -/* 805363EC-805363F0 000284 0004+00 0/1 0/0 0/0 .rodata @8765 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u32 const lit_8765 = 0x3D5A7B0B; -COMPILER_STRIP_GATE(0x805363EC, &lit_8765); -#pragma pop - -/* 805363F0-805363F4 000288 0004+00 0/1 0/0 0/0 .rodata @8766 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u32 const lit_8766 = 0x3CAC0831; -COMPILER_STRIP_GATE(0x805363F0, &lit_8766); -#pragma pop - -/* 805363F4-805363F8 00028C 0004+00 0/1 0/0 0/0 .rodata @8767 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8767 = 7.0f / 25.0f; -COMPILER_STRIP_GATE(0x805363F4, &lit_8767); -#pragma pop - -/* 805363F8-805363FC 000290 0004+00 0/1 0/0 0/0 .rodata @8768 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8768 = 67.0f / 100.0f; -COMPILER_STRIP_GATE(0x805363F8, &lit_8768); -#pragma pop - -/* 805363FC-80536400 000294 0004+00 0/1 0/0 0/0 .rodata @8769 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u32 const lit_8769 = 0x3D1FBE77; -COMPILER_STRIP_GATE(0x805363FC, &lit_8769); -#pragma pop - -/* 80536400-80536404 000298 0004+00 0/1 0/0 0/0 .rodata @8770 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8770 = 3.0f / 100.0f; -COMPILER_STRIP_GATE(0x80536400, &lit_8770); -#pragma pop - -/* 80536404-80536408 00029C 0004+00 0/1 0/0 0/0 .rodata @8771 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u32 const lit_8771 = 0x3CE6F71A; -COMPILER_STRIP_GATE(0x80536404, &lit_8771); -#pragma pop - -/* 80536408-8053640C 0002A0 0004+00 0/1 0/0 0/0 .rodata @8772 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u32 const lit_8772 = 0x3C35DCC6; -COMPILER_STRIP_GATE(0x80536408, &lit_8772); -#pragma pop - -/* 8053640C-80536410 0002A4 0004+00 0/1 0/0 0/0 .rodata @8773 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8773 = 17.0f / 20.0f; -COMPILER_STRIP_GATE(0x8053640C, &lit_8773); -#pragma pop - -/* 80536410-80536414 0002A8 0004+00 0/1 0/0 0/0 .rodata @8774 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8774 = 9.0f / 10.0f; -COMPILER_STRIP_GATE(0x80536410, &lit_8774); -#pragma pop - -/* 80536414-80536418 0002AC 0004+00 0/1 0/0 0/0 .rodata @8775 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8775 = 21.0f / 50.0f; -COMPILER_STRIP_GATE(0x80536414, &lit_8775); -#pragma pop - -/* 80536418-8053641C 0002B0 0004+00 0/1 0/0 0/0 .rodata @8776 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8776 = 20000.0f; -COMPILER_STRIP_GATE(0x80536418, &lit_8776); -#pragma pop - -/* 8053641C-80536420 0002B4 0004+00 0/1 0/0 0/0 .rodata @8777 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8777 = 110.0f; -COMPILER_STRIP_GATE(0x8053641C, &lit_8777); -#pragma pop - -/* 80536420-80536424 0002B8 0004+00 0/1 0/0 0/0 .rodata @8778 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8778 = 200000.0f; -COMPILER_STRIP_GATE(0x80536420, &lit_8778); -#pragma pop - -/* 80536424-80536428 0002BC 0004+00 0/1 0/0 0/0 .rodata @8779 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_8779 = 100000.0f; -COMPILER_STRIP_GATE(0x80536424, &lit_8779); -#pragma pop - -/* 80536428-80536430 0002C0 0008+00 0/1 0/0 0/0 .rodata @8781 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_8781[8] = { - 0x43, 0x30, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x80536428, &lit_8781); -#pragma pop - -/* 80536430-80536438 0002C8 0008+00 0/1 0/0 0/0 .rodata @8782 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_8782[8] = { - 0x43, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x80536430, &lit_8782); -#pragma pop - -/* 80536438-80536438 0002D0 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80536440 = "Mg_f_lm"; -SECTION_DEAD static char const* const stringBase_80536448 = "Mg_f_np"; -SECTION_DEAD static char const* const stringBase_80536450 = "Mg_f_cf"; -SECTION_DEAD static char const* const stringBase_80536458 = "Mg_f_ri"; -SECTION_DEAD static char const* const stringBase_80536460 = "Mg_f_ks"; -SECTION_DEAD static char const* const stringBase_80536468 = "Mg_f_bg"; -SECTION_DEAD static char const* const stringBase_80536470 = "Mg_f_bt"; -SECTION_DEAD static char const* const stringBase_80536478 = "Mg_f_sp"; -SECTION_DEAD static char const* const stringBase_80536480 = "Mg_f_bb"; -SECTION_DEAD static char const* const stringBase_80536488 = "Mg_f_lh"; -SECTION_DEAD static char const* const stringBase_80536490 = "O_gD_bott"; -SECTION_DEAD static char const* const stringBase_8053649A = "R_SP127"; -#pragma pop - /* 80535138-80535DA8 00B4F8 0C70+00 1/0 0/0 0/0 .text daMg_Fish_Create__FP10fopAc_ac_c */ -static void daMg_Fish_Create(fopAc_ac_c* param_0) { - // NONMATCHING +static int daMg_Fish_Create(fopAc_ac_c* i_this) { + /* 805369FC-80536A40 000558 0044+00 0/1 0/0 0/0 .data cc_cyl_src$8395 */ + static dCcD_SrcCyl cc_cyl_src = { + { + { 0x0, { { 0x0, 0x0, 0x0 }, { 0x0, 0x0 }, 0x75 } }, // mObj + { dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0 }, // mGObjAt + { dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x2 }, // mGObjTg + { 0 }, // mGObjCo + }, // mObjInf + { + { 0.0f, 0.0f, 0.0f }, // mCenter + 35.0f, // mRadius + 35.0f // mHeight + } // mCyl + }; + static f32 fish_max[11] = { + 0.828f, + 0.998f, + 0.998f, + 0.998f, + 0.708f, + 0.428f, + 0.448f, + 0.588f, + 0.588f, + 0.548f, + 0.708f, + }; + + fopAcM_SetupActor(i_this, mg_fish_class); + + mg_fish_class* a_this = (mg_fish_class*)i_this; + + a_this->mGedouKind = i_this->base.parameters; + + bool flag1 = false; + if (a_this->mGedouKind == 106) { + a_this->mGedouKind = GEDOU_KIND_BG; + flag1 = true; + } + + if (a_this->mGedouKind >= 100) { + a_this->mGedouKind = a_this->mGedouKind - 95; + } + + u32 heapSize = 0x1000; + if (a_this->mGedouKind == GEDOU_KIND_LM_1 || a_this->mGedouKind == GEDOU_KIND_LM_2) { + a_this->mKind2 = 0; + a_this->mResName = "Mg_f_lm"; + heapSize = 0x1420; + } else if (a_this->mGedouKind == GEDOU_KIND_NP_1 || a_this->mGedouKind == GEDOU_KIND_NP_2) { + a_this->mKind2 = 2; + a_this->mResName = "Mg_f_np"; + heapSize = 0xd60; + } else if (a_this->mGedouKind == GEDOU_KIND_CF_1 || a_this->mGedouKind == GEDOU_KIND_CF_2) { + a_this->mKind2 = 3; + a_this->mResName = "Mg_f_cf"; + heapSize = 0x1200; + } else if (a_this->mGedouKind == GEDOU_KIND_RI_1 || a_this->mGedouKind == GEDOU_KIND_RI_2) { + a_this->mKind2 = 1; + a_this->mResName = "Mg_f_ri"; + heapSize = 0xdc0; + } else if (a_this->mGedouKind == GEDOU_KIND_KS_1 || a_this->mGedouKind == GEDOU_KIND_KS_2) { + a_this->mKind2 = 4; + a_this->mResName = "Mg_f_ks"; + heapSize = 0x13d0; + } else if (a_this->mGedouKind == GEDOU_KIND_BG) { + a_this->mKind2 = 5; + a_this->mResName = "Mg_f_bg"; + heapSize = 0xc60; + } else if (a_this->mGedouKind == GEDOU_KIND_BT) { + a_this->mResName = "Mg_f_bt"; + } else if (a_this->mGedouKind == GEDOU_KIND_SP || a_this->mGedouKind == GEDOU_KIND_KN || + a_this->mGedouKind == GEDOU_KIND_ED || a_this->mGedouKind == GEDOU_KIND_SY) { + a_this->mResName = "Mg_f_sp"; + } else if (a_this->mGedouKind == GEDOU_KIND_BB) { + a_this->mResName = "Mg_f_bb"; + } else if (a_this->mGedouKind == GEDOU_KIND_LH) { + a_this->mResName = "Mg_f_lh"; + } else if (a_this->mGedouKind == GEDOU_KIND_O_GD_BOTT) { + a_this->mResName = "O_gD_bott"; + } + + lit_1008 = 1; + + cPhs__Step phase = (cPhs__Step)dComIfG_resLoad(&a_this->mPhaseReq, a_this->mResName); + cPhs__Step retval = phase; + + if (phase == cPhs_COMPLEATE_e) { + s32 params_0 = i_this->base.parameters >> 24; + if (params_0 != 0 && params_0 != 0xff && + g_dComIfG_gameInfo.info.isSwitch(params_0, fopAcM_GetRoomNo(i_this))) + { + return cPhs_ERROR_e; + } + + if (a_this->mGedouKind == GEDOU_KIND_BT || + a_this->mGedouKind == GEDOU_KIND_SP || + a_this->mGedouKind == GEDOU_KIND_BB || + a_this->mGedouKind == GEDOU_KIND_LH || + a_this->mGedouKind == GEDOU_KIND_O_GD_BOTT || + a_this->mGedouKind == GEDOU_KIND_KN || + a_this->mGedouKind == GEDOU_KIND_ED || + a_this->mGedouKind == GEDOU_KIND_SY) + { + s32 params_2 = i_this->base.parameters >> 8 & 0xff; + if (params_2 == 0xff) { + params_2 = 0x1e; + } + a_this->mJointScale = params_2 * 100; + heapSize = 0x3000; + if (a_this->mGedouKind == GEDOU_KIND_BT) { + heapSize = 0x800; + } else if (a_this->mGedouKind == GEDOU_KIND_LH) { + heapSize = 0x840; + } else if (a_this->mGedouKind == GEDOU_KIND_SP) { + heapSize = 0x1d40; + } else if (a_this->mGedouKind == GEDOU_KIND_KN) { + heapSize = 0x820; + } else if (a_this->mGedouKind == GEDOU_KIND_ED) { + heapSize = 0x800; + } else if (a_this->mGedouKind == GEDOU_KIND_SY) { + heapSize = 0x820; + } + + if (!fopAcM_entrySolidHeap(i_this, useHeapInit2, heapSize)) { + return cPhs_ERROR_e; + } + + return phase; + } + + if (!fopAcM_entrySolidHeap(i_this, useHeapImg_fisht, heapSize)) { + return cPhs_ERROR_e; + } + + if (lit_1007 == 0) { + a_this->field_0xc3f = 1; + lit_1007 = 1; + l_HIO.field_0x4 = -1; + } + a_this->mCcStatus.Init(0x1e, 0, i_this); + a_this->mCcCyl.Set(cc_cyl_src); + a_this->mCcCyl.SetStts(&a_this->mCcStatus); + i_this->cullMtx = a_this->mpMorf->getModel()->getBaseTRMtx(); + fopAcM_SetMin(i_this, -200.0f, -200.0f, -200.0f); + fopAcM_SetMax(i_this, 200.0f, 200.0f, 200.0f); + a_this->mAcch.Set(&i_this->current.pos, &i_this->old.pos, i_this, 1, &a_this->mAcchCir, + &i_this->speed, NULL, NULL); + a_this->field_0xc44 = dComIfGs_getEventReg(0xf11f); + a_this->mJointScale = 0.0001f + (i_this->base.parameters >> 8 & 0xff) * 0.01f; + if (a_this->mGedouKind >= GEDOU_KIND_BG) { + f32 fishMaxSize; + if (lit_1008 == 1) { + fishMaxSize = dComIfGs_getFishSize(a_this->mKind2) * 2.54f; + } else { + fishMaxSize = dComIfGs_getFishSize(a_this->mKind2); + } + if (fishMaxSize > 0.1f) { + if (lit_1008 != 0) { + a_this->mJointScale = fishMaxSize * 0.01f + cM_rndFX(0.05334f); + } else { + a_this->mJointScale = fishMaxSize * 0.01f + cM_rndFX(0.021f); + } + } else { + a_this->mJointScale = cM_rndFX(0.02f) + 0.28f; + if (a_this->mGedouKind != GEDOU_KIND_BG) { + if (a_this->mGedouKind == GEDOU_KIND_LM_2) { + a_this->mJointScale += 0.04f; + } else if (a_this->mGedouKind == GEDOU_KIND_KS_2) { + a_this->mJointScale = cM_rndFX(0.039f) + 0.67f; + } else if (a_this->mGedouKind == GEDOU_KIND_CF_2) { + a_this->mJointScale += 0.1f; + } else { + a_this->mJointScale += 0.1f; + } + } + } + } else { + if (a_this->mGedouKind <= GEDOU_KIND_CF_1) { + f32 jointScale = 100.0f * a_this->mJointScale; + f32 fVar1 = + lit_1008 == 1 ? + dComIfGs_getEventReg(check_kind[a_this->mGedouKind << 0]) * 2.54f : + dComIfGs_getEventReg(check_kind[a_this->mGedouKind << 0]); + if ((s32)jointScale <= (s32)fVar1) { + a_this->mJointScale = fVar1 * 0.01f; + f32 fVar2 = 0.05f; + if (a_this->mGedouKind == GEDOU_KIND_RI_1) { + fVar2 = 0.15f; + } else if (fVar1 >= 0.6f) { + fVar2 = 0.03f; + } + if (cM_rndF(1.0f) < fVar2) { + if (lit_1008 != 0) { + a_this->mJointScale += 0.028194f; + } else { + a_this->mJointScale += 0.0111f; + } + } else if (a_this->mGedouKind == GEDOU_KIND_RI_1) { + a_this->mJointScale *= 1.0f - cM_rndF(0.1f); + } else { + a_this->mJointScale *= 1.0f - cM_rndF(0.3f); + } + if (a_this->field_0xc44 >= 20 || + (a_this->mGedouKind != GEDOU_KIND_RI_1 && cM_rndF(1.0f) < 0.2f)) + { + a_this->mJointScale *= 0.8f; + } else if (a_this->field_0xc44 >= 10) { + a_this->mJointScale *= 0.85f; + } else if (a_this->field_0xc44 >= 5) { + a_this->mJointScale *= 0.9f; + } + } + if (a_this->mJointScale < 0.42f) { + a_this->mJointScale = cM_rndF(0.05f) + 0.4f; + } + } + } + if (a_this->mJointScale > fish_max[a_this->mGedouKind]) { + a_this->mJointScale = fish_max[a_this->mGedouKind]; + } + a_this->mAcchCir.SetWall(3.0f * a_this->mJointScale, 30.0f * a_this->mJointScale); + a_this->mBobTimer = cM_rndF(65536.0f); + a_this->jointYaws2[1] = cM_rndF(65536.0f); + a_this->mSound.init(&i_this->current.pos, &i_this->current.pos, 3, 1); + a_this->field_0x660 = 1.0f; + a_this->field_0x5ec = l_HIO.field_0x10; + if (a_this->mGedouKind == GEDOU_KIND_RI_1) { + a_this->mCurAction = ACTION_MG_FISH_RI_SWIM; + a_this->mActionPhase = 2; + a_this->field_0x624[0] = cM_rndF(200.0f) + 300.0f; + } else if (a_this->mGedouKind == GEDOU_KIND_CF_1) { + a_this->mCurAction = ACTION_MG_FISH_MF_SWIM_P; + a_this->field_0x5ec = 500.0f; + } else if (a_this->mGedouKind >= GEDOU_KIND_BG) { + a_this->mCurAction = ACTION_MG_FISH_MF_SWIM_S; + a_this->field_0x5ec = l_HIO.field_0x14; + if (flag1) { + a_this->field_0x5ec = 20000.0f; + } else { + a_this->field_0x5ec = 1000.0f; + } + a_this->field_0x624[2] = cM_rndF(1000.0f) + 1000.0f; + } else { + a_this->mCurAction = ACTION_MG_FISH_MF_STAY; + a_this->mActionPhase = 2; + } + s16 newYaw = cM_rndF(65536.0f); + i_this->current.angle.y = newYaw; + i_this->shape_angle.y = newYaw; + a_this->mMovementYaw = newYaw; + if (strcmp(dComIfGp_getStartStageName(), "R_SP127") == 0) { + a_this->mSurfaceY = 200.0f; + a_this->mGroundY = 60.0f; + i_this->current.pos.set(cM_rndFX(30.0f) + -720.0f, cM_rndF(30.0f) + 110.0f, + cM_rndFX(180.0f) + 70.0f); + if (a_this->mGedouKind == GEDOU_KIND_RI_1) { + a_this->mCurAction = ACTION_MG_FISH_RI_AQUA; + } else { + a_this->mCurAction = ACTION_MG_FISH_MF_AQUA; + if (a_this->mGedouKind == GEDOU_KIND_BG) { + a_this->mJointScale = cM_rndFX(0.03f) + 0.25f; + } + } + a_this->mActionPhase = 0; + } else if (strcmp(dComIfGp_getStartStageName(), "F_SP127") != 0) { + a_this->mSurfaceY = 200000.0f; + } + a_this->mDistToPlayer = 100000.0f; + a_this->field_0x632 = 20; + a_this->mNodeCallBack = nodeCallBack2; + if (a_this->mGedouKind < GEDOU_KIND_BG) { + a_this->field_0xc40 = 50.0f * a_this->field_0xc44 + 500.0f; + } else { + a_this->field_0xc40 = 300.0f; + } + daMg_Fish_Execute(a_this); + } + return retval; } -/* 80535DA8-80535DF0 00C168 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGCylFv */ -// cM3dGCyl::~cM3dGCyl() { -extern "C" void __dt__8cM3dGCylFv() { - // NONMATCHING -} +/* 80536A6C-80536A8C -00001 0020+00 1/0 0/0 0/0 .data l_daMg_Fish_Method */ +static actor_method_class l_daMg_Fish_Method = { + (process_method_func)daMg_Fish_Create, + (process_method_func)daMg_Fish_Delete, + (process_method_func)daMg_Fish_Execute, + (process_method_func)daMg_Fish_IsDelete, + (process_method_func)daMg_Fish_Draw, +}; -/* 80535DF0-80535E38 00C1B0 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGAabFv */ -// cM3dGAab::~cM3dGAab() { -extern "C" void __dt__8cM3dGAabFv() { - // NONMATCHING -} +/* 80536A8C-80536ABC -00001 0030+00 0/0 0/0 1/0 .data g_profile_MG_FISH */ +extern actor_process_profile_definition g_profile_MG_FISH = { + (uint)fpcLy_CURRENT_e, // mLayerID + 7, // mListID + fpcPi_CURRENT_e, // mListPrio + PROC_MG_FISH, // mProcName + &g_fpcLf_Method.base, // sub_method + sizeof(mg_fish_class), // mSize + 0, // mSizeOther + 0, // mParameters + &g_fopAc_Method.base, // sub_method + 720, // mPriority + &l_daMg_Fish_Method, // sub_method + 0x00040100, // mStatus + fopAc_ACTOR_e, // mActorType + fopAc_CULLBOX_CUSTOM_e, // cullType +}; -/* 80535E38-80535E94 00C1F8 005C+00 1/0 0/0 0/0 .text __dt__10dCcD_GSttsFv */ -// dCcD_GStts::~dCcD_GStts() { -extern "C" void __dt__10dCcD_GSttsFv() { - // NONMATCHING -} - -/* 80535E94-80535F04 00C254 0070+00 3/2 0/0 0/0 .text __dt__12dBgS_ObjAcchFv */ -// dBgS_ObjAcch::~dBgS_ObjAcch() { -extern "C" void __dt__12dBgS_ObjAcchFv() { - // NONMATCHING -} - -/* 80535F04-80535F74 00C2C4 0070+00 1/0 0/0 0/0 .text __dt__12dBgS_AcchCirFv */ -// dBgS_AcchCir::~dBgS_AcchCir() { -extern "C" void __dt__12dBgS_AcchCirFv() { - // NONMATCHING -} - -/* 80535F74-80535FD4 00C334 0060+00 1/1 0/0 0/0 .text __dt__7mf_ke_sFv */ -mf_ke_s::~mf_ke_s() { - // NONMATCHING -} - -/* 80535FD4-8053601C 00C394 0048+00 1/1 0/0 0/0 .text __ct__7mf_ke_sFv */ -mf_ke_s::mf_ke_s() { - // NONMATCHING -} - -/* 8053601C-80536058 00C3DC 003C+00 1/1 0/0 0/0 .text __dt__5csXyzFv */ -// csXyz::~csXyz() { -extern "C" void __dt__5csXyzFv() { - // NONMATCHING -} - -/* 80536058-8053605C 00C418 0004+00 1/1 0/0 0/0 .text __ct__5csXyzFv */ -// csXyz::csXyz() { -extern "C" void __ct__5csXyzFv() { - /* empty function */ -} - -/* 8053605C-80536060 00C41C 0004+00 2/2 0/0 0/0 .text __ct__4cXyzFv */ -// cXyz::cXyz() { -extern "C" void __ct__4cXyzFv() { - /* empty function */ -} - -/* 80536060-805360A8 00C420 0048+00 1/0 0/0 0/0 .text __dt__10cCcD_GSttsFv */ -// cCcD_GStts::~cCcD_GStts() { -extern "C" void __dt__10cCcD_GSttsFv() { - // NONMATCHING -} - -/* 805360A8-805360F0 00C468 0048+00 2/1 0/0 0/0 .text __dt__15daMg_Fish_HIO_cFv */ -daMg_Fish_HIO_c::~daMg_Fish_HIO_c() { - // NONMATCHING -} - -/* 805360F0-8053612C 00C4B0 003C+00 0/0 1/0 0/0 .text __sinit_d_a_mg_fish_cpp */ -void __sinit_d_a_mg_fish_cpp() { - // NONMATCHING -} - -#pragma push -#pragma force_active on -REGISTER_CTORS(0x805360F0, __sinit_d_a_mg_fish_cpp); -#pragma pop - -/* 8053612C-80536134 00C4EC 0008+00 1/0 0/0 0/0 .text @20@__dt__14dBgS_ObjGndChkFv */ -static void func_8053612C() { - // NONMATCHING -} - -/* 80536134-8053613C 00C4F4 0008+00 1/0 0/0 0/0 .text @76@__dt__14dBgS_ObjGndChkFv */ -static void func_80536134() { - // NONMATCHING -} - -/* 8053613C-80536144 00C4FC 0008+00 1/0 0/0 0/0 .text @60@__dt__14dBgS_ObjGndChkFv */ -static void func_8053613C() { - // NONMATCHING -} - -/* 80536144-8053614C 00C504 0008+00 1/0 0/0 0/0 .text @36@__dt__12dBgS_ObjAcchFv */ -static void func_80536144() { - // NONMATCHING -} - -/* 8053614C-80536154 00C50C 0008+00 1/0 0/0 0/0 .text @20@__dt__12dBgS_ObjAcchFv */ -static void func_8053614C() { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 80536CF8-80536CFC 000180 0004+00 0/0 0/0 0/0 .bss - * sInstance__40JASGlobalInstance<19JASDefaultBankTable> */ -#pragma push -#pragma force_active on -static u8 data_80536CF8[4]; -#pragma pop - -/* 80536CFC-80536D00 000184 0004+00 0/0 0/0 0/0 .bss - * sInstance__35JASGlobalInstance<14JASAudioThread> */ -#pragma push -#pragma force_active on -static u8 data_80536CFC[4]; -#pragma pop - -/* 80536D00-80536D04 000188 0004+00 0/0 0/0 0/0 .bss sInstance__27JASGlobalInstance<7Z2SeMgr> */ -#pragma push -#pragma force_active on -static u8 data_80536D00[4]; -#pragma pop - -/* 80536D04-80536D08 00018C 0004+00 0/0 0/0 0/0 .bss sInstance__28JASGlobalInstance<8Z2SeqMgr> */ -#pragma push -#pragma force_active on -static u8 data_80536D04[4]; -#pragma pop - -/* 80536D08-80536D0C 000190 0004+00 0/0 0/0 0/0 .bss sInstance__31JASGlobalInstance<10Z2SceneMgr> - */ -#pragma push -#pragma force_active on -static u8 data_80536D08[4]; -#pragma pop - -/* 80536D0C-80536D10 000194 0004+00 0/0 0/0 0/0 .bss sInstance__32JASGlobalInstance<11Z2StatusMgr> - */ -#pragma push -#pragma force_active on -static u8 data_80536D0C[4]; -#pragma pop - -/* 80536D10-80536D14 000198 0004+00 0/0 0/0 0/0 .bss sInstance__31JASGlobalInstance<10Z2DebugSys> - */ -#pragma push -#pragma force_active on -static u8 data_80536D10[4]; -#pragma pop - -/* 80536D14-80536D18 00019C 0004+00 0/0 0/0 0/0 .bss - * sInstance__36JASGlobalInstance<15JAISoundStarter> */ -#pragma push -#pragma force_active on -static u8 data_80536D14[4]; -#pragma pop - -/* 80536D18-80536D1C 0001A0 0004+00 0/0 0/0 0/0 .bss - * sInstance__35JASGlobalInstance<14Z2SoundStarter> */ -#pragma push -#pragma force_active on -static u8 data_80536D18[4]; -#pragma pop - -/* 80536D1C-80536D20 0001A4 0004+00 0/0 0/0 0/0 .bss - * sInstance__33JASGlobalInstance<12Z2SpeechMgr2> */ -#pragma push -#pragma force_active on -static u8 data_80536D1C[4]; -#pragma pop - -/* 80536D20-80536D24 0001A8 0004+00 0/0 0/0 0/0 .bss sInstance__28JASGlobalInstance<8JAISeMgr> */ -#pragma push -#pragma force_active on -static u8 data_80536D20[4]; -#pragma pop - -/* 80536D24-80536D28 0001AC 0004+00 0/0 0/0 0/0 .bss sInstance__29JASGlobalInstance<9JAISeqMgr> */ -#pragma push -#pragma force_active on -static u8 data_80536D24[4]; -#pragma pop - -/* 80536D28-80536D2C 0001B0 0004+00 0/0 0/0 0/0 .bss - * sInstance__33JASGlobalInstance<12JAIStreamMgr> */ -#pragma push -#pragma force_active on -static u8 data_80536D28[4]; -#pragma pop - -/* 80536D2C-80536D30 0001B4 0004+00 0/0 0/0 0/0 .bss sInstance__31JASGlobalInstance<10Z2SoundMgr> - */ -#pragma push -#pragma force_active on -static u8 data_80536D2C[4]; -#pragma pop - -/* 80536D30-80536D34 0001B8 0004+00 0/0 0/0 0/0 .bss - * sInstance__33JASGlobalInstance<12JAISoundInfo> */ -#pragma push -#pragma force_active on -static u8 data_80536D30[4]; -#pragma pop - -/* 80536D34-80536D38 0001BC 0004+00 0/0 0/0 0/0 .bss - * sInstance__34JASGlobalInstance<13JAUSoundTable> */ -#pragma push -#pragma force_active on -static u8 data_80536D34[4]; -#pragma pop - -/* 80536D38-80536D3C 0001C0 0004+00 0/0 0/0 0/0 .bss - * sInstance__38JASGlobalInstance<17JAUSoundNameTable> */ -#pragma push -#pragma force_active on -static u8 data_80536D38[4]; -#pragma pop - -/* 80536D3C-80536D40 0001C4 0004+00 0/0 0/0 0/0 .bss - * sInstance__33JASGlobalInstance<12JAUSoundInfo> */ -#pragma push -#pragma force_active on -static u8 data_80536D3C[4]; -#pragma pop - -/* 80536D40-80536D44 0001C8 0004+00 0/0 0/0 0/0 .bss sInstance__32JASGlobalInstance<11Z2SoundInfo> - */ -#pragma push -#pragma force_active on -static u8 data_80536D40[4]; -#pragma pop - -/* 80536D44-80536D48 0001CC 0004+00 0/0 0/0 0/0 .bss - * sInstance__34JASGlobalInstance<13Z2SoundObjMgr> */ -#pragma push -#pragma force_active on -static u8 data_80536D44[4]; -#pragma pop - -/* 80536D48-80536D4C 0001D0 0004+00 0/0 0/0 0/0 .bss sInstance__31JASGlobalInstance<10Z2Audience> - */ -#pragma push -#pragma force_active on -static u8 data_80536D48[4]; -#pragma pop - -/* 80536D4C-80536D50 0001D4 0004+00 0/0 0/0 0/0 .bss sInstance__32JASGlobalInstance<11Z2FxLineMgr> - */ -#pragma push -#pragma force_active on -static u8 data_80536D4C[4]; -#pragma pop - -/* 80536D50-80536D54 0001D8 0004+00 0/0 0/0 0/0 .bss sInstance__31JASGlobalInstance<10Z2EnvSeMgr> - */ -#pragma push -#pragma force_active on -static u8 data_80536D50[4]; -#pragma pop - -/* 80536D54-80536D58 0001DC 0004+00 0/0 0/0 0/0 .bss sInstance__32JASGlobalInstance<11Z2SpeechMgr> - */ -#pragma push -#pragma force_active on -static u8 data_80536D54[4]; -#pragma pop - -/* 80536D58-80536D5C 0001E0 0004+00 0/0 0/0 0/0 .bss - * sInstance__34JASGlobalInstance<13Z2WolfHowlMgr> */ -#pragma push -#pragma force_active on -static u8 data_80536D58[4]; -#pragma pop - -/* 80536438-80536438 0002D0 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ +AUDIO_INSTANCES diff --git a/src/d/actor/d_a_npc_ne.cpp b/src/d/actor/d_a_npc_ne.cpp index a80adda81f2..9af4e9eacd0 100644 --- a/src/d/actor/d_a_npc_ne.cpp +++ b/src/d/actor/d_a_npc_ne.cpp @@ -802,8 +802,8 @@ static cXyz ground_search(npc_ne_class* i_this) { static void* s_fish_sub(void* i_proc, void* i_this) { npc_ne_class* _this = static_cast(i_this); if (fopAc_IsActor(i_proc) && fopAcM_GetName(i_proc) == PROC_MG_FISH) { - mg_fish_class* fish = static_cast(i_proc); - if (fish->field_0x5b6 == 0x35 && fish->field_0x5b8 >= 10) { + mg_fish_class* fish = (mg_fish_class*)i_proc; + if (fish->mCurAction == 0x35 && fish->mActionPhase >= 10) { _this->mFishID = fopAcM_GetID(fish); return i_proc; } @@ -2852,7 +2852,7 @@ static void demo_camera(npc_ne_class* i_this) { } if (i_this->mDemoCounter <= 38) { - mg_fish_class* fish = static_cast(fopAcM_SearchByID(i_this->mFishID)); + mg_fish_class* fish = (mg_fish_class*)fopAcM_SearchByID(i_this->mFishID); if (i_this->mDemoCounter == 0) { vec.x = 0.0f; vec.y = 0.0f; @@ -2860,10 +2860,10 @@ static void demo_camera(npc_ne_class* i_this) { MtxPosition(&vec, &i_this->mDemoFishPos); i_this->mDemoFishPos += i_this->current.pos; } - fish->current.pos.x = i_this->mDemoFishPos.x; - fish->current.pos.z = i_this->mDemoFishPos.z; + fish->actor.current.pos.x = i_this->mDemoFishPos.x; + fish->actor.current.pos.z = i_this->mDemoFishPos.z; if (i_this->mDemoCounter >= 25) { - cLib_addCalc2(&fish->current.pos.y, i_this->mAcch.GetGroundH() + 10.0f, + cLib_addCalc2(&fish->actor.current.pos.y, i_this->mAcch.GetGroundH() + 10.0f, 0.2f, 30.0f); } if (i_this->mDemoCounter == 38) { @@ -3128,15 +3128,15 @@ static int daNpc_Ne_Execute(npc_ne_class* i_this) { } if (i_this->mFishID != -1 && i_this->field_0xcc0) { - mg_fish_class* fish = static_cast(fopAcM_SearchByID(i_this->mFishID)); + mg_fish_class* fish = (mg_fish_class*)fopAcM_SearchByID(i_this->mFishID); PSMTXCopy(model->getAnmMtx(4), mDoMtx_stack_c::get()); mDoMtx_stack_c::ZrotM(-19000); mDoMtx_stack_c::scaleM(0.5f, 0.5f, 0.5f); mDoMtx_stack_c::transM(5.0f, 35.0f, 15.0f); fish->mpMorf->getModel()->setBaseTRMtx(mDoMtx_stack_c::get()); int ivar3 = cM_ssin(g_Counter.mTimer * 15000) * 1500.0f; - for (int i = 0; i <= fish->field_0x72c; i++) { - fish->field_0x718[i] = ivar3; + for (int i = 0; i <= fish->mNumJoints; i++) { + fish->jointYaws1[i] = ivar3; } for (u16 i = 1; i < fish->mpMorf->getModel()->getModelData()->getJointNum(); i++) { fish->mpMorf->getModel()->getModelData() @@ -3144,8 +3144,8 @@ static int daNpc_Ne_Execute(npc_ne_class* i_this) { } fish->mpMorf->play(NULL, 0, 0); fish->mpMorf->modelCalc(); - fish->current.pos = i_this->eyePos; - fish->eyePos = i_this->eyePos; + fish->actor.current.pos = i_this->eyePos; + fish->actor.eyePos = i_this->eyePos; } if (i_this->current.pos.y - i_this->home.pos.y < -5000.0f && fopAcM_CheckCondition(i_this, 4)) {