diff --git a/Progress.md b/Progress.md index 4b60f0c465f..48120b21741 100644 --- a/Progress.md +++ b/Progress.md @@ -21,8 +21,8 @@ Total | 53.029643% | 2132148 | 4020672 Section | Percentage | Decompiled (bytes) | Total (bytes) ---|---|---|--- main.dol | 53.029643% | 2132148 | 4020672 -RELs | 36.975202% | 4252268 | 11500324 -Total | 41.134061% | 6384416 | 15520996 +RELs | 37.015931% | 4256952 | 11500324 +Total | 41.164240% | 6389100 | 15520996 ## RELs @@ -87,7 +87,7 @@ d_a_dshutter | 94.779772% | 4648 | 4904 d_a_e_ai | 28.308171% | 5100 | 18016 d_a_e_arrow | 100.000000% | 12904 | 12904 d_a_e_ba | 28.140394% | 5484 | 19488 -d_a_e_bee | 30.316629% | 4864 | 16044 +d_a_e_bee | 31.987036% | 5132 | 16044 d_a_e_bg | 27.665091% | 7256 | 26228 d_a_e_bi | 30.767563% | 5676 | 18448 d_a_e_bi_leaf | 100.000000% | 1792 | 1792 @@ -398,7 +398,7 @@ d_a_obj_dust | 40.406977% | 2224 | 5504 d_a_obj_eff | 100.000000% | 936 | 936 d_a_obj_enemy_create | 100.000000% | 2828 | 2828 d_a_obj_fallobj | 31.929604% | 2032 | 6364 -d_a_obj_fan | 39.173554% | 2844 | 7260 +d_a_obj_fan | 100.000000% | 7260 | 7260 d_a_obj_fchain | 30.649490% | 2284 | 7452 d_a_obj_fireWood | 44.125561% | 1968 | 4460 d_a_obj_fireWood2 | 41.290323% | 2304 | 5580 @@ -785,4 +785,4 @@ d_a_vrbox2 | 44.907111% | 2804 | 6244 d_a_warp_bug | 100.000000% | 2024 | 2024 d_a_ykgr | 44.400631% | 2252 | 5072 f_pc_profile_lst | 100.000000% | 28156 | 28156 -Total | 36.975202% | 4252268 | 11500324 +Total | 37.015931% | 4256952 | 11500324 diff --git a/asm/rel/d/a/e/d_a_e_bee/d_a_e_bee/daE_Bee_Draw__FP11e_bee_class.s b/asm/rel/d/a/e/d_a_e_bee/d_a_e_bee/daE_Bee_Draw__FP11e_bee_class.s deleted file mode 100644 index a4d7604e9ec..00000000000 --- a/asm/rel/d/a/e/d_a_e_bee/d_a_e_bee/daE_Bee_Draw__FP11e_bee_class.s +++ /dev/null @@ -1,74 +0,0 @@ -lbl_8068289C: -/* 8068289C 94 21 FF E0 */ stwu r1, -0x20(r1) -/* 806828A0 7C 08 02 A6 */ mflr r0 -/* 806828A4 90 01 00 24 */ stw r0, 0x24(r1) -/* 806828A8 39 61 00 20 */ addi r11, r1, 0x20 -/* 806828AC 4B CD F9 29 */ bl _savegpr_27 -/* 806828B0 7C 7F 1B 78 */ mr r31, r3 -/* 806828B4 3C 60 80 43 */ lis r3, g_env_light@ha /* 0x8042CA54@ha */ -/* 806828B8 38 63 CA 54 */ addi r3, r3, g_env_light@l /* 0x8042CA54@l */ -/* 806828BC 38 80 00 00 */ li r4, 0 -/* 806828C0 38 BF 04 D0 */ addi r5, r31, 0x4d0 -/* 806828C4 38 DF 01 0C */ addi r6, r31, 0x10c -/* 806828C8 4B B2 0E FD */ bl settingTevStruct__18dScnKy_env_light_cFiP4cXyzP12dKy_tevstr_c -/* 806828CC 3B BF 05 A0 */ addi r29, r31, 0x5a0 -/* 806828D0 88 1F 04 E2 */ lbz r0, 0x4e2(r31) -/* 806828D4 7C 00 07 74 */ extsb r0, r0 -/* 806828D8 7C 1C 03 78 */ mr r28, r0 -/* 806828DC 3B 60 00 00 */ li r27, 0 -/* 806828E0 3C 60 80 40 */ lis r3, g_dComIfG_gameInfo@ha /* 0x804061C0@ha */ -/* 806828E4 38 63 61 C0 */ addi r3, r3, g_dComIfG_gameInfo@l /* 0x804061C0@l */ -/* 806828E8 3B C3 0F 38 */ addi r30, r3, 0xf38 -/* 806828EC 48 00 00 94 */ b lbl_80682980 -lbl_806828F0: -/* 806828F0 88 1D 00 4C */ lbz r0, 0x4c(r29) -/* 806828F4 7C 00 07 75 */ extsb. r0, r0 -/* 806828F8 41 82 00 80 */ beq lbl_80682978 -/* 806828FC 88 1D 00 50 */ lbz r0, 0x50(r29) -/* 80682900 28 00 00 00 */ cmplwi r0, 0 -/* 80682904 40 82 00 74 */ bne lbl_80682978 -/* 80682908 88 1D 00 4E */ lbz r0, 0x4e(r29) -/* 8068290C 7C 00 07 75 */ extsb. r0, r0 -/* 80682910 40 82 00 38 */ bne lbl_80682948 -/* 80682914 A8 1D 00 48 */ lha r0, 0x48(r29) -/* 80682918 54 00 07 7B */ rlwinm. r0, r0, 0, 0x1d, 0x1d -/* 8068291C 41 82 00 18 */ beq lbl_80682934 -/* 80682920 7F C3 F3 78 */ mr r3, r30 -/* 80682924 80 9D 00 08 */ lwz r4, 8(r29) -/* 80682928 7F 85 E3 78 */ mr r5, r28 -/* 8068292C 4B 9A A2 3D */ bl entrySimpleModel__14dComIfG_play_cFP8J3DModeli -/* 80682930 48 00 00 48 */ b lbl_80682978 -lbl_80682934: -/* 80682934 7F C3 F3 78 */ mr r3, r30 -/* 80682938 80 9D 00 0C */ lwz r4, 0xc(r29) -/* 8068293C 7F 85 E3 78 */ mr r5, r28 -/* 80682940 4B 9A A2 29 */ bl entrySimpleModel__14dComIfG_play_cFP8J3DModeli -/* 80682944 48 00 00 34 */ b lbl_80682978 -lbl_80682948: -/* 80682948 A8 1D 00 48 */ lha r0, 0x48(r29) -/* 8068294C 54 00 07 FF */ clrlwi. r0, r0, 0x1f -/* 80682950 41 82 00 18 */ beq lbl_80682968 -/* 80682954 7F C3 F3 78 */ mr r3, r30 -/* 80682958 80 9D 00 00 */ lwz r4, 0(r29) -/* 8068295C 7F 85 E3 78 */ mr r5, r28 -/* 80682960 4B 9A A2 09 */ bl entrySimpleModel__14dComIfG_play_cFP8J3DModeli -/* 80682964 48 00 00 14 */ b lbl_80682978 -lbl_80682968: -/* 80682968 7F C3 F3 78 */ mr r3, r30 -/* 8068296C 80 9D 00 04 */ lwz r4, 4(r29) -/* 80682970 7F 85 E3 78 */ mr r5, r28 -/* 80682974 4B 9A A1 F5 */ bl entrySimpleModel__14dComIfG_play_cFP8J3DModeli -lbl_80682978: -/* 80682978 3B 7B 00 01 */ addi r27, r27, 1 -/* 8068297C 3B BD 00 74 */ addi r29, r29, 0x74 -lbl_80682980: -/* 80682980 80 1F 22 A0 */ lwz r0, 0x22a0(r31) -/* 80682984 7C 1B 00 00 */ cmpw r27, r0 -/* 80682988 41 80 FF 68 */ blt lbl_806828F0 -/* 8068298C 38 60 00 01 */ li r3, 1 -/* 80682990 39 61 00 20 */ addi r11, r1, 0x20 -/* 80682994 4B CD F8 8D */ bl _restgpr_27 -/* 80682998 80 01 00 24 */ lwz r0, 0x24(r1) -/* 8068299C 7C 08 03 A6 */ mtlr r0 -/* 806829A0 38 21 00 20 */ addi r1, r1, 0x20 -/* 806829A4 4E 80 00 20 */ blr diff --git a/include/d/a/d_a_player.h b/include/d/a/d_a_player.h index 9892e8777ef..2bf7ab4e5e3 100644 --- a/include/d/a/d_a_player.h +++ b/include/d/a/d_a_player.h @@ -236,7 +236,7 @@ public: FLG0_MAGNE_BOOTS_ON = 0x1000, FLG0_PUSH_PULL_KEEP = 0x800, FLG0_UNK_400 = 0x400, - FLG0_UNK_100 = 0x100, + FLG0_SWIM_UP = 0x100, FLG0_UNK_80 = 0x80, FLG0_UNK_40 = 0x40, FLG0_UNK_20 = 0x20, @@ -346,7 +346,7 @@ public: ERFLG0_BOSS_ROOM_WAIT = 0x2000000, ERFLG0_UNK_1000000 = 0x1000000, ERFLG0_UNK_800000 = 0x800000, - ERFLG0_UNK_400000 = 0x400000, + ERFLG0_BEE_FOLLOW = 0x400000, ERFLG0_UNK_200000 = 0x200000, ERFLG0_UNK_100000 = 0x100000, ERFLG0_UNK_2000 = 0x2000, @@ -741,8 +741,10 @@ public: bool checkWolfTagLockJumpReady() const { return checkResetFlg0(RFLG0_UNK_20000); } bool getGrabUpEnd() const { return checkResetFlg0(RFLG0_GRAB_UP_END); } bool getGrabPutStart() const { return checkResetFlg0(RFLG0_GRAB_PUT_START); } + bool checkSwimUp() const { return checkNoResetFlg0(FLG0_SWIM_UP); } void onBossRoomWait() { onEndResetFlg0(ERFLG0_BOSS_ROOM_WAIT); } + void onBeeFollow() { onEndResetFlg0(ERFLG0_BEE_FOLLOW); } void onForceAutoJump() { onEndResetFlg0(ERFLG0_FORCE_AUTO_JUMP); } void onNotAutoJump() { onEndResetFlg0(ERFLG0_NOT_AUTO_JUMP); } void onNotHang() { onEndResetFlg0(ERFLG0_NOT_HANG); } diff --git a/include/d/cc/d_cc_uty.h b/include/d/cc/d_cc_uty.h index 5185f389428..d66e39ad862 100644 --- a/include/d/cc/d_cc_uty.h +++ b/include/d/cc/d_cc_uty.h @@ -29,8 +29,13 @@ struct dCcU_AtInfo { /* 0x20 */ u8 mHitType; }; -fopAc_ac_c* cc_at_check(fopAc_ac_c*,dCcU_AtInfo*); +u16 cc_pl_cut_bit_get(); +fopAc_ac_c* cc_at_check(fopAc_ac_c*, dCcU_AtInfo*); fopAc_ac_c* at_power_check(dCcU_AtInfo* i_AtInfo); void def_se_set(Z2Creature* p_sound, cCcD_Obj* p_collider, u32 map_info, fopAc_ac_c* p_actor); +inline fopAc_ac_c* dCc_GetAc(void* i_actor) { + return static_cast(i_actor); +} + #endif /* D_CC_D_CC_UTY_H */ diff --git a/include/rel/d/a/e/d_a_e_bee/d_a_e_bee.h b/include/rel/d/a/e/d_a_e_bee/d_a_e_bee.h index 621f1fa97da..b4e664b8514 100644 --- a/include/rel/d/a/e/d_a_e_bee/d_a_e_bee.h +++ b/include/rel/d/a/e/d_a_e_bee/d_a_e_bee.h @@ -1,6 +1,85 @@ #ifndef D_A_E_BEE_H #define D_A_E_BEE_H +#include "f_op/f_op_actor.h" +#include "SSystem/SComponent/c_phase.h" +#include "Z2AudioLib/Z2Creature.h" +#include "d/cc/d_cc_d.h" #include "dolphin/types.h" +struct bee_s { + enum Action { + /* 0x0 */ ACT_DEAD, + /* 0x1 */ ACT_FLY, + /* 0x2 */ ACT_FLY_HOME_A, + /* 0x3 */ ACT_FLY_HOME_B, + /* 0x4 */ ACT_FAIL, + /* 0x5 */ ACT_START, + /* 0xA */ ACT_HOME = 10, + }; + + /* 80685368 */ bee_s() {} + /* 806852FC */ ~bee_s() {} + + /* 0x00 */ J3DModel* mpModel1; + /* 0x04 */ J3DModel* mpModel2; + /* 0x08 */ J3DModel* mpModel3; + /* 0x0C */ J3DModel* mpModel4; + /* 0x10 */ cXyz mPos; + /* 0x1C */ cXyz mTarget; + /* 0x28 */ cXyz mSpeed; + /* 0x34 */ csXyz mAngle; + /* 0x3C */ f32 mSpeedF; + /* 0x40 */ f32 mScale; + /* 0x44 */ f32 mStartDistance; + /* 0x48 */ s16 mCounter; + /* 0x4A */ s16 mHomeTimer; + /* 0x4C */ s8 mAction; + /* 0x4D */ s8 mMode; + /* 0x4E */ s8 mIsFlying; + /* 0x4F */ u8 mTimer; + /* 0x50 */ bool mNoDraw; + /* 0x54 */ Z2SoundObjSimple mSound; +}; + +STATIC_ASSERT(sizeof(bee_s) == 0x74); + +class e_bee_class : public fopAc_ac_c { +public: + /* 0x0568 */ request_of_phase_process_class mPhase; + /* 0x0570 */ u8 mParam0; + /* 0x0571 */ u8 mParam1; + /* 0x0572 */ u8 mParam2; + /* 0x0574 */ Z2SoundObjBeeGroup mSound; + /* 0x0594 */ s16 mCounter; + /* 0x0596 */ u8 unused_0x596[4]; + /* 0x059A */ s16 mTimers[2]; + /* 0x059E */ u8 mCcSetTimer; + /* 0x059F */ u8 mHomeTimer; + /* 0x05A0 */ bee_s mBees[0x40]; + /* 0x22A0 */ int mNumBees; + /* 0x22A4 */ u8 unused_0x22a4[0x30]; + /* 0x22D4 */ dCcD_Stts mCcStts; + /* 0x2310 */ dCcD_Cyl mCcCyl; + /* 0x244C */ dCcD_Sph mCcSph; + /* 0x2584 */ s16 mBoomerangAngle; + /* 0x2586 */ bool mHIOInit; + /* 0x2587 */ bool mResLoaded; +}; + +STATIC_ASSERT(sizeof(e_bee_class) == 0x2588); + +class daE_Bee_HIO_c { +public: + /* 8068286C */ daE_Bee_HIO_c(); + /* 8068539C */ virtual ~daE_Bee_HIO_c() {} + + /* 0x4 */ s8 field_0x4; + /* 0x8 */ f32 mScale; + /* 0xC */ bool mDelete; + /* 0xD */ bool mNoKill; +}; + +STATIC_ASSERT(sizeof(daE_Bee_HIO_c) == 0x10); + #endif /* D_A_E_BEE_H */ diff --git a/rel/d/a/e/d_a_e_bee/d_a_e_bee.cpp b/rel/d/a/e/d_a_e_bee/d_a_e_bee.cpp index 14714f89d79..4969b55e5a8 100644 --- a/rel/d/a/e/d_a_e_bee/d_a_e_bee.cpp +++ b/rel/d/a/e/d_a_e_bee/d_a_e_bee.cpp @@ -1,117 +1,19 @@ -// -// Generated By: dol2asm -// Translation Unit: d_a_e_bee -// +/** + * d_a_e_bee.cpp + * Enemy - Bees + */ #include "rel/d/a/e/d_a_e_bee/d_a_e_bee.h" -#include "d/cc/d_cc_d.h" +#include "rel/d/a/e/d_a_e_nest/d_a_e_nest.h" +#include "SSystem/SComponent/c_math.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "d/cc/d_cc_uty.h" +#include "f_op/f_op_actor_mng.h" +#include "d/com/d_com_inf_game.h" +#include "d/a/d_a_player.h" +#include "d/d_procname.h" #include "dol2asm.h" -// -// Types: -// - -struct request_of_phase_process_class {}; - -struct mDoMtx_stack_c { - /* 8000CD9C */ void transM(f32, f32, f32); - /* 8000CE38 */ void scaleM(f32, f32, f32); - - static u8 now[48]; -}; - -struct fopAc_ac_c { - /* 80018B64 */ fopAc_ac_c(); -}; - -struct e_bee_class {}; - -struct daE_Bee_HIO_c { - /* 8068286C */ daE_Bee_HIO_c(); - /* 8068539C */ ~daE_Bee_HIO_c(); -}; - -struct dVibration_c { - /* 8006FA24 */ void StartShock(int, int, cXyz); -}; - -struct dKy_tevstr_c {}; - -struct dScnKy_env_light_c { - /* 801A37C4 */ void settingTevStruct(int, cXyz*, dKy_tevstr_c*); -}; - -struct dRes_info_c {}; - -struct dRes_control_c { - /* 8003C2EC */ void getRes(char const*, s32, dRes_info_c*, int); -}; - -struct csXyz {}; - -struct dPa_control_c { - /* 8004C218 */ void setHitMark(u16, fopAc_ac_c*, cXyz const*, csXyz const*, cXyz const*, u32); -}; - -struct J3DModel {}; - -struct J3DModelData {}; - -struct dComIfG_play_c { - /* 8002CAF0 */ void addSimpleModel(J3DModelData*, int, u8); - /* 8002CB30 */ void removeSimpleModel(J3DModelData*, int); - /* 8002CB68 */ void entrySimpleModel(J3DModel*, int); -}; - -struct dBgS_LinChk { - /* 80077C68 */ dBgS_LinChk(); - /* 80077CDC */ ~dBgS_LinChk(); - /* 80077D64 */ void Set(cXyz const*, cXyz const*, fopAc_ac_c const*); -}; - -struct dBgS_GndChk { - /* 8007757C */ dBgS_GndChk(); - /* 800775F0 */ ~dBgS_GndChk(); -}; - -struct cCcS { - /* 80264BA8 */ void Set(cCcD_Obj*); -}; - -struct cBgS_LinChk {}; - -struct cBgS_GndChk { - /* 80267D28 */ void SetPos(cXyz const*); -}; - -struct cBgS { - /* 800743B4 */ void LineCross(cBgS_LinChk*); - /* 800744A0 */ void GroundCross(cBgS_GndChk*); -}; - -struct bee_s { - /* 806852FC */ ~bee_s(); - /* 80685368 */ bee_s(); -}; - -struct Z2SoundObjSimple { - /* 802BE844 */ Z2SoundObjSimple(); -}; - -struct Z2SoundObjBeeGroup { - /* 802C1D10 */ Z2SoundObjBeeGroup(); - /* 802C1D6C */ void playBeeGroupSound(JAISoundID, u8); -}; - -struct Z2SoundObjBase { - /* 802BDF48 */ ~Z2SoundObjBase(); - /* 802BDFF8 */ void deleteObject(); -}; - -struct JMath { - static u8 sincosTable_[65536]; -}; - // // Forward References: // @@ -139,6 +41,10 @@ extern "C" void __ct__5bee_sFv(); extern "C" void __dt__13daE_Bee_HIO_cFv(); extern "C" void __sinit_d_a_e_bee_cpp(); extern "C" extern char const* const d_a_e_bee__stringBase0; +extern void* __vt__8cM3dGSph[3]; +extern void* __vt__8cM3dGCyl[3]; +extern void* __vt__8cM3dGAab[3]; +extern void* __vt__13daE_Bee_HIO_c[3]; // // External References: @@ -206,8 +112,6 @@ extern "C" void __ct__16Z2SoundObjSimpleFv(); extern "C" void __ct__18Z2SoundObjBeeGroupFv(); extern "C" void playBeeGroupSound__18Z2SoundObjBeeGroupF10JAISoundIDUc(); extern "C" void __dl__FPv(); -extern "C" void PSMTXCopy(); -extern "C" void PSMTXTrans(); extern "C" void __construct_array(); extern "C" void _savegpr_19(); extern "C" void _savegpr_23(); @@ -221,8 +125,6 @@ extern "C" void _restgpr_25(); extern "C" void _restgpr_26(); extern "C" void _restgpr_27(); extern "C" void _restgpr_28(); -extern "C" extern void* g_fopAc_Method[8]; -extern "C" extern void* g_fpcLf_Method[5 + 1 /* padding */]; extern "C" extern void* __vt__8dCcD_Sph[36]; extern "C" extern void* __vt__8dCcD_Cyl[36]; extern "C" extern void* __vt__9dCcD_Stts[11]; @@ -232,10 +134,7 @@ extern "C" extern void* __vt__14cCcD_ShapeAttr[22]; extern "C" extern void* __vt__9cCcD_Stts[8]; extern "C" extern void* __vt__16Z2SoundObjSimple[8]; extern "C" u8 now__14mDoMtx_stack_c[48]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; -extern "C" extern u8 g_env_light[4880]; extern "C" u8 sincosTable___5JMath[65536]; -extern "C" extern void* calc_mtx[1 + 1 /* padding */]; extern "C" void __register_global_object(); // @@ -275,57 +174,16 @@ static dCcD_SrcSph at_sph_src = { } // mSphAttr }; -/* 806855B0-806855D0 -00001 0020+00 1/0 0/0 0/0 .data l_daE_Bee_Method */ -SECTION_DATA static void* l_daE_Bee_Method[8] = { - (void*)daE_Bee_Create__FP10fopAc_ac_c, - (void*)daE_Bee_Delete__FP11e_bee_class, - (void*)daE_Bee_Execute__FP11e_bee_class, - (void*)daE_Bee_IsDelete__FP11e_bee_class, - (void*)daE_Bee_Draw__FP11e_bee_class, - (void*)NULL, - (void*)NULL, - (void*)NULL, -}; - -/* 806855D0-80685600 -00001 0030+00 0/0 0/0 1/0 .data g_profile_E_BEE */ -SECTION_DATA extern void* g_profile_E_BEE[12] = { - (void*)0xFFFFFFFD, (void*)0x0007FFFD, - (void*)0x01ED0000, (void*)&g_fpcLf_Method, - (void*)0x00002588, (void*)NULL, - (void*)NULL, (void*)&g_fopAc_Method, - (void*)0x00B70000, (void*)&l_daE_Bee_Method, - (void*)0x00044000, (void*)0x000E0000, -}; - -/* 80685600-8068560C 0000D4 000C+00 2/2 0/0 0/0 .data __vt__8cM3dGSph */ -SECTION_DATA extern void* __vt__8cM3dGSph[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__8cM3dGSphFv, -}; - -/* 8068560C-80685618 0000E0 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, -}; - -/* 80685618-80685624 0000EC 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, -}; - -/* 80685624-80685630 0000F8 000C+00 2/2 0/0 0/0 .data __vt__13daE_Bee_HIO_c */ -SECTION_DATA extern void* __vt__13daE_Bee_HIO_c[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__13daE_Bee_HIO_cFv, -}; - /* 8068286C-8068289C 0000EC 0030+00 1/1 0/0 0/0 .text __ct__13daE_Bee_HIO_cFv */ +#ifdef NONMATCHING +// matches with literals +daE_Bee_HIO_c::daE_Bee_HIO_c() { + field_0x4 = -1; + mScale = 1.0f; + mDelete = false; + mNoKill = false; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -334,16 +192,32 @@ asm daE_Bee_HIO_c::daE_Bee_HIO_c() { #include "asm/rel/d/a/e/d_a_e_bee/d_a_e_bee/__ct__13daE_Bee_HIO_cFv.s" } #pragma pop +#endif /* 8068289C-806829A8 00011C 010C+00 1/0 0/0 0/0 .text daE_Bee_Draw__FP11e_bee_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daE_Bee_Draw(e_bee_class* param_0) { - nofralloc -#include "asm/rel/d/a/e/d_a_e_bee/d_a_e_bee/daE_Bee_Draw__FP11e_bee_class.s" +static int daE_Bee_Draw(e_bee_class* i_this) { + g_env_light.settingTevStruct(0, &i_this->current.pos, &i_this->tevStr); + bee_s* bee = i_this->mBees; + int room_no = fopAcM_GetRoomNo(i_this); + for (int i = 0; i < i_this->mNumBees; i++, bee++) { + if (bee->mAction != bee_s::ACT_DEAD && !bee->mNoDraw) { + if (bee->mIsFlying == 0) { + if ((bee->mCounter & 4) != 0) { + dComIfGp_entrySimpleModel(bee->mpModel3, room_no); + } else { + dComIfGp_entrySimpleModel(bee->mpModel4, room_no); + } + } else { + if ((bee->mCounter & 1) != 0) { + dComIfGp_entrySimpleModel(bee->mpModel1, room_no); + } else { + dComIfGp_entrySimpleModel(bee->mpModel2, room_no); + } + } + } + } + return 1; } -#pragma pop /* ############################################################################################## */ /* 80685638-8068563C 000008 0001+03 1/1 0/0 0/0 .bss @1109 */ @@ -436,15 +310,37 @@ static u8 lit_1010[1 + 3 /* padding */]; /* 80685674-80685678 -00001 0004+00 2/2 0/0 0/0 .bss None */ /* 80685674 0001+00 data_80685674 @1009 */ /* 80685675 0003+00 data_80685675 None */ -static u8 struct_80685674[4]; +static u8 struct_80685674; +static bool hioInit; +#ifdef NONMATCHING +/* 80685684-80685694 000054 0010+00 6/6 0/0 0/0 .bss l_HIO */ +static daE_Bee_HIO_c l_HIO; +#else /* 80685678-80685684 000048 000C+00 1/1 0/0 0/0 .bss @3765 */ static u8 lit_3765[12]; /* 80685684-80685694 000054 0010+00 6/6 0/0 0/0 .bss l_HIO */ static u8 l_HIO[16]; +#endif /* 806829A8-80682A70 000228 00C8+00 3/3 0/0 0/0 .text bee_mtxset__FP5bee_s */ +#ifdef NONMATCHING +// matches with static data +static void bee_mtxset(bee_s* i_bee) { + mDoMtx_stack_c::transS(i_bee->mPos.x, i_bee->mPos.y, i_bee->mPos.z); + mDoMtx_stack_c::YrotM(i_bee->mAngle.y); + mDoMtx_stack_c::XrotM(i_bee->mAngle.x); + mDoMtx_stack_c::ZrotM(i_bee->mAngle.z); + f32 scale = l_HIO.mScale * i_bee->mScale; + mDoMtx_stack_c::scaleM(scale, scale, scale); + if ((i_bee->mCounter & 1) != 0) { + i_bee->mpModel1->setBaseTRMtx(mDoMtx_stack_c::get()); + } else { + i_bee->mpModel2->setBaseTRMtx(mDoMtx_stack_c::get()); + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -453,6 +349,7 @@ static asm void bee_mtxset(bee_s* param_0) { #include "asm/rel/d/a/e/d_a_e_bee/d_a_e_bee/bee_mtxset__FP5bee_s.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80685438-8068543C 000004 0004+00 0/4 0/0 0/0 .rodata @3929 */ @@ -496,6 +393,52 @@ COMPILER_STRIP_GATE(0x80685448, &lit_3933); #pragma pop /* 80682A70-80682D78 0002F0 0308+00 1/1 0/0 0/0 .text bee_ground_ang_set__FP5bee_s */ +#ifdef NONMATCHING +// matches with literals +static void bee_ground_ang_set(bee_s* i_bee) { + dBgS_LinChk lin_chk; + cXyz vec4, vec2, vec3, vec1; + vec1 = i_bee->mPos; + vec1.y += 30.0f; + mDoMtx_stack_c::transS(i_bee->mPos.x, i_bee->mPos.y, i_bee->mPos.z); + mDoMtx_stack_c::transM(5.0f, -30.0f, 0.0f); + mDoMtx_stack_c::multVecZero(&vec2); + mDoMtx_stack_c::transM(-10.0f, 0.0f, 0.0f); + mDoMtx_stack_c::multVecZero(&vec3); + s8 bvar1 = false; + lin_chk.Set(&vec1, &vec2, NULL); + if (dComIfG_Bgsp().LineCross(&lin_chk)) { + vec2 = lin_chk.i_GetCross(); + lin_chk.Set(&vec1, &vec3, NULL); + if (dComIfG_Bgsp().LineCross(&lin_chk)) { + vec3 = lin_chk.i_GetCross(); + bvar1 = true; + } + } + if (bvar1) { + vec4 = vec2 - vec3; + i_bee->mAngle.z = cM_atan2s(vec4.y, JMAFastSqrt(vec4.x * vec4.x + vec4.z * vec4.z)); + } + mDoMtx_stack_c::transM(5.0f, 0.0f, 5.0f); + mDoMtx_stack_c::multVecZero(&vec2); + mDoMtx_stack_c::transM(0.0f, 0.0f, -10.0f); + mDoMtx_stack_c::multVecZero(&vec3); + bvar1 = false; + lin_chk.Set(&vec1, &vec2, NULL); + if (dComIfG_Bgsp().LineCross(&lin_chk)) { + vec2 = lin_chk.i_GetCross(); + lin_chk.Set(&vec1, &vec3, NULL); + if (dComIfG_Bgsp().LineCross(&lin_chk)) { + vec3 = lin_chk.i_GetCross(); + bvar1 = true; + } + } + if (bvar1) { + vec4 = vec2 - vec3; + i_bee->mAngle.x = -cM_atan2s(vec4.y, JMAFastSqrt(vec4.x * vec4.x + vec4.z * vec4.z)); + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -504,6 +447,7 @@ static asm void bee_ground_ang_set(bee_s* param_0) { #include "asm/rel/d/a/e/d_a_e_bee/d_a_e_bee/bee_ground_ang_set__FP5bee_s.s" } #pragma pop +#endif /* 80682D78-80682DB4 0005F8 003C+00 1/1 0/0 0/0 .text __dt__4cXyzFv */ #pragma push @@ -650,17 +594,151 @@ COMPILER_STRIP_GATE(0x8068549C, &lit_4207); #pragma pop /* 80685694-80685698 000064 0004+00 1/2 0/0 0/0 .bss None */ +#ifdef NONMATCHING +static u8 ccCylSet; +#else static u8 data_80685694[4]; +#endif /* 80682DB4-806835FC 000634 0848+00 1/1 0/0 0/0 .text bee_fly_action__FP11e_bee_classP5bee_s */ +#ifdef NONMATCHING +// matches with literals +static int bee_fly_action(e_bee_class* i_this, bee_s* i_bee) { + e_nest_class* nest = static_cast(fopAcM_SearchByID(i_this->parentActorID)); + if (nest == NULL) { + i_bee->mAction = bee_s::ACT_DEAD; + return false; + } + + fopAc_ac_c* hit_actor = fopAcM_SearchByID(nest->mHitActorID); + if (hit_actor == NULL) { + i_bee->mAction = bee_s::ACT_DEAD; + return false; + } + + int ret = false; + i_bee->mIsFlying = 1; + cXyz vec; + + if (i_bee->mAction == bee_s::ACT_FLY) { + if (i_bee->mTimer == 0) { + i_bee->mTimer = cM_rndF(15.0f) + 15.0f; + i_bee->mTarget.x = cM_rndFX(100.0f); + i_bee->mTarget.y = cM_rndFX(50.0f); + i_bee->mTarget.z = cM_rndFX(100.0f); + i_bee->mSpeedF = cM_rndF(5.0f) + 17.0f; + } + if (fopAcM_GetName(hit_actor) != PROC_ALINK) { + vec = hit_actor->current.pos - i_bee->mPos; + vec.y += 125.0f; + vec += i_bee->mTarget; + if (i_bee->mHomeTimer == 0) { + if (fopAcM_GetName(hit_actor) == PROC_NPC_TK) { + i_bee->mAction = bee_s::ACT_DEAD; + } else { + i_bee->mAction = bee_s::ACT_FLY_HOME_A; + i_bee->mSound.startSound(Z2SE_EN_BE_GO_HOME, 0, -1); + } + } + } else { + vec = hit_actor->current.pos - i_bee->mPos; + vec.y += 150.0f; + f32 dist = vec.abs(); + if (i_this->mCcSetTimer == 0 && dist < 40.0f) { + i_this->mCcSph.SetC(i_bee->mPos); + } + if (dist < 300.0f) { + daPy_getPlayerActorClass()->onBeeFollow(); + } + vec += i_bee->mTarget; + f32 home_check = 30.0f; + if (i_this->mHomeTimer == 0) { + if (i_bee->mHomeTimer > 10) { + i_bee->mHomeTimer = 10; + } + home_check = 10000.0f; + } + if (i_bee->mHomeTimer == 0) { + if (nest != NULL && nest->mAction == e_nest_class::ACT_NORMAL) { + f32 dx = hit_actor->current.pos.x - i_bee->mPos.x; + f32 dz = hit_actor->current.pos.z - i_bee->mPos.z; + if (JMAFastSqrt(dx * dx + dz * dz) < home_check) { + i_bee->mAction = bee_s::ACT_FLY_HOME_A; + i_bee->mSound.startSound(Z2SE_EN_BE_GO_HOME, 0, -1); + } + } else { + i_bee->mAction = bee_s::ACT_FLY_HOME_B; + i_bee->mSound.startSound(Z2SE_EN_BE_GO_HOME, 0, -1); + } + } + } + ret = true; + } else if (i_bee->mAction == bee_s::ACT_FLY_HOME_A) { + vec = i_this->home.pos - i_bee->mPos; + f32 home_dist = vec.abs(); + f32 home_check = i_this->scale.x * 55.0f; + if (home_check < 55.0f) { + home_check = 55.0f; + } + if (home_dist < home_check) { + i_bee->mAction = bee_s::ACT_HOME; + } else { + if (home_dist > 500.0f) { + home_dist = 500.0f; + } + vec.x += home_dist * cM_ssin(i_bee->mCounter * 0x500); + vec.y += home_dist * cM_scos(i_bee->mCounter * 0x400) * 0.5f; + vec.z += home_dist * cM_scos(i_bee->mCounter * 0x600); + } + } else { + vec = i_this->home.pos - i_bee->mPos; + vec.y += 2000.0f; + vec.x += cM_ssin(i_bee->mCounter * 0x170) * 2000.0f; + vec.z += cM_scos(i_bee->mCounter * 0x130) * 2000.0f; + if (i_bee->mPos.y - i_this->home.pos.y > 1500.0f) { + i_bee->mAction = bee_s::ACT_DEAD; + } + } + + s16 angle_y = cM_ssin(i_bee->mCounter * 3500) * 1500.0f; + s16 angle_x = cM_ssin(i_bee->mCounter * 3000) * 1500.0f; + cLib_addCalcAngleS2(&i_bee->mAngle.y, angle_y + cM_atan2s(vec.x, vec.z), 1, 0x1000); + f32 vec_xz = JMAFastSqrt(vec.x * vec.x + vec.z * vec.z); + cLib_addCalcAngleS2(&i_bee->mAngle.x, angle_x - cM_atan2s(vec.y, vec_xz), 1, 0x1000); + mDoMtx_YrotS(*calc_mtx, i_bee->mAngle.y); + mDoMtx_XrotM(*calc_mtx, i_bee->mAngle.x); + vec.x = 0.0f; + vec.y = 0.0f; + vec.z = i_bee->mSpeedF; + MtxPosition(&vec, &i_bee->mSpeed); + i_bee->mPos += i_bee->mSpeed; + i_bee->mAngle.z = 0; + bee_mtxset(i_bee); + + if (ccCylSet == 0) { + ccCylSet += 1; + cXyz cyl_center = i_bee->mPos; + cyl_center.y -= 100.0f; + i_this->mCcCyl.SetC(cyl_center); + i_this->mCcCyl.SetH(200.0f); + i_this->mCcCyl.SetR(500.0f); + } + + if (i_bee->mHomeTimer != 0) { + i_bee->mHomeTimer--; + } + return ret; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void bee_fly_action(e_bee_class* param_0, bee_s* param_1) { +static asm int bee_fly_action(e_bee_class* param_0, bee_s* param_1) { nofralloc #include "asm/rel/d/a/e/d_a_e_bee/d_a_e_bee/bee_fly_action__FP11e_bee_classP5bee_s.s" } #pragma pop +#endif /* ############################################################################################## */ /* 806854A0-806854A4 00006C 0004+00 0/1 0/0 0/0 .rodata @4353 */ @@ -734,6 +812,137 @@ COMPILER_STRIP_GATE(0x806854C4, &lit_4362); #pragma pop /* 806835FC-80683DDC 000E7C 07E0+00 1/1 0/0 0/0 .text bee_nest_action__FP11e_bee_classP5bee_sSc */ +#ifdef NONMATCHING +// matches with literals +static void bee_nest_action(e_bee_class* i_this, bee_s* i_bee, s8 i_nestHealth) { + i_bee->mIsFlying = 0; + cXyz vec1 = i_bee->mTarget - i_bee->mPos; + + if (i_bee->mMode == 0) { + if (i_bee->mTimer == 0) { + if (cM_rndF(1.0f) < 0.02f) { + i_bee->mTimer = cM_rndF(50.0f) + 30.0f; + i_bee->mMode = 2; + } else { + i_bee->mTimer = cM_rndF(30.0f) + 15.0f; + i_bee->mTarget.x = i_this->home.pos.x + cM_rndFX(200.0f); + i_bee->mTarget.z = i_this->home.pos.z + cM_rndFX(200.0f); + i_bee->mMode = 1; + } + } + i_bee->mSpeedF = 0.0f; + } else if (i_bee->mMode == 1) { + i_bee->mCounter++; + cLib_addCalcAngleS2(&i_bee->mAngle.y, cM_atan2s(vec1.x, vec1.z), 2, 0x400); + if (i_bee->mTimer == 0 || vec1.abs() < 10.0f) { + i_bee->mMode = 0; + i_bee->mTimer = cM_rndF(15.0f) + 5.0f; + } + i_bee->mSpeedF = 2.0f; + } else if (i_bee->mMode == 2) { + i_bee->mIsFlying = 1; + cLib_addCalc2(&i_bee->mStartDistance, 50.0f, 0.1f, 5.0f); + cLib_addCalcAngleS2(&i_bee->mAngle.y, cM_atan2s(vec1.x, vec1.z), 2, 0x800); + if ((i_bee->mTimer & 7) == 0) { + i_bee->mTarget.x = i_this->home.pos.x + cM_rndFX(200.0f); + i_bee->mTarget.z = i_this->home.pos.z + cM_rndFX(200.0f); + } + if (i_bee->mTimer == 0) { + i_bee->mMode = 3; + } + i_bee->mSpeedF = 5.0f; + } else if (i_bee->mMode == 3) { + i_bee->mIsFlying = 1; + cLib_addCalc0(&i_bee->mStartDistance, 1.0f, 5.0f); + if (i_bee->mStartDistance <= 0.1f) { + i_bee->mMode = 0; + } + i_bee->mSpeedF = 0.0f; + } + + mDoMtx_YrotS(*calc_mtx, i_bee->mAngle.y); + vec1.y = 0.0f; + vec1.x = 0.0f; + vec1.z = i_bee->mSpeedF; + MtxPosition(&vec1, &i_bee->mSpeed); + i_bee->mPos += i_bee->mSpeed; + + s16 angle_z = -(i_bee->mPos.x - i_this->home.pos.x) * 0x8000 / 200.0f; + s16 angle_x = (i_bee->mPos.z - i_this->home.pos.z) * 0x8000 / 200.0f; + vec1.y = i_this->scale.x * -51.0f - i_bee->mStartDistance; + vec1.z = 0.0f; + vec1.x = 0.0f; + MtxScale(1.0f, 1.2f, 1.0f, 0); + mDoMtx_ZrotM(*calc_mtx, angle_z); + mDoMtx_XrotM(*calc_mtx, angle_x); + cXyz pos; + MtxPosition(&vec1, &pos); + pos += i_this->home.pos; + + if (i_bee->mIsFlying == 0) { + cLib_addCalcAngleS2(&i_bee->mAngle.x, angle_z, 2, 0x800); + cLib_addCalcAngleS2(&i_bee->mAngle.z, angle_x, 2, 0x800); + } else { + i_bee->mCounter++; + cLib_addCalcAngleS2(&i_bee->mAngle.x, 0, 1, 0x1000); + cLib_addCalcAngleS2(&i_bee->mAngle.z, 0x8000, 1, 0x1000); + } + + mDoMtx_stack_c::transS(pos.x, pos.y, pos.z); + mDoMtx_stack_c::ZrotM(i_bee->mAngle.x); + mDoMtx_stack_c::XrotM(i_bee->mAngle.z); + mDoMtx_stack_c::YrotM(i_bee->mAngle.y); + mDoMtx_stack_c::XrotM(0x8000); + f32 scale = l_HIO.mScale * i_bee->mScale; + mDoMtx_stack_c::scaleM(scale, scale, scale); + + if (i_bee->mIsFlying != 0) { + if ((i_bee->mCounter & 1) != 0) { + i_bee->mpModel1->setBaseTRMtx(mDoMtx_stack_c::get()); + } else { + i_bee->mpModel2->setBaseTRMtx(mDoMtx_stack_c::get()); + } + } else { + if ((i_bee->mCounter & 4) != 0) { + i_bee->mpModel3->setBaseTRMtx(mDoMtx_stack_c::get()); + } else { + i_bee->mpModel4->setBaseTRMtx(mDoMtx_stack_c::get()); + } + } + + if (i_nestHealth == 1) { + i_bee->mAction = bee_s::ACT_FLY; + i_bee->mPos = pos; + i_bee->mTimer = cM_rndF(50.0f); + i_bee->mSpeedF = 0.0f; + i_bee->mMode = 0; + i_bee->mStartDistance = 0.0f; + i_bee->mHomeTimer = cM_rndF(100.0f) + 400.0f; + } else if (i_nestHealth == 2) { + i_bee->mAction = bee_s::ACT_START; + i_bee->mPos = pos; + i_bee->mTimer = cM_rndF(30.0f) + 20.0f; + } else { + fopAc_ac_c* nest = fopAcM_SearchByID(i_this->parentActorID); + if (nest == NULL) { + i_bee->mPos = pos; + vec1 = i_bee->mPos - i_this->home.pos; + i_bee->mAction = bee_s::ACT_FAIL; + i_bee->mMode = 0; + mDoMtx_YrotS(*calc_mtx, cM_atan2s(vec1.x, vec1.z)); + vec1.x = 0.0f; + vec1.y = cM_rndF(10.0f) + 20.0f; + vec1.z = cM_rndF(10.0f) + 20.0f; + MtxPosition(&vec1, &i_bee->mSpeed); + i_bee->mAngle.x = cM_rndF(0x10000); + i_bee->mAngle.z = cM_rndF(0x10000); + i_bee->mTimer = 0; + i_bee->mIsFlying = 1; + i_bee->mSound.startSound(Z2SE_EN_BE_DEATH, 0, -1); + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -742,6 +951,7 @@ static asm void bee_nest_action(e_bee_class* param_0, bee_s* param_1, s8 param_2 #include "asm/rel/d/a/e/d_a_e_bee/d_a_e_bee/bee_nest_action__FP11e_bee_classP5bee_sSc.s" } #pragma pop +#endif /* ############################################################################################## */ /* 806854C8-806854CC 000094 0004+00 0/1 0/0 0/0 .rodata @4395 */ @@ -780,6 +990,48 @@ COMPILER_STRIP_GATE(0x806854D8, &lit_4399); #pragma pop /* 80683DDC-80683FF4 00165C 0218+00 1/1 0/0 0/0 .text bee_fail__FP5bee_s */ +#ifdef NONMATCHING +// matches with literals +static void bee_fail(bee_s* i_bee) { + if (i_bee->mMode <= 1) { + i_bee->mPos += i_bee->mSpeed; + i_bee->mSpeed.y -= 3.0f; + i_bee->mAngle.x += 0x2000; + i_bee->mAngle.z += 0x1300; + dBgS_GndChk gnd_chk; + cXyz vec = i_bee->mPos; + vec.y += 100.0f; + gnd_chk.SetPos(&vec); + f32 ground = dComIfG_Bgsp().GroundCross(&gnd_chk) + 3.0f; + if (fabsf(ground - i_bee->mPos.y) > 1000.0f) { + ground = i_bee->mPos.y; + } + if (i_bee->mPos.y <= ground) { + i_bee->mPos.y = ground; + if (i_bee->mMode == 0) { + i_bee->mSpeed.y *= -(cM_rndF(0.1f) + 0.2f); + i_bee->mSpeed.x *= cM_rndF(0.1f) + 0.3f; + i_bee->mSpeed.z *= cM_rndF(0.1f) + 0.3f; + } else { + bee_ground_ang_set(i_bee); + i_bee->mSpeed.y = 0.0f; + if (!l_HIO.mNoKill) { + i_bee->mTimer = cM_rndF(15.0f) + 15.0f; + } else { + i_bee->mAction = bee_s::ACT_FLY; + } + } + i_bee->mMode++; + } + } else if (i_bee->mTimer == 0) { + cLib_addCalc0(&i_bee->mScale, 1.0f, 0.1f); + if (i_bee->mScale < 0.01f) { + i_bee->mAction = bee_s::ACT_DEAD; + } + } + bee_mtxset(i_bee); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -788,6 +1040,7 @@ static asm void bee_fail(bee_s* param_0) { #include "asm/rel/d/a/e/d_a_e_bee/d_a_e_bee/bee_fail__FP5bee_s.s" } #pragma pop +#endif /* ############################################################################################## */ /* 806854DC-806854E0 0000A8 0004+00 0/1 0/0 0/0 .rodata @4448 */ @@ -799,6 +1052,45 @@ COMPILER_STRIP_GATE(0x806854DC, &lit_4448); /* 80683FF4-80684248 001874 0254+00 1/1 0/0 0/0 .text bee_start__FP11e_bee_classP5bee_s */ +#ifdef NONMATCHING +// matches with literals +static void bee_start(e_bee_class* i_this, bee_s* i_bee) { + cXyz vec = i_this->home.pos - i_bee->mPos; + vec.y += 30; + s16 angle_y = cM_ssin(i_bee->mCounter * 4500) * 4000.0f; + s16 angle_x = cM_ssin(i_bee->mCounter * 5500) * 4000.0f; + cLib_addCalcAngleS2(&i_bee->mAngle.y, angle_y + cM_atan2s(vec.x, vec.z), 1, 0x1000); + f32 vec_xz = JMAFastSqrt(vec.x * vec.x + vec.z * vec.z); + cLib_addCalcAngleS2(&i_bee->mAngle.x, angle_x - cM_atan2s(vec.y, vec_xz), 1, 0x1000); + i_bee->mCounter++; + cLib_addCalcAngleS2(&i_bee->mAngle.z, 0x8000, 4, 0x400); + i_bee->mSpeedF = 15.0f; + mDoMtx_YrotS(*calc_mtx, i_bee->mAngle.y); + mDoMtx_XrotM(*calc_mtx, i_bee->mAngle.x); + vec.x = 0.0f; + vec.y = 0.0f; + vec.z = i_bee->mSpeedF; + MtxPosition(&vec, &i_bee->mSpeed); + i_bee->mPos += i_bee->mSpeed; + + if (i_bee->mTimer == 0) { + e_nest_class* nest = static_cast(fopAcM_SearchByID(i_this->parentActorID)); + if (nest != NULL && nest->mHawkHit != 0) { + i_bee->mAction = bee_s::ACT_FLY_HOME_B; + i_bee->mSpeedF = cM_rndF(5.0f) + 17.0f; + } else { + i_bee->mAction = bee_s::ACT_FLY; + i_bee->mSpeedF = 0.0f; + i_bee->mMode = 0; + i_bee->mStartDistance = 0.0f; + i_bee->mHomeTimer = cM_rndF(55.0f) + 200.0f; + } + } + + i_bee->mIsFlying = 1; + bee_mtxset(i_bee); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -807,6 +1099,7 @@ static asm void bee_start(e_bee_class* param_0, bee_s* param_1) { #include "asm/rel/d/a/e/d_a_e_bee/d_a_e_bee/bee_start__FP11e_bee_classP5bee_s.s" } #pragma pop +#endif /* ############################################################################################## */ /* 806854E0-806854E4 0000AC 0004+00 0/1 0/0 0/0 .rodata @4676 */ @@ -864,6 +1157,173 @@ static u8 non[12]; #pragma pop /* 80684248-80684A94 001AC8 084C+00 1/1 0/0 0/0 .text bee_control__FP11e_bee_class */ +#ifdef NONMATCHING +// regalloc +static void bee_control(e_bee_class* i_this) { + s8 nest_health = 0; + + static cXyz non(-20000.0f, 30000.0f, -15000.0f); + i_this->mCcSph.SetC(i_this->current.pos + non); + + fopAc_ac_c* parent = fopAcM_SearchByID(i_this->parentActorID); + e_nest_class* nest = NULL; + if (parent != NULL) { + if (parent != NULL && parent->health != 0) { + nest_health = parent->health; + } + nest = static_cast(parent); + i_this->home.pos = nest->mCenterPos; + } + + dComIfG_Ccsp()->Set(&i_this->mCcCyl); + + cXyz hit_pos; + cXyz* hit_pos_p = NULL; + f32 hit_radius = 120.0f; + + if (i_this->mCcCyl.ChkTgHit()) { + hit_pos_p = &hit_pos; + cCcD_Obj* hit_obj = i_this->mCcCyl.GetTgHitObj(); + if (hit_obj->ChkAtType(AT_TYPE_BOMB) || hit_obj->ChkAtType(AT_TYPE_BOOMERANG) + || hit_obj->ChkAtType(AT_TYPE_IRON_BALL)) { + fopAc_ac_c* hit_actor = dCc_GetAc(hit_obj->GetAc()); + if (hit_obj->ChkAtType(AT_TYPE_BOMB)) { + hit_radius = 300.0f; + hit_pos = hit_actor->current.pos; + } else if (hit_obj->ChkAtType(AT_TYPE_IRON_BALL)) { + hit_radius = 100.0f; + daPy_py_c* player = static_cast(dComIfGp_getPlayer(0)); + cXyz* center = player->getIronBallCenterPos(); + if (center != NULL) { + hit_pos = *center; + } + } else { + hit_pos = hit_actor->current.pos; + hit_radius = 150.0f; + } + } else { + cXyz vec1, vec2; + daPy_py_c* player = daPy_getPlayerActorClass(); + if (cc_pl_cut_bit_get() == 0x80) { + i_this->mBoomerangAngle += 0x1400; + vec1.z = 150.0f; + } else { + vec1.z = 100.0f; + } + mDoMtx_YrotS(*calc_mtx, player->shape_angle.y + i_this->mBoomerangAngle); + vec1.x = 0.0f; + vec1.y = 100.0f; + MtxPosition(&vec1, &vec2); + hit_pos = player->current.pos + vec2; + } + } else { + i_this->mBoomerangAngle = 0; + } + + bee_s* bee = i_this->mBees; + s8 active_bees = 0; + ccCylSet = 0; + s8 bees_in_nest = 0; + s8 bees_flying = 0; + camera_class* camera = dComIfGp_getCamera(0); + + if ((nest != NULL && nest->mDemoStage == 0 && dComIfGp_event_runCheck()) + || !daPy_getPlayerActorClass()->checkSwimUp() + || dComIfGp_checkPlayerStatus0(0, 0x100000) + || dComIfGp_checkPlayerStatus0(0, 0x8000000) + || daPy_getPlayerActorClass()->checkCanoeRide()) { + if (i_this->mHomeTimer != 0) { + i_this->mHomeTimer--; + } + } else { + i_this->mHomeTimer = 10; + } + + for (int i = 0; i < i_this->mNumBees; i++, bee++) { + if (bee->mAction != bee_s::ACT_DEAD) { + bee->mNoDraw = false; + active_bees++; + cXyz vec3; + + if (dComIfGp_checkPlayerStatus0(0, 0x200000)) { + vec3.x = bee->mPos.x - camera->mLookat.mEye.x; + vec3.z = bee->mPos.z - camera->mLookat.mEye.z; + if (JMAFastSqrt(vec3.x * vec3.x + vec3.z * vec3.z) > 2500.0f) { + bee->mNoDraw = true; + } + } + + if (bee->mTimer != 0) { + bee->mTimer--; + } + + if (bee->mAction == bee_s::ACT_HOME) { + bee_nest_action(i_this, bee, nest_health); + bees_in_nest++; + } else if (bee->mAction <= bee_s::ACT_FLY_HOME_B) { + bee->mCounter++; + if (bee_fly_action(i_this, bee)) { + i_this->current.pos = bee->mPos; + bees_flying++; + } + if (hit_pos_p != NULL) { + vec3 = bee->mPos - *hit_pos_p; + if (vec3.abs() < hit_radius) { + bee->mAction = bee_s::ACT_FAIL; + bee->mMode = 0; + mDoMtx_YrotS(*calc_mtx, cM_atan2s(vec3.x, vec3.z)); + vec3.x = 0.0f; + vec3.y = cM_rndF(10.0f) + 20.0f; + vec3.z = cM_rndF(10.0f) + 20.0f; + MtxPosition(&vec3, &bee->mSpeed); + bee->mAngle.x = cM_rndF(0x10000); + bee->mAngle.z = cM_rndF(0x10000); + bee->mTimer = 0; + bee->mSound.startSound(Z2SE_EN_BE_DEATH, 0, -1); + cXyz hit_mark_scale(0.35f, 0.35f, 0.35f); + dComIfGp_setHitMark(1, i_this, &bee->mPos, NULL, &hit_mark_scale, 0); + } + } + } else if (bee->mAction == bee_s::ACT_FAIL) { + bee_fail(bee); + } else if (bee->mAction == bee_s::ACT_START) { + bees_flying++; + bee_start(i_this, bee); + } + bee->mSound.framework(0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + } + } + + if (active_bees == 0) { + fopAcM_delete(i_this); + } else { + if (bees_flying != 0) { + if (dComIfGp_event_runCheck()) { + i_this->mSound.playBeeGroupSound(Z2SE_EN_BE_FLY_D, bees_flying); + } else { + i_this->mSound.playBeeGroupSound(Z2SE_EN_BE_FLY, bees_flying); + } + } + i_this->mSound.framework(0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + if (nest != NULL) { + if (bees_in_nest != 0) { + nest->mBeeSound.playBeeGroupSound(Z2SE_EN_BE_STAY, bees_in_nest); + } + nest->mBeeSound.framework(0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + } + } + + if (!dComIfGp_event_runCheck()) { + dComIfG_Ccsp()->Set(&i_this->mCcSph); + if (i_this->mCcSph.ChkAtHit()) { + fopAc_ac_c* hit_actor = dCc_GetAc(i_this->mCcSph.GetAtHitObj()->GetAc()); + if (hit_actor != NULL && fopAcM_GetName(hit_actor) == PROC_ALINK) { + dComIfGp_getVibration().StartShock(4, 0x1f, cXyz(0.0f, 1.0f, 0.0f)); + } + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -872,8 +1332,40 @@ static asm void bee_control(e_bee_class* param_0) { #include "asm/rel/d/a/e/d_a_e_bee/d_a_e_bee/bee_control__FP11e_bee_class.s" } #pragma pop +#endif /* 80684A94-80684B5C 002314 00C8+00 2/1 0/0 0/0 .text daE_Bee_Execute__FP11e_bee_class */ +#ifdef NONMATCHING +// matches with static data +static int daE_Bee_Execute(e_bee_class* i_this) { + if (l_HIO.mDelete) { + fopAcM_delete(i_this); + } + + i_this->mCounter++; + + for (int i = 0; i < 2; i++) { + if (i_this->mTimers[i] != 0) { + i_this->mTimers[i]--; + } + } + + if (dComIfGp_event_runCheck()) { + i_this->mCcSetTimer = 60; + } + if (i_this->mCcSetTimer != 0) { + i_this->mCcSetTimer--; + } + + bee_control(i_this); + + if (i_this->mCcSetTimer == 0) { + i_this->mCcSetTimer = 4; + } + + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -882,11 +1374,12 @@ static asm void daE_Bee_Execute(e_bee_class* param_0) { #include "asm/rel/d/a/e/d_a_e_bee/d_a_e_bee/daE_Bee_Execute__FP11e_bee_class.s" } #pragma pop +#endif /* 80684B5C-80684B64 0023DC 0008+00 1/0 0/0 0/0 .text daE_Bee_IsDelete__FP11e_bee_class */ -static bool daE_Bee_IsDelete(e_bee_class* param_0) { - return true; +static int daE_Bee_IsDelete(e_bee_class* param_0) { + return 1; } /* ############################################################################################## */ @@ -903,6 +1396,34 @@ SECTION_DEAD static char const* const stringBase_80685524 = "E_bee"; #pragma pop /* 80684B64-80684C70 0023E4 010C+00 1/0 0/0 0/0 .text daE_Bee_Delete__FP11e_bee_class */ +#ifdef NONMATCHING +// matches with literals +static int daE_Bee_Delete(e_bee_class* i_this) { + static const u32 l_bmdidx[4] = {3, 4, 5, 6}; + if (i_this->mResLoaded) { + for (u32 i = 0; i < 4; i++) { + J3DModelData* model_data = + static_cast(dComIfG_getObjectRes("E_bee", l_bmdidx[i])); + dComIfGp_removeSimpleModel(model_data, fopAcM_GetRoomNo(i_this)); + } + } + + dComIfG_resDelete(&i_this->mPhase, "E_bee"); + + if (i_this->mHIOInit) { + hioInit = false; + } + + if (i_this->heap != NULL) { + i_this->mSound.deleteObject(); + for (int i = 0; i < i_this->mNumBees; i++) { + i_this->mBees[i].mSound.deleteObject(); + } + } + + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -911,16 +1432,53 @@ static asm void daE_Bee_Delete(e_bee_class* param_0) { #include "asm/rel/d/a/e/d_a_e_bee/d_a_e_bee/daE_Bee_Delete__FP11e_bee_class.s" } #pragma pop +#endif /* 80684C70-80684E24 0024F0 01B4+00 1/1 0/0 0/0 .text useHeapInit__FP10fopAc_ac_c */ +#ifdef NONMATCHING +// matches with literals +static int useHeapInit(fopAc_ac_c* i_this) { + e_bee_class* _this = static_cast(i_this); + + J3DModelData* bmdBe01 = static_cast(dComIfG_getObjectRes("E_bee", 3)); + J3DModelData* bmdBe02 = static_cast(dComIfG_getObjectRes("E_bee", 4)); + J3DModelData* bmdBe03 = static_cast(dComIfG_getObjectRes("E_bee", 5)); + J3DModelData* bmdBe04 = static_cast(dComIfG_getObjectRes("E_bee", 6)); + + _this->mSound.init(&_this->current.pos, 2); + + for (int i = 0; i < _this->mNumBees; i++) { + _this->mBees[i].mpModel1 = mDoExt_J3DModel__create(bmdBe01, 0x20000, 0x11000084); + if (_this->mBees[i].mpModel1 == NULL) { + return false; + } + _this->mBees[i].mpModel2 = mDoExt_J3DModel__create(bmdBe02, 0x20000, 0x11000084); + if (_this->mBees[i].mpModel2 == NULL) { + return false; + } + _this->mBees[i].mpModel3 = mDoExt_J3DModel__create(bmdBe03, 0x20000, 0x11000084); + if (_this->mBees[i].mpModel3 == NULL) { + return false; + } + _this->mBees[i].mpModel4 = mDoExt_J3DModel__create(bmdBe04, 0x20000, 0x11000084); + if (_this->mBees[i].mpModel4 == NULL) { + return false; + } + _this->mBees[i].mSound.init(&_this->mBees[i].mPos, 1); + } + + return true; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void useHeapInit(fopAc_ac_c* param_0) { +static asm int useHeapInit(fopAc_ac_c* param_0) { nofralloc #include "asm/rel/d/a/e/d_a_e_bee/d_a_e_bee/useHeapInit__FP10fopAc_ac_c.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80685508-80685518 0000D4 0010+00 0/1 0/0 0/0 .rodata l_bmdidx$4800 */ @@ -949,14 +1507,106 @@ COMPILER_STRIP_GATE(0x8068551C, &lit_4912); #pragma pop /* 80684E24-80685224 0026A4 0400+00 1/0 0/0 0/0 .text daE_Bee_Create__FP10fopAc_ac_c */ +#ifdef NONMATCHING +// matches with literals +static cPhs__Step daE_Bee_Create(fopAc_ac_c* i_this) { + e_bee_class* _this = static_cast(i_this); + fopAcM_SetupActor(_this, e_bee_class); + + cPhs__Step step = (cPhs__Step)dComIfG_resLoad(&_this->mPhase, "E_bee"); + if (step == cPhs_COMPLEATE_e) { + _this->mParam0 = (u8)fopAcM_GetParam(_this); + _this->mParam1 = (u8)(fopAcM_GetParam(_this) >> 8); + _this->mParam2 = (u8)(fopAcM_GetParam(_this) >> 16); + if (_this->mParam2 == 0xff) { + _this->mParam2 = 0; + } + _this->mNumBees = _this->mParam0 + 1; + if (_this->mNumBees > 0x40) { + _this->mNumBees = 0x40; + } + + if (!fopAcM_entrySolidHeap(_this, useHeapInit, _this->mNumBees * 0x7e0)) { + return cPhs_ERROR_e; + } + + if (!hioInit) { + _this->mHIOInit = true; + hioInit = true; + l_HIO.field_0x4 = -1; + } + + if (_this->mParam1 == 1) { + _this->scale.x = _this->mParam2 * 0.1f; + _this->home.pos.y += _this->scale.x * -80.0f; + } + + for (int i = 0; i < _this->mNumBees; i++) { + if (_this->mParam1 == 1) { + _this->mBees[i].mAction = bee_s::ACT_HOME; + } else { + _this->mBees[i].mAction = bee_s::ACT_FLY; + } + _this->mBees[i].mPos = _this->home.pos; + _this->mBees[i].mCounter = cM_rndF(0x10000); + _this->mBees[i].mScale = cM_rndFX(0.1f) + 1.0f; + } + + _this->mCounter = fopAcM_GetID(i_this); + + _this->mCcStts.Init(0, 0, i_this); + static dCcD_SrcCyl cc_cyl_src = { + { + {0x0, {{0x0, 0x0, 0x0}, {0x410022, 0x23}, 0x0}}, // 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 + 30.0f, // mRadius + 130.0f // mHeight + } // mCcCyl + }; + _this->mCcCyl.Set(cc_cyl_src); + _this->mCcCyl.SetStts(&_this->mCcStts); + _this->mCcCyl.OnTgNoHitMark(); + static dCcD_SrcSph at_sph_src = { + { + {0x0, {{AT_TYPE_CSTATUE_SWING, 0x1, 0xd}, {0x0, 0x0}, 0x0}}, // mObj + {dCcD_SE_NONE, 0x0, 0xc, 0x0, 0x1}, // mGObjAt + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjTg + {0x0}, // mGObjCo + }, // mObjInf + { + {{0.0f, 0.0f, 0.0f}, 30.0f} // mCcSph + } // mCcSphAttr + }; + _this->mCcSph.Set(at_sph_src); + _this->mCcSph.SetStts(&_this->mCcStts); + + daE_Bee_Execute(_this); + + static const u32 l_bmdidx[4] = {3, 4, 5, 6}; + for (u32 i = 0; i < 4; i++) { + J3DModelData* model_data = + static_cast(dComIfG_getObjectRes("E_bee", l_bmdidx[i])); + dComIfGp_addSimpleModel(model_data, fopAcM_GetRoomNo(_this), false); + _this->mResLoaded = true; + } + } + return step; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void daE_Bee_Create(fopAc_ac_c* param_0) { +static asm cPhs__Step daE_Bee_Create(fopAc_ac_c* param_0) { nofralloc #include "asm/rel/d/a/e/d_a_e_bee/d_a_e_bee/daE_Bee_Create__FP10fopAc_ac_c.s" } #pragma pop +#endif /* 80685224-8068526C 002AA4 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGSphFv */ #pragma push @@ -995,7 +1645,8 @@ extern "C" asm void __dt__8cM3dGAabFv() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm bee_s::~bee_s() { +// asm bee_s::~bee_s() { +extern "C" asm void __dt__5bee_sFv() { nofralloc #include "asm/rel/d/a/e/d_a_e_bee/d_a_e_bee/__dt__5bee_sFv.s" } @@ -1005,7 +1656,8 @@ asm bee_s::~bee_s() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm bee_s::bee_s() { +// asm bee_s::bee_s() { +extern "C" asm void __ct__5bee_sFv() { nofralloc #include "asm/rel/d/a/e/d_a_e_bee/d_a_e_bee/__ct__5bee_sFv.s" } @@ -1015,7 +1667,8 @@ asm bee_s::bee_s() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm daE_Bee_HIO_c::~daE_Bee_HIO_c() { +// asm daE_Bee_HIO_c::~daE_Bee_HIO_c() { +extern "C" asm void __dt__13daE_Bee_HIO_cFv() { nofralloc #include "asm/rel/d/a/e/d_a_e_bee/d_a_e_bee/__dt__13daE_Bee_HIO_cFv.s" } @@ -1209,3 +1862,58 @@ static u8 data_80685714[4]; #pragma pop /* 80685524-80685524 0000F0 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ + +/* 806855B0-806855D0 -00001 0020+00 1/0 0/0 0/0 .data l_daE_Bee_Method */ +static actor_method_class l_daE_Bee_Method = { + (process_method_func)daE_Bee_Create, + (process_method_func)daE_Bee_Delete, + (process_method_func)daE_Bee_Execute, + (process_method_func)daE_Bee_IsDelete, + (process_method_func)daE_Bee_Draw, +}; + +/* 806855D0-80685600 -00001 0030+00 0/0 0/0 1/0 .data g_profile_E_BEE */ +extern actor_process_profile_definition g_profile_E_BEE = { + fpcLy_CURRENT_e, + 7, + fpcPi_CURRENT_e, + PROC_E_BEE, + &g_fpcLf_Method.mBase, + sizeof(e_bee_class), + 0, + 0, + &g_fopAc_Method.base, + 0xB7, + &l_daE_Bee_Method, + 0x44000, + fopAc_ACTOR_e, + fopAc_CULLBOX_CUSTOM_e, +}; + +/* 80685600-8068560C 0000D4 000C+00 2/2 0/0 0/0 .data __vt__8cM3dGSph */ +SECTION_DATA extern void* __vt__8cM3dGSph[3] = { + (void*)NULL /* RTTI */, + (void*)NULL, + (void*)__dt__8cM3dGSphFv, +}; + +/* 8068560C-80685618 0000E0 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, +}; + +/* 80685618-80685624 0000EC 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, +}; + +/* 80685624-80685630 0000F8 000C+00 2/2 0/0 0/0 .data __vt__13daE_Bee_HIO_c */ +SECTION_DATA extern void* __vt__13daE_Bee_HIO_c[3] = { + (void*)NULL /* RTTI */, + (void*)NULL, + (void*)__dt__13daE_Bee_HIO_cFv, +}; diff --git a/src/d/a/d_a_alink.cpp b/src/d/a/d_a_alink.cpp index 0c787bd9282..d5c5120cedd 100644 --- a/src/d/a/d_a_alink.cpp +++ b/src/d/a/d_a_alink.cpp @@ -12732,7 +12732,7 @@ void daAlink_c::playerInit() { field_0x3184 = -1; mExitID = 0x3F; - onNoResetFlg0(FLG0_UNK_100); + onNoResetFlg0(FLG0_SWIM_UP); offOxygenTimer(); int startMode = getStartMode(); @@ -15674,7 +15674,7 @@ BOOL daAlink_c::notTalk() { /* 800B4A08-800B4B2C 0AF348 0124+00 11/11 0/0 0/0 .text setTalkStatus__9daAlink_cFv */ BOOL daAlink_c::setTalkStatus() { - if (checkEndResetFlg0(ERFLG0_UNK_400000) || field_0x27f4 == NULL) { + if (checkEndResetFlg0(ERFLG0_BEE_FOLLOW) || field_0x27f4 == NULL) { return 0; } @@ -17481,7 +17481,7 @@ void daAlink_c::posMove() { cLib_chasePos(&field_0x3750, cXyz::Zero, daAlinkHIO_damSwim_c0::m.field_0x84); current.pos += field_0x3750; - if (checkNoResetFlg0(FLG0_UNK_100) && mProcID != PROC_SWIM_DIVE) { + if (checkNoResetFlg0(FLG0_SWIM_UP) && mProcID != PROC_SWIM_DIVE) { current.pos.y = mWaterY; } else if (mDemo.getDemoType() == 4 || mProcID == PROC_ELEC_DAMAGE || dComIfGp_checkPlayerStatus0(0, 0x10)) @@ -17658,7 +17658,7 @@ void daAlink_c::posMove() { } } - if (checkModeFlg(MODE_SWIMMING) && checkNoResetFlg0(FLG0_UNK_100)) { + if (checkModeFlg(MODE_SWIMMING) && checkNoResetFlg0(FLG0_SWIM_UP)) { cXyz sp84 = current.pos - field_0x3798; f32 temp_f3 = sp84.absXZ(); diff --git a/src/d/a/d_a_alink_damage.inc b/src/d/a/d_a_alink_damage.inc index 4f60cdf3bc1..80044d763b9 100644 --- a/src/d/a/d_a_alink_damage.inc +++ b/src/d/a/d_a_alink_damage.inc @@ -685,7 +685,7 @@ int daAlink_c::procCoSwimFreezeReturnInit() { return 1; } - onNoResetFlg0(FLG0_UNK_100); + onNoResetFlg0(FLG0_SWIM_UP); J3DTransformInfo* transInfo = field_0x2060->getOldFrameTransInfo(0); f32 var_f31; diff --git a/src/d/a/d_a_alink_hook.inc b/src/d/a/d_a_alink_hook.inc index 90a06edddb0..e265c5df37e 100644 --- a/src/d/a/d_a_alink_hook.inc +++ b/src/d/a/d_a_alink_hook.inc @@ -1403,7 +1403,7 @@ int daAlink_c::procHookshotMove() { int daAlink_c::procHookshotFlyInit() { commonProcInit(PROC_HOOKSHOT_FLY); - if (!checkNoResetFlg0(FLG0_UNK_100)) { + if (!checkNoResetFlg0(FLG0_SWIM_UP)) { onNoResetFlg0(FLG0_UNDERWATER); } diff --git a/src/d/a/d_a_alink_swim.inc b/src/d/a/d_a_alink_swim.inc index 0b5b8b2c05d..01bfb4fe158 100644 --- a/src/d/a/d_a_alink_swim.inc +++ b/src/d/a/d_a_alink_swim.inc @@ -10,7 +10,7 @@ /* 80101890-801018E4 0FC1D0 0054+00 6/6 0/0 0/0 .text checkZoraWearMaskDraw__9daAlink_cFv */ BOOL daAlink_c::checkZoraWearMaskDraw() { - return checkZoraWearAbility() && !checkNoResetFlg0(FLG0_UNK_100); + return checkZoraWearAbility() && !checkNoResetFlg0(FLG0_SWIM_UP); } /* 801018E4-80101934 0FC224 0050+00 1/1 0/0 0/0 .text checkAcceptUseItemInWater__9daAlink_cCFUs */ @@ -66,7 +66,7 @@ f32 daAlink_c::getSwimMaxFallSpeed() const { void daAlink_c::checkOxygenTimer() { BOOL hide_timer; - if (!checkNoResetFlg0(FLG0_UNK_100) || + if (!checkNoResetFlg0(FLG0_SWIM_UP) || (checkModeFlg(MODE_SWIMMING) && mWaterY > lit_7808 + current.pos.y)) { hide_timer = false; @@ -234,7 +234,7 @@ int daAlink_c::checkNextActionSwim() { field_0x3000 = 30; } - if ((checkZoraWearAbility() && !checkHeavyStateOn(1, 1)) || checkNoResetFlg0(FLG0_UNK_100)) { + if ((checkZoraWearAbility() && !checkHeavyStateOn(1, 1)) || checkNoResetFlg0(FLG0_SWIM_UP)) { setTalkStatus(); } @@ -242,7 +242,7 @@ int daAlink_c::checkNextActionSwim() { return 1; } - if (mAttList != NULL && mAttList->mType == 7 && checkNoResetFlg0(FLG0_UNK_100) && + if (mAttList != NULL && mAttList->mType == 7 && checkNoResetFlg0(FLG0_SWIM_UP) && fopAcM_GetName(field_0x27f4) == PROC_CANOE) { setDoStatus(0x17); @@ -284,7 +284,7 @@ asm int daAlink_c::checkSwimUpAction() { /* 801032C8-80103398 0FDC08 00D0+00 8/8 0/0 0/0 .text swimOutAfter__9daAlink_cFi */ void daAlink_c::swimOutAfter(int param_0) { - onNoResetFlg0(FLG0_UNK_100); + onNoResetFlg0(FLG0_SWIM_UP); onEndResetFlg1(ERFLG1_UNK_100); mZ2Link.setInWater(false); @@ -347,7 +347,7 @@ bool daAlink_c::checkUpSwimButtonAccept() { /* 80103F24-80103F94 0FE864 0070+00 2/2 0/0 0/0 .text checkSwimButtonMove__9daAlink_cFv */ BOOL daAlink_c::checkSwimButtonMove() { - return !checkNoResetFlg0(FLG0_UNK_100) && + return !checkNoResetFlg0(FLG0_SWIM_UP) && (checkSwimButtonAccept() || checkUpSwimButtonAccept()) && doButton(); } @@ -359,7 +359,7 @@ BOOL daAlink_c::checkZoraSwimMove() { /* 80103FE8-80104034 0FE928 004C+00 2/2 0/0 0/0 .text checkSwimNeckUpDown__9daAlink_cCFv */ BOOL daAlink_c::checkSwimNeckUpDown() const { - return !checkNoResetFlg0(FLG0_UNK_100) && checkUnderMove0BckNoArc(ANM_SWIM_WAIT); + return !checkNoResetFlg0(FLG0_SWIM_UP) && checkUnderMove0BckNoArc(ANM_SWIM_WAIT); } /* 80104034-801040F8 0FE974 00C4+00 3/3 0/0 0/0 .text setSwimUpDownOffset__9daAlink_cFv @@ -392,7 +392,7 @@ int daAlink_c::procSwimUpInit() { speed.y = FLOAT_LABEL(lit_6108); current.pos.y = mWaterY; field_0x3080 = 0; - onNoResetFlg0(FLG0_UNK_100); + onNoResetFlg0(FLG0_SWIM_UP); mZ2Link.setInWater(false); setSingleAnimeParam(ANM_SWIM_RESURFACE, &daAlinkHIO_swim_c0::m.mResurfaceAnm); dComIfGp_setPlayerStatus0(0, 0x100000); @@ -477,7 +477,7 @@ int daAlink_c::procSwimWaitInit(int param_0) { dComIfGp_setPlayerStatus0(0, 0x100000); - if (checkNoResetFlg0(FLG0_UNK_100)) { + if (checkNoResetFlg0(FLG0_SWIM_UP)) { current.pos.y = mWaterY; speed.y = FLOAT_LABEL(lit_6108); } @@ -573,7 +573,7 @@ int daAlink_c::procSwimMoveInit() { field_0x2f98 = 5; setSwimMoveAnime(); - if (checkNoResetFlg0(FLG0_UNK_100)) { + if (checkNoResetFlg0(FLG0_SWIM_UP)) { current.pos.y = mWaterY; speed.y = FLOAT_LABEL(lit_6108); } @@ -631,7 +631,7 @@ int daAlink_c::procSwimDiveInit() { setSpecialGravity(0.0f, maxFallSpeed, 0); speed.y = 0.0f; - if (checkNoResetFlg0(FLG0_UNK_100)) { + if (checkNoResetFlg0(FLG0_SWIM_UP)) { mProcVar2.field_0x300c = 1; setSingleAnimeParam(ANM_SWIM_DIVE, &daAlinkHIO_swim_c0::m.mDiveAnm); voiceStart(Z2SE_AL_V_DIVING); @@ -670,8 +670,8 @@ int daAlink_c::procSwimDive() { if (mProcVar2.field_0x300c == 0) { setDoStatus(0x4C); - } else if (checkNoResetFlg0(FLG0_UNK_100) && frame_ctrl->getFrame() > 20.0f) { - offNoResetFlg0(FLG0_UNK_100); + } else if (checkNoResetFlg0(FLG0_SWIM_UP) && frame_ctrl->getFrame() > 20.0f) { + offNoResetFlg0(FLG0_SWIM_UP); mZ2Link.setInWater(true); } @@ -740,7 +740,7 @@ int daAlink_c::procSwimHookshotSubjectInit() { field_0x3080 = 0; } - if (checkNoResetFlg0(FLG0_UNK_100)) { + if (checkNoResetFlg0(FLG0_SWIM_UP)) { current.pos.y = mWaterY; speed.y = FLOAT_LABEL(lit_6108); } @@ -815,7 +815,7 @@ int daAlink_c::procSwimHookshotMoveInit() { setSwimMoveAnime(); } - if (checkNoResetFlg0(FLG0_UNK_100)) { + if (checkNoResetFlg0(FLG0_SWIM_UP)) { current.pos.y = mWaterY; speed.y = FLOAT_LABEL(lit_6108); } @@ -898,7 +898,7 @@ int daAlink_c::procSwimDamageInit(dCcD_GObjInf* param_0) { dComIfGp_getVibration().StartShock(2, 31, cXyz(0.0f, 1.0f, 0.0f)); BOOL bvar4 = - checkNoResetFlg0(FLG0_UNK_100) || ((param_0 != NULL && param_0->GetTgHitAc() != NULL) && + checkNoResetFlg0(FLG0_SWIM_UP) || ((param_0 != NULL && param_0->GetTgHitAc() != NULL) && fopAcM_GetName(param_0->GetTgHitAc()) == PROC_E_SG); if (!getZoraSwim() && bvar4 && mProcID != PROC_SWIM_WAIT) { @@ -1057,7 +1057,7 @@ int daAlink_c::procOctaIealSpitInit() { } field_0x3588 = l_waitBaseAnime; - offNoResetFlg0(FLG0_UNK_100); + offNoResetFlg0(FLG0_SWIM_UP); current.angle.y = field_0x2ffe; if (mNormalSpeed > 0.0f) { diff --git a/src/d/a/d_a_alink_wolf.inc b/src/d/a/d_a_alink_wolf.inc index 9c433d4c38a..c0aa7afc959 100644 --- a/src/d/a/d_a_alink_wolf.inc +++ b/src/d/a/d_a_alink_wolf.inc @@ -5207,7 +5207,7 @@ int daAlink_c::procWolfSwimUpInit() { commonProcInit(PROC_WOLF_SWIM_UP); speed.y = FLOAT_LABEL(lit_6108); current.pos.y = mWaterY; - onNoResetFlg0(FLG0_UNK_100); + onNoResetFlg0(FLG0_SWIM_UP); mZ2Link.setInWater(false); setSingleAnimeWolfParam(WANM_SWIM_RESURFACE, &daAlinkHIO_wlSwim_c0::m.field_0x0); @@ -5325,7 +5325,7 @@ int daAlink_c::procWolfSwimMoveInit() { setSingleAnimeWolfBaseSpeed(WANM_SWIM, getWolfSwimMoveAnmSpeed(), daAlinkHIO_wlSwim_c0::m.field_0x78); - if (checkNoResetFlg0(FLG0_UNK_100)) { + if (checkNoResetFlg0(FLG0_SWIM_UP)) { current.pos.y = mWaterY; speed.y = FLOAT_LABEL(lit_6108); }