From 3e5903296fc3308a7199b3d7a55f320fd90c0c21 Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Sun, 16 Jul 2023 23:44:23 -0700 Subject: [PATCH] d_a_b_oh mostly done --- include/SSystem/SComponent/c_math.h | 26 +- include/rel/d/a/b/d_a_b_ob/d_a_b_ob.h | 5 +- include/rel/d/a/b/d_a_b_oh/d_a_b_oh.h | 76 +- rel/d/a/b/d_a_b_oh/d_a_b_oh.cpp | 1063 +++++++++++++++++++------ 4 files changed, 896 insertions(+), 274 deletions(-) diff --git a/include/SSystem/SComponent/c_math.h b/include/SSystem/SComponent/c_math.h index ae0d7985093..767f1ddfc08 100644 --- a/include/SSystem/SComponent/c_math.h +++ b/include/SSystem/SComponent/c_math.h @@ -4,10 +4,10 @@ #include "JSystem/JMath/JMATrigonometric.h" #include "dolphin/types.h" -s16 cM_rad2s(float); +s16 cM_rad2s(float rad); u16 U_GetAtanTable(float, float); -s16 cM_atan2s(float, float); -float cM_atan2f(float, float); +s16 cM_atan2s(float y, float x); +float cM_atan2f(float y, float x); void cM_initRnd(int, int, int); float cM_rnd(void); float cM_rndF(float); @@ -17,24 +17,24 @@ float cM_rnd2(void); float cM_rndF2(float); float cM_rndFX2(float); -inline f32 cM_scos(s16 s) { - return JMASCos(s); +inline f32 cM_scos(s16 x) { + return JMASCos(x); } -inline f32 cM_ssin(s16 s) { - return JMASSin(s); +inline f32 cM_ssin(s16 x) { + return JMASSin(x); } -inline s16 cM_deg2s(f32 val) { - return val * 182.04445f; +inline s16 cM_deg2s(f32 deg) { + return deg * 182.04445f; } -inline s16 i_cM_deg2s(f32 val) { - return val; +inline s16 i_cM_deg2s(f32 deg) { + return deg; } -inline f32 cM_fsin(f32 v) { - return JMASSin(cM_rad2s(v)); +inline f32 cM_fsin(f32 x) { + return JMASSin(cM_rad2s(x)); } inline f32 cM_sht2d(f32 v) { diff --git a/include/rel/d/a/b/d_a_b_ob/d_a_b_ob.h b/include/rel/d/a/b/d_a_b_ob/d_a_b_ob.h index fde7bd69168..3a7d9cc13b6 100644 --- a/include/rel/d/a/b/d_a_b_ob/d_a_b_ob.h +++ b/include/rel/d/a/b/d_a_b_ob/d_a_b_ob.h @@ -70,7 +70,7 @@ public: /* 0x4738 */ int field_0x4738; /* 0x4738 */ u8 field_0x473c; /* 0x4740 */ f32 field_0x4740; - /* 0x4744 */ u8 field_0x4744; + /* 0x4744 */ s8 field_0x4744; /* 0x4745 */ u8 field_0x4745; /* 0x4748 */ u32 field_0x4748; /* 0x474C */ u8 field_0x474c; @@ -158,7 +158,8 @@ public: /* 0x5D08 */ s16 field_0x5d08; /* 0x5D0A */ s16 field_0x5d0a; /* 0x5D0C */ s16 field_0x5d0c; - /* 0x5D0E */ u8 field_0x5d0e[0x5d11 - 0x5d0e]; + /* 0x5D0E */ u8 field_0x5d0e[0x5d10 - 0x5d0e]; + /* 0x5D10 */ u8 field_0x5d10; /* 0x5D11 */ s8 field_0x5d11; /* 0x5D12 */ s8 field_0x5d12; /* 0x5D14 */ f32 field_0x5d14; diff --git a/include/rel/d/a/b/d_a_b_oh/d_a_b_oh.h b/include/rel/d/a/b/d_a_b_oh/d_a_b_oh.h index 23d6c7400a5..889275d6957 100644 --- a/include/rel/d/a/b/d_a_b_oh/d_a_b_oh.h +++ b/include/rel/d/a/b/d_a_b_oh/d_a_b_oh.h @@ -1,6 +1,80 @@ #ifndef D_A_B_OH_H #define D_A_B_OH_H -#include "dolphin/types.h" +#include "f_op/f_op_actor_mng.h" +#include "d/cc/d_cc_d.h" +#include "d/cc/d_cc_uty.h" + +class daB_OH_HIO_c { +public: + /* 8061B72C */ daB_OH_HIO_c(); + /* 8061D93C */ virtual ~daB_OH_HIO_c(); + + /* 0x4 */ s8 field_0x4; + /* 0x8 */ f32 mModelSize; + /* 0xC */ f32 mLength; +}; + +class b_oh_class : public fopEn_enemy_c { +public: + /* 0x05AC */ request_of_phase_process_class mPhase; + /* 0x05B4 */ mDoExt_McaMorf* mpMorf; + /* 0x05B8 */ mDoExt_invisibleModel mInvisModel; + /* 0x05C0 */ mDoExt_btkAnm* mpBtk; + /* 0x05C4 */ mDoExt_brkAnm* mpBrk; + /* 0x05C8 */ int field_0x5c8; + /* 0x05CC */ s16 field_0x5cc; + /* 0x05CE */ s16 mAction; + /* 0x05D0 */ s16 mActionPhase; + /* 0x05D2 */ u8 field_0x5D2[0x05E2 - 0x05D2]; + /* 0x05E2 */ s16 mAngleToPlayer; + /* 0x05E4 */ f32 mDistToPlayer; + /* 0x05E8 */ u8 field_0x5E8[0x05EC - 0x05E8]; + /* 0x05EC */ s16 mTimers[4]; + /* 0x05F4 */ s16 field_0x5f4; + /* 0x05F6 */ s16 field_0x5f6; + /* 0x05F8 */ s16 field_0x5f8; + /* 0x05FA */ s16 field_0x5fa; + /* 0x05FC */ f32 field_0x5fc; + /* 0x0600 */ f32 field_0x600; + /* 0x0604 */ f32 field_0x604; + /* 0x0608 */ f32 field_0x608; + /* 0x060C */ f32 field_0x60c; + /* 0x0610 */ f32 field_0x610; + /* 0x0614 */ f32 field_0x614; + /* 0x0618 */ f32 mTentacleLength; + /* 0x061C */ csXyz field_0x61c[30]; + /* 0x06D0 */ csXyz field_0x6d0[30]; + /* 0x0784 */ csXyz field_0x784[30]; + /* 0x0838 */ csXyz field_0x838[30]; + /* 0x08EC */ f32 field_0x8ec[30]; + /* 0x0964 */ f32 field_0x964[30]; + /* 0x09DC */ f32 field_0x9dc[30]; + /* 0x0A54 */ u8 field_0xa54[0xA58 - 0xA54]; + /* 0x0A58 */ cXyz field_0xa58[31]; + /* 0x0BCC */ csXyz field_0xbcc[31]; + /* 0x0C86 */ u8 field_0xC86[0x0C88 - 0x0C86]; + /* 0x0C88 */ int field_0xc88; + /* 0x0C8C */ f32 field_0xc8c; + /* 0x0C90 */ f32 field_0xc90; + /* 0x0C94 */ s16 field_0xc94; + /* 0x0C96 */ s16 field_0xc96; + /* 0x0C98 */ s16 field_0xc98; + /* 0x0C9A */ u8 field_0xC9A[0x0C9C - 0x0C9A]; + /* 0x0C9C */ f32 field_0xc9c; + /* 0x0CA0 */ s16 field_0xca0; + /* 0x0CA2 */ s16 field_0xca2; + /* 0x0CA4 */ s16 field_0xca4; + /* 0x0CA6 */ u8 field_0xCA6[0x0CA8 - 0x0CA6]; + /* 0x0CA8 */ int field_0xca8; + /* 0x0CAC */ f32 field_0xcac; + /* 0x0CB0 */ dCcD_Stts mCcStts; + /* 0x0CEC */ dCcD_Sph mColliders[15]; + /* 0x1F34 */ dCcU_AtInfo mAtInfo; + /* 0x1F58 */ u8 field_0x1F58[0x1F80 - 0x1F58]; + /* 0x1F80 */ u32 field_0x1f80; + /* 0x1F84 */ u8 field_0x1F84[0x1F86 - 0x1F84]; + /* 0x1F86 */ u8 field_0x1f86; +}; #endif /* D_A_B_OH_H */ diff --git a/rel/d/a/b/d_a_b_oh/d_a_b_oh.cpp b/rel/d/a/b/d_a_b_oh/d_a_b_oh.cpp index bef7468b46b..471c075e77a 100644 --- a/rel/d/a/b/d_a_b_oh/d_a_b_oh.cpp +++ b/rel/d/a/b/d_a_b_oh/d_a_b_oh.cpp @@ -1,192 +1,24 @@ -// -// Generated By: dol2asm -// Translation Unit: d_a_b_oh -// +/** + * d_a_b_oh.cpp + * Morpheel Tentacle + */ #include "rel/d/a/b/d_a_b_oh/d_a_b_oh.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "SSystem/SComponent/c_math.h" +#include "c/c_damagereaction.h" +#include "d/a/d_a_player.h" +#include "d/com/d_com_inf_game.h" +#include "d/d_procname.h" #include "dol2asm.h" -#include "dolphin/types.h" +#include "rel/d/a/b/d_a_b_ob/d_a_b_ob.h" -// -// Types: -// - -struct request_of_phase_process_class {}; - -struct mDoMtx_stack_c { - /* 8000CE38 */ void scaleM(f32, f32, f32); - - static u8 now[48]; -}; - -struct J3DModel {}; - -struct cXyz { - /* 8061BB18 */ ~cXyz(); - /* 8061D8F8 */ cXyz(); -}; - -struct mDoExt_invisibleModel { - /* 8000E53C */ void create(J3DModel*, u8); - /* 8000E7C0 */ void entryDL(cXyz*); -}; - -struct J3DMaterialTable {}; - -struct J3DAnmTextureSRTKey {}; - -struct mDoExt_btkAnm { - /* 8000D63C */ void init(J3DMaterialTable*, J3DAnmTextureSRTKey*, int, int, f32, s16, s16); - /* 8000D6D8 */ void entry(J3DMaterialTable*, f32); -}; - -struct J3DAnmTevRegKey {}; - -struct mDoExt_brkAnm { - /* 8000D70C */ void init(J3DMaterialTable*, J3DAnmTevRegKey*, int, int, f32, s16, s16); - /* 8000D7A8 */ void entry(J3DMaterialTable*, f32); -}; - -struct mDoExt_baseAnm { - /* 8000D428 */ void play(); -}; - -struct mDoExt_McaMorfCallBack2_c {}; - -struct mDoExt_McaMorfCallBack1_c {}; - -struct Vec {}; - -struct J3DAnmTransform {}; - -struct J3DModelData {}; - -struct mDoExt_McaMorf { - /* 8000FC4C */ mDoExt_McaMorf(J3DModelData*, mDoExt_McaMorfCallBack1_c*, - mDoExt_McaMorfCallBack2_c*, J3DAnmTransform*, int, f32, int, int, - int, void*, u32, u32); - /* 800105C8 */ void play(Vec*, u32, s8); - /* 800106AC */ void modelCalc(); -}; - -struct fopAc_ac_c { - /* 80018B64 */ fopAc_ac_c(); -}; - -struct daB_OH_HIO_c { - /* 8061B72C */ daB_OH_HIO_c(); - /* 8061D93C */ ~daB_OH_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*); - /* 801A4DA0 */ void setLightTevColorType_MAJI(J3DModelData*, dKy_tevstr_c*); -}; - -struct dRes_info_c {}; - -struct dRes_control_c { - /* 8003C2EC */ void getRes(char const*, s32, dRes_info_c*, int); -}; - -struct dPa_levelEcallBack {}; - -struct csXyz { - /* 8061D8FC */ ~csXyz(); - /* 8061D938 */ csXyz(); -}; - -struct _GXColor {}; - -struct dPa_control_c { - /* 8004C218 */ void setHitMark(u16, fopAc_ac_c*, cXyz const*, csXyz const*, cXyz const*, u32); - /* 8004D4CC */ void set(u32, u8, u16, cXyz const*, dKy_tevstr_c const*, csXyz const*, - cXyz const*, u8, dPa_levelEcallBack*, s8, _GXColor const*, - _GXColor const*, cXyz const*, f32); -}; - -struct dCcU_AtInfo {}; - -struct dCcD_Stts { - /* 80083860 */ void Init(int, int, fopAc_ac_c*); -}; - -struct dCcD_SrcSph {}; - -struct dCcD_Sph { - /* 80084A34 */ void Set(dCcD_SrcSph const&); - /* 8061D718 */ ~dCcD_Sph(); - /* 8061D7E4 */ dCcD_Sph(); -}; - -struct dCcD_GStts { - /* 80083760 */ dCcD_GStts(); - /* 80083830 */ void Move(); -}; - -struct dCcD_GObjInf { - /* 80083A28 */ dCcD_GObjInf(); - /* 800840E4 */ ~dCcD_GObjInf(); - /* 80084460 */ void ChkTgHit(); - /* 800844F8 */ void GetTgHitObj(); - /* 80084658 */ void ChkCoHit(); - /* 800846F0 */ void GetCoHitObj(); -}; - -struct cM3dGSph { - /* 8026F648 */ void SetC(cXyz const&); - /* 8026F708 */ void SetR(f32); - /* 8061D868 */ ~cM3dGSph(); -}; - -struct cM3dGAab { - /* 8061D8B0 */ ~cM3dGAab(); -}; - -struct cCcD_Obj { - /* 80263A48 */ void GetAc(); -}; - -struct cCcS { - /* 80264BA8 */ void Set(cCcD_Obj*); -}; - -struct b_oh_class {}; - -struct JAISoundID {}; - -struct Z2SeMgr { - /* 802AB984 */ void seStart(JAISoundID, Vec const*, u32, s8, f32, f32, f32, f32, u8); -}; - -struct Z2CreatureOI { - /* 802C2C84 */ void startTentacleSound(JAISoundID, u8, u32, s8); -}; - -struct Z2AudioMgr { - static u8 mAudioMgrPtr[4 + 4 /* padding */]; -}; - -struct JMath { - static u8 sincosTable_[65536]; -}; - -struct J3DSys { - static u8 mCurrentMtx[48]; -}; - -struct J3DJoint {}; - -struct J3DFrameCtrl { - /* 803283FC */ void init(s16); - /* 8061D39C */ ~J3DFrameCtrl(); -}; +#define ACTION_START 0 +#define ACTION_WAIT 1 +#define ACTION_ATTACK 2 +#define ACTION_CAUGHT 3 +#define ACTION_END 10 +#define ACTION_NON 11 // // Forward References: @@ -285,8 +117,6 @@ extern "C" void startTentacleSound__12Z2CreatureOIF10JAISoundIDUcUlSc(); extern "C" void* __nw__FUl(); extern "C" void __dl__FPv(); extern "C" void init__12J3DFrameCtrlFs(); -extern "C" void PSMTXCopy(); -extern "C" void PSMTXTrans(); extern "C" void __construct_array(); extern "C" void _savegpr_20(); extern "C" void _savegpr_23(); @@ -304,20 +134,14 @@ extern "C" void _restgpr_26(); extern "C" void _restgpr_27(); extern "C" void _restgpr_28(); extern "C" void _restgpr_29(); -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__9dCcD_Stts[11]; extern "C" extern void* __vt__12cCcD_SphAttr[25]; extern "C" extern void* __vt__14cCcD_ShapeAttr[22]; extern "C" extern void* __vt__9cCcD_Stts[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" extern u8 j3dSys[284]; extern "C" u8 mCurrentMtx__6J3DSys[48]; extern "C" u8 sincosTable___5JMath[65536]; -extern "C" extern void* calc_mtx[1 + 1 /* padding */]; extern "C" extern u8 struct_80450C98[4]; extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */]; extern "C" void __register_global_object(); @@ -352,11 +176,19 @@ SECTION_DATA static void* lit_4166[12] = { }; /* 8061DAAC-8061DAEC 000030 0040+00 1/1 0/0 0/0 .data cc_sph_src$4457 */ -SECTION_DATA static u8 cc_sph_src[64] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, - 0xD8, 0xFB, 0xFD, 0xFF, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x70, 0x00, 0x00, +static dCcD_SrcSph cc_sph_src = { + { + {0, {{0, 0, 12}, {0xD8FBFDFF, 3}, 0x15}}, + {dCcD_SE_NONE, 0, 0, 0, {0}}, + {dCcD_SE_NONE, 0, 0, 0, {0x80}}, + {0}, + }, + { + { + {0.0f, 0.0f, 0.0f}, + 60.0f, + }, + }, }; /* 8061DAEC-8061DB0C -00001 0020+00 1/0 0/0 0/0 .data l_daB_OH_Method */ @@ -425,24 +257,55 @@ SECTION_RODATA static f32 const lit_3692 = -100.0f; COMPILER_STRIP_GATE(0x8061D9DC, &lit_3692); /* 8061B75C-8061B8B0 00011C 0154+00 1/1 0/0 0/0 .text nodeCallBack__FP8J3DJointi */ +// matches with literals +#ifdef NONMATCHING +static int nodeCallBack(J3DJoint* param_0, int param_1) { + if (param_1 == 0) { + int jnt_no = param_0->getJntNo(); + J3DModel* model_p = j3dSys.getModel(); + b_oh_class* this_ = (b_oh_class*)model_p->getUserArea(); + + if (this_ != NULL && jnt_no >= this_->field_0xca8 && jnt_no <= 29) { + PSMTXCopy(model_p->i_getAnmMtx(jnt_no), *calc_mtx); + mDoMtx_YrotM(*calc_mtx, this_->field_0x61c[jnt_no].y + this_->field_0x784[jnt_no].y); + mDoMtx_ZrotM(*calc_mtx, this_->field_0x61c[jnt_no].x + this_->field_0x784[jnt_no].x); + MtxTrans(this_->mTentacleLength + -100.0f, 1.0f, 1.0f, 1); + PSMTXCopy(*calc_mtx, J3DSys::mCurrentMtx); + MtxScale(1.0f, this_->field_0x8ec[jnt_no] + this_->field_0x9dc[jnt_no], + this_->field_0x8ec[jnt_no] + this_->field_0x9dc[jnt_no], 1); + model_p->i_setAnmMtx(jnt_no, *calc_mtx); + } + } + + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void nodeCallBack(J3DJoint* param_0, int param_1) { +static asm int nodeCallBack(J3DJoint* param_0, int param_1) { nofralloc #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/nodeCallBack__FP8J3DJointi.s" } #pragma pop +#endif /* 8061B8B0-8061B960 000270 00B0+00 1/0 0/0 0/0 .text daB_OH_Draw__FP10b_oh_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daB_OH_Draw(b_oh_class* param_0) { - nofralloc -#include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/daB_OH_Draw__FP10b_oh_class.s" +static int daB_OH_Draw(b_oh_class* i_this) { + if (i_this->mAction == ACTION_NON) { + return 1; + } + + J3DModel* model_p = i_this->mpMorf->getModel(); + + g_env_light.settingTevStruct(0, &i_this->current.pos, &i_this->mTevStr); + g_env_light.setLightTevColorType_MAJI(model_p, &i_this->mTevStr); + + i_this->mpBtk->entry(model_p->getModelData()); + i_this->mpBrk->entry(model_p->getModelData()); + i_this->mInvisModel.entryDL(NULL); + return 1; } -#pragma pop /* ############################################################################################## */ /* 8061D9E0-8061D9E4 00000C 0004+00 0/1 0/0 0/0 .rodata @3781 */ @@ -577,18 +440,64 @@ static u8 lit_1010[1 + 3 /* padding */]; /* 8061DBB4-8061DBB8 -00001 0004+00 1/2 0/0 0/0 .bss None */ /* 8061DBB4 0001+00 data_8061DBB4 @1009 */ /* 8061DBB5 0003+00 data_8061DBB5 None */ -static u8 struct_8061DBB4[4]; +#pragma push +#pragma force_active on +static u8 struct_8061DBB4; +#pragma pop -/* 8061DBB8-8061DBC4 000048 000C+00 1/1 0/0 0/0 .bss @3645 */ -static u8 lit_3645[12]; +static u8 data_8061DBB5; /* 8061DBC4-8061DBD4 000054 0010+00 2/3 0/0 0/0 .bss l_HIO */ -static u8 l_HIO[16]; +static daB_OH_HIO_c l_HIO; /* 8061DBD4-8061DBD8 000064 0004+00 6/7 0/0 0/0 .bss boss */ -static u8 boss[4]; +static b_ob_class* boss; + +/* 8061DBD8-8061DBDC 000068 0004+00 0/1 0/0 0/0 .bss Cinit */ +#pragma push +#pragma force_active on +static int Cinit; +#pragma pop /* 8061B960-8061BB18 000320 01B8+00 1/1 0/0 0/0 .text start__FP10b_oh_class */ +// matches with literals +#ifdef NONMATCHING +static void start(b_oh_class* i_this) { + cXyz sp28; + + switch (i_this->mActionPhase) { + case 0: + if (boss->field_0x4788 != i_this->field_0x5c8) { + i_this->field_0xcac = -1500.0f; + } else { + i_this->field_0x608 = 0.3f; + i_this->mActionPhase = 1; + } + break; + case 1: + if (i_this->field_0xcac < -100.0f) { + for (int i = 0; i < 28; i++) { + PSMTXCopy(i_this->mpMorf->getModel()->i_getAnmMtx(i), mDoMtx_stack_c::get()); + mDoMtx_stack_c::multVecZero(&sp28); + + if (sp28.y > boss->field_0x47a0) { + sp28.y = boss->field_0x47a0; + i_this->field_0x1f80 = + dComIfGp_particle_set(i_this->field_0x1f80, 0x8808, &sp28, NULL, NULL); + break; + } + } + } + + cLib_addCalc0(&i_this->field_0xcac, 0.1f, 30.0f); + cLib_addCalc2(&i_this->field_0x608, 0.3f, 0.1f, 0.005f); + break; + case 2: + cLib_addCalc2(&i_this->field_0x608, 1.0f, 0.1f, 0.05f); + break; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -597,12 +506,14 @@ static asm void start(b_oh_class* param_0) { #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/start__FP10b_oh_class.s" } #pragma pop +#endif /* 8061BB18-8061BB54 0004D8 003C+00 1/1 0/0 0/0 .text __dt__4cXyzFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm cXyz::~cXyz() { +// asm cXyz::~cXyz() { +extern "C" asm void __dt__4cXyzFv() { nofralloc #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/__dt__4cXyzFv.s" } @@ -631,6 +542,32 @@ COMPILER_STRIP_GATE(0x8061DA00, &lit_3807); #pragma pop /* 8061BB54-8061BC6C 000514 0118+00 1/1 0/0 0/0 .text wait__FP10b_oh_class */ +// matches with literals +#ifdef NONMATCHING +static void wait(b_oh_class* i_this) { + daPy_py_c* player_p = (daPy_py_c*)dComIfGp_getPlayer(0); + + switch (i_this->mActionPhase) { + case 0: + i_this->mActionPhase = 1; + i_this->mTimers[0] = (s16)(cM_rndF(30.0f) + 60.0f); + break; + case 1: + cLib_addCalc2(&i_this->field_0x608, 1.0f, 0.1f, 0.005f); + + if (i_this->field_0xca8 == 0 && player_p->current.pos.y < -23000.0f && + i_this->mDistToPlayer < 1300.0f && i_this->mTimers[0] == 0 && + boss->field_0x4744 == 0 && boss->field_0x4794 == 0) + { + i_this->mAction = ACTION_ATTACK; + i_this->mActionPhase = 0; + i_this->field_0xc98 = 0; + boss->field_0x4794 = 3; + } + break; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -639,6 +576,7 @@ static asm void wait(b_oh_class* param_0) { #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/wait__FP10b_oh_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8061DA04-8061DA08 000030 0004+00 0/2 0/0 0/0 .rodata @3870 */ @@ -745,6 +683,125 @@ COMPILER_STRIP_GATE(0x8061DA38, &lit_3883); #pragma pop /* 8061BC6C-8061C070 00062C 0404+00 1/1 0/0 0/0 .text attack__FP10b_oh_class */ +// matches with literals +#ifdef NONMATCHING +static void attack(b_oh_class* i_this) { + daPy_py_c* player_p = (daPy_py_c*)dComIfGp_getPlayer(0); + i_this->field_0xca0++; + + switch (i_this->mActionPhase) { + case 0: + i_this->mActionPhase = 1; + i_this->field_0xc9c = 0.0f; + i_this->field_0xca2 = 0; + i_this->field_0xca4 = 0; + + if ((s16)(i_this->mAngleToPlayer - i_this->current.angle.y) > 0) { + i_this->field_0xc88 = 1; + } else { + i_this->field_0xc88 = -1; + } + + i_this->mActionPhase = 2; + i_this->mTimers[0] = 100; + i_this->field_0xca0 = 0; + i_this->field_0xc98 = 0; + case 1: + case 2: + if (i_this->mTimers[0] == 0) { + i_this->mAction = ACTION_WAIT; + i_this->mActionPhase = 0; + i_this->field_0xc98 = 0; + i_this->field_0xca2 = 0; + return; + } + case 3: + cLib_addCalcAngleS2(&i_this->field_0xc98, 0x200, 1, 32); + + if (i_this->field_0xca0 > 8) { + cLib_addCalc2(&i_this->field_0xc90, -0.12f, 0.8f, 0.02f); + } + + if (i_this->field_0xca0 < 70) { + cLib_addCalcAngleS2(&i_this->field_0xca4, 0, 1, 500); + cLib_addCalcAngleS2(&i_this->current.angle.y, + i_this->mAngleToPlayer + i_this->field_0xc88 * -0x600, 2, 0x400); + cLib_addCalc2(&i_this->field_0xc9c, 200.0f, 0.5f, 50.0f); + + if (i_this->field_0xca0 < 30) { + f32 fvar = player_p->current.pos.y - -24000.0f; + if (fvar > 1000.0f) { + fvar = 1000.0f; + } + + i_this->field_0xc96 = fvar + 3700.0f; + + cLib_addCalcAngleS2(&i_this->current.angle.x, + (s16)(-fvar * 2.0f + 11700.0f) - 0x4000, 1, 1000); + } + } else { + s16 var7; + s16 var3; + + if (i_this->mTimers[1] != 0) { + var7 = 6; + var3 = i_this->field_0xc88 * 9000; + } else { + var7 = 10; + var3 = i_this->field_0xc88 * 5000; + } + + cLib_addCalcAngleS2(&i_this->field_0xca2, var7, 1, 1); + cLib_addCalcAngleS2(&i_this->field_0xca4, var3, 1, 500); + + if (i_this->mTimers[1] == 0 || i_this->mTimers[1] > 10) { + i_this->current.angle.y += (s16)(i_this->field_0xc88 * 300); + } + + if (i_this->mActionPhase == 2) { + for (int i = 7; i < 15; i++) { + if (i_this->mColliders[i].ChkCoHit()) { + cCcD_Obj* obj_p = i_this->mColliders[i].GetCoHitObj(); + if (fopAcM_GetName(obj_p->GetAc()) == PROC_ALINK && + !i_dComIfGp_event_runCheck()) + { + if (!player_p->checkHookshotShootReturnMode() && + boss->field_0x4744 == 0) + { + i_this->mActionPhase = 3; + boss->mDemoAction = 1; + boss->field_0x5ce8 = i_this->field_0x5c8; + i_this->mTimers[1] = 20; + + if (boss->field_0x4752 != 1) { + boss->field_0x4752 = 1; + boss->field_0x4754 = 0; + boss->field_0x4738 = 30; + boss->field_0x473c = 2; + } + + boss->field_0x59e0.startTentacleSound( + Z2SE_EN_OI_TENT_SWING, i_this->field_0x5c8, 0, + dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + break; + } + } + } + } + } + } + + cLib_addCalcAngleS2(&i_this->field_0xc94, 22500, 1, 2000); + cLib_addCalc2(&i_this->field_0xc8c, 4000.0f, 1.0f, 400.0f); + if (i_this->mTimers[1] == 1) { + i_this->mAction = ACTION_CAUGHT; + i_this->mActionPhase = 0; + i_this->field_0xc98 = 0; + } + break; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -753,6 +810,7 @@ static asm void attack(b_oh_class* param_0) { #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/attack__FP10b_oh_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8061DA3C-8061DA40 000068 0004+00 0/1 0/0 0/0 .rodata @3911 */ @@ -763,6 +821,45 @@ COMPILER_STRIP_GATE(0x8061DA3C, &lit_3911); #pragma pop /* 8061C070-8061C1F8 000A30 0188+00 1/1 0/0 0/0 .text caught__FP10b_oh_class */ +// matches with literals +#ifdef NONMATCHING +static void caught(b_oh_class* i_this) { + i_this->field_0x5f4 = 6; + + switch (i_this->mActionPhase) { + case 0: + i_this->mActionPhase = 1; + i_this->mTimers[0] = 10; + i_this->mTimers[1] = 50; + case 1: + i_this->field_0x60c = 500.0f; + cLib_addCalcAngleS2(&i_this->field_0xca2, 6, 1, 1); + cLib_addCalcAngleS2(&i_this->field_0xca4, i_this->field_0xc88 * 9000, 1, 500); + + if (i_this->mTimers[0] == 1) { + boss->field_0x4738 = 21; + boss->field_0x473c = 0; + boss->field_0x59e0.startCreatureVoice(Z2SE_EN_OI_V_EAT, -1); + } + + if (!(i_this->field_0x5cc & 0xF)) { + dComIfGp_getVibration().StartShock(3, 31, cXyz(0.0f, 1.0f, 0.0f)); + } + + if (i_this->mTimers[1] == 0) { + if (boss->mDemoAction != 0) { + boss->mDemoAction = 3; + boss->field_0x5c82 = 0; + } + + i_this->mAction = ACTION_WAIT; + i_this->mActionPhase = 0; + i_this->field_0xc98 = 0; + } + break; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -771,6 +868,7 @@ static asm void caught(b_oh_class* param_0) { #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/caught__FP10b_oh_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8061DA40-8061DA44 00006C 0004+00 0/2 0/0 0/0 .rodata @3921 */ @@ -781,6 +879,26 @@ COMPILER_STRIP_GATE(0x8061DA40, &lit_3921); #pragma pop /* 8061C1F8-8061C298 000BB8 00A0+00 1/1 0/0 0/0 .text end__FP10b_oh_class */ +// matches with literals +#ifdef NONMATCHING +static void end(b_oh_class* i_this) { + i_this->field_0x5f4 = 6; + + switch (i_this->mActionPhase) { + case 0: + i_this->mActionPhase = 1; + i_this->mTimers[0] = 70; + break; + case 1: + cLib_addCalc2(&i_this->field_0x60c, 1000.0f, 1.0f, 150.0f); + + if (i_this->mTimers[0] == 0) { + cLib_addCalc0(&i_this->mTentacleLength, 1.0f, 1.0f); + } + break; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -789,18 +907,214 @@ static asm void end(b_oh_class* param_0) { #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/end__FP10b_oh_class.s" } #pragma pop +#endif /* 8061C298-8061C2C4 000C58 002C+00 1/1 0/0 0/0 .text non__FP10b_oh_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void non(b_oh_class* param_0) { - nofralloc -#include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/non__FP10b_oh_class.s" +static void non(b_oh_class* i_this) { + i_this->field_0x5f4 = 6; + + switch (i_this->mActionPhase) { + case 0: + i_this->mActionPhase = 1; + break; + case 1: + break; + } } -#pragma pop /* 8061C2C4-8061CB4C 000C84 0888+00 2/1 0/0 0/0 .text action__FP10b_oh_class */ +// close-ish +#ifdef NONMATCHING +static void action(b_oh_class* i_this) { + BOOL bvar; + int uvar; + + cXyz local_90; + cXyz cstack_9c; + + i_this->mAngleToPlayer = fopAcM_searchPlayerAngleY(i_this); + i_this->mDistToPlayer = fopAcM_searchPlayerDistance(i_this); + + fopAcM_OffStatus(i_this, 0); + i_this->mAttentionInfo.mFlags = 0; + + uvar = 0; + bvar = true; + + cLib_addCalcAngleS2(&i_this->field_0xc98, 0x800, 1, 0x10); + + switch (i_this->mAction) { + case ACTION_START: + start(i_this); + uvar = 1; + break; + case ACTION_WAIT: + wait(i_this); + uvar = 1; + break; + case ACTION_ATTACK: + attack(i_this); + uvar = 2; + boss->field_0x4794 = 180; + break; + case ACTION_CAUGHT: + caught(i_this); + bvar = false; + uvar = 3; + boss->field_0x4794 = 180; + break; + case ACTION_END: + end(i_this); + uvar = 1; + break; + case ACTION_NON: + non(i_this); + return; + } + + if (boss->field_0x4752 == 2) { + cLib_addCalc2(&i_this->field_0x60c, 500.0f, 1.0f, 80.0f); + } + + if (uvar == 1) { + f32 fvar15 = i_this->field_0x608 * 500.0f; + f32 fvar14 = i_this->field_0x608 * 1500.0f; + s16 tmp = 2000; + + for (int i = i_this->field_0xca8; i < 30; i++) { + f32 fvar = 1.0f; + if (i < 5) { + fvar = i * 0.2f; + } else if (i >= 20) { + fvar = (i - 20) * 0.3f + 1.0f; + } + + i_this->field_0x6d0[i].x = fvar * (fvar15 * cM_ssin(i_this->field_0x5f8 + (i * 1800))); + i_this->field_0x6d0[i].y = fvar * (fvar14 * cM_ssin(i_this->field_0x5fa + (i * 1800))); + + i_this->field_0x838[i].x = + tmp + fvar * (fvar15 * cM_ssin(i_this->field_0x5fa + (i * 7000)) * 0.5f); + i_this->field_0x838[i].y = + fvar * (fvar14 * cM_ssin(i_this->field_0x5f8 + (i * 7000)) * 0.5f); + + tmp -= 200; + if (tmp < 0) { + tmp = 0; + } + + i_this->field_0x964[i] = + i_this->field_0x610 + 1.0f + + i_this->field_0x610 * cM_ssin(i_this->field_0x5f6 + i * -10000); + } + + cLib_addCalcAngleS2(&i_this->current.angle.x, -0xF2C, 4, 100); + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->orig.angle.y, 4, 0x100); + } else if (uvar == 2) { + f32 fvar = i_this->field_0xc8c; + for (int i = i_this->field_0xca8; i < 30; i++) { + if (i >= 30 - i_this->field_0xca2) { + i_this->field_0x6d0[i].y = i_this->field_0xca4; + } else { + i_this->field_0x6d0[i].y = 0; + } + + if (i >= 13) { + fvar *= i_this->field_0xc90 + 1.0f; + } + + i_this->field_0x6d0[i].x = + fvar * cM_ssin(i_this->field_0xc94 + i * i_this->field_0xc96); + + if (i >= 18) { + i_this->field_0x838[i].x = + i_this->field_0xc9c * cM_ssin(i_this->field_0x5cc * 1000 + i * -4000); + } else { + i_this->field_0x838[i].x = 0; + } + + i_this->field_0x838[i].y = 0; + i_this->field_0x964[i] = + i_this->field_0x610 + 1.0f + + i_this->field_0x610 * cM_ssin(i_this->field_0x5f6 + i * -10000); + } + } else if (uvar == 3) { + for (int i = i_this->field_0xca8; i < 30; i++) { + i_this->field_0x838[i].y = 0; + i_this->field_0x838[i].x = 0; + + if (i >= 30 - i_this->field_0xca2) { + i_this->field_0x6d0[i].y = i_this->field_0xca4; + i_this->field_0x6d0[i].x = 0; + i_this->field_0x964[i] = 1.0f; + } else { + i_this->field_0x6d0[i].y = 0; + i_this->field_0x6d0[i].x = 2250; + i_this->field_0x964[i] = + i_this->field_0x610 + 1.0f + + i_this->field_0x610 * cM_ssin(i_this->field_0x5f6 + i * -10000); + } + } + + cLib_addCalcAngleS2(&i_this->current.angle.x, 0xA92, 4, 0x200); + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->orig.angle.y, 4, 0x800); + } + + i_this->field_0x600 = + (-i_this->field_0x614 - i_this->field_0x60c) + cM_ssin(i_this->field_0x5cc * 200) * 100.0f; + i_this->field_0x604 = ((100.0f - i_this->field_0x614) - i_this->field_0x60c) + + cM_ssin(i_this->field_0x5cc * 200) * 100.0f; + i_this->field_0x5f8 += (s16)i_this->field_0x600; + i_this->field_0x5fa += (s16)i_this->field_0x604; + i_this->field_0x5fc = i_this->field_0x60c + 2000.0f; + i_this->field_0x5f6 += (s16)i_this->field_0x5fc; + + cLib_addCalc0(&i_this->field_0x60c, 0.1f, 50.0f); + cLib_addCalc2(&i_this->field_0x610, 0.2f, 0.1f, 0.01f); + + if (uvar <= 3) { + cLib_addCalc2(&i_this->mTentacleLength, l_HIO.mLength, 0.1f, 0.5f); + } + + PSMTXCopy(i_this->mpMorf->getModel()->i_getAnmMtx(i_this->field_0x5c8 + 8), + mDoMtx_stack_c::get()); + mDoMtx_stack_c::multVecZero(&i_this->current.pos); + + local_90.x = i_this->current.pos.x - boss->orig.pos.x; + local_90.z = i_this->current.pos.z - boss->orig.pos.z; + i_this->orig.angle.y = cM_atan2s(local_90.x, local_90.z); + cLib_addCalcAngleS2(&i_this->shape_angle.y, i_this->current.angle.y, 2, 0x2000); + cLib_addCalcAngleS2(&i_this->shape_angle.x, i_this->current.angle.x, 2, 0x2000); + + for (int i = i_this->field_0xca8; i < 30; i++) { + if (Cinit) { + i_this->field_0x61c[i] = i_this->field_0x6d0[i]; + i_this->field_0x784[i] = i_this->field_0x838[i]; + i_this->field_0x8ec[i] = i_this->field_0x964[i]; + } else { + cLib_addCalcAngleS2(&i_this->field_0x61c[i].x, i_this->field_0x6d0[i].x, 2, + i_this->field_0xc98); + cLib_addCalcAngleS2(&i_this->field_0x61c[i].y, i_this->field_0x6d0[i].y, 2, + i_this->field_0xc98); + cLib_addCalcAngleS2(&i_this->field_0x784[i].x, i_this->field_0x838[i].x, 2, + i_this->field_0xc98); + cLib_addCalcAngleS2(&i_this->field_0x784[i].y, i_this->field_0x838[i].y, 2, + i_this->field_0xc98); + cLib_addCalc2(&i_this->field_0x8ec[i], i_this->field_0x964[i], 0.5f, 0.2f); + cLib_addCalc0(&i_this->field_0x9dc[i], 0.1f, 0.2f); + } + } + + for (int i = 0; i < 15; i++) { + if (bvar && boss->mDemoAction == 0) { + i_this->mColliders[i].OnCoSetBit(); + } else { + i_this->mColliders[i].OffCoSetBit(); + } + } + + Cinit = 0; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -809,6 +1123,7 @@ static asm void action(b_oh_class* param_0) { #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/action__FP10b_oh_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8061DA44-8061DA48 000070 0004+00 0/0 0/0 0/0 .rodata @4160 */ @@ -870,6 +1185,60 @@ COMPILER_STRIP_GATE(0x8061DA64, &lit_4216); #pragma pop /* 8061CB4C-8061CD98 00150C 024C+00 1/1 0/0 0/0 .text damage_check__FP10b_oh_class */ +// matches with literals +#ifdef NONMATCHING +static void damage_check(b_oh_class* i_this) { + i_this->mCcStts.Move(); + + if (i_this->field_0x5f4 == 0) { + BOOL bvar = false; + for (int i = 7; i < 15; i++) { + if (i_this->mColliders[i].ChkTgHit()) { + i_this->mAtInfo.mpCollider = i_this->mColliders[i].GetTgHitObj(); + i_this->mHealth = 1000; + cc_at_check(i_this, &i_this->mAtInfo); + + PSMTXCopy(i_this->mpMorf->getModel()->i_getAnmMtx(i * 2 + 1), + mDoMtx_stack_c::get()); + mDoMtx_stack_c::multVecZero(&i_this->mEyePos); + i_dComIfGp_setHitMark(1, i_this, &i_this->mEyePos, NULL, NULL, 0); + mDoAud_seStart(Z2SE_EN_OI_HIT_TENTACLE, &i_this->mEyePos, 0, 0); + + bvar = true; + i_this->field_0x5f4 = 20; + break; + } + } + + if (i_this->mAction == ACTION_ATTACK && boss->field_0x5d10) { + boss->field_0x5d10 = 0; + bvar = true; + } + + if (bvar) { + i_this->field_0x60c = 2000.0f; + i_this->field_0x610 = 0.5f; + + if (i_this->mAction != ACTION_WAIT) { + i_this->mAction = ACTION_WAIT; + i_this->mActionPhase = 0; + i_this->field_0xc98 = 0; + i_this->field_0xca2 = 0; + } + + if (boss->mDemoAction != 0) { + boss->mDemoAction = 100; + boss->field_0x4738 = 30; + boss->field_0x473c = 2; + boss->field_0x4794 = 180; + } + + i_this->field_0x5f4 = 6; + boss->field_0x59e0.startCreatureVoice(Z2SE_EN_OI_V_TENT_DAMAGE, -1); + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -878,6 +1247,7 @@ static asm void damage_check(b_oh_class* param_0) { #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/damage_check__FP10b_oh_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8061DA68-8061DA6C 000094 0004+00 0/1 0/0 0/0 .rodata @4297 */ @@ -888,6 +1258,83 @@ COMPILER_STRIP_GATE(0x8061DA68, &lit_4297); #pragma pop /* 8061CD98-8061D05C 001758 02C4+00 2/1 0/0 0/0 .text daB_OH_Execute__FP10b_oh_class */ +// matches with literals +#ifdef NONMATCHING +static int daB_OH_Execute(b_oh_class* i_this) { + if (cDmrNowMidnaTalk()) { + return 1; + } + + if (i_this->field_0x5c8 == 0) { + boss = (b_ob_class*)fopAcM_SearchByID(i_this->mParentPcId); + } + + if (boss == NULL) { + return 1; + } + + if (boss->field_0x4752 == 5 && i_this->mAction != ACTION_END) { + i_this->mAction = ACTION_END; + i_this->mActionPhase = 0; + } + + cXyz collider_center; + + i_this->field_0x5cc++; + + for (int i = 0; i < 4; i++) { + if (i_this->mTimers[i] != 0) { + i_this->mTimers[i]--; + } + } + + if (i_this->field_0x5f4 != 0) { + i_this->field_0x5f4--; + } + + damage_check(i_this); + action(i_this); + + mDoMtx_stack_c::transS(i_this->current.pos.x, i_this->current.pos.y + i_this->field_0xcac, + i_this->current.pos.z); + mDoMtx_stack_c::YrotM(i_this->shape_angle.y); + mDoMtx_stack_c::XrotM(i_this->shape_angle.x); + mDoMtx_stack_c::scaleM(l_HIO.mModelSize, l_HIO.mModelSize, l_HIO.mModelSize); + + J3DModel* model_p = i_this->mpMorf->getModel(); + model_p->i_setBaseTRMtx(mDoMtx_stack_c::get()); + i_this->mpMorf->play(NULL, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this)), 0); + i_this->mpBtk->play(); + i_this->mpBrk->play(); + i_this->mpMorf->modelCalc(); + + int tmp = 1; + if (i_this->mDistToPlayer > 150.0f && i_this->mAction == ACTION_WAIT) { + tmp = i_this->field_0x5cc & 1; + } + + for (int i = 0; i < 15; i++) { + PSMTXCopy(model_p->i_getAnmMtx(tmp + i * 2), mDoMtx_stack_c::get()); + mDoMtx_stack_c::multVecZero(&collider_center); + + if (i_this->mAction >= ACTION_END) { + collider_center.z -= 20000.0f; + } + + i_this->mColliders[i].SetC(collider_center); + + if (i_this->mAction == ACTION_ATTACK) { + i_this->mColliders[i].SetR(l_HIO.mModelSize * 70.0f); + } else { + i_this->mColliders[i].SetR(l_HIO.mModelSize * 50.0f); + } + + dComIfG_Ccsp()->Set(&i_this->mColliders[i]); + } + + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -896,10 +1343,11 @@ static asm void daB_OH_Execute(b_oh_class* param_0) { #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/daB_OH_Execute__FP10b_oh_class.s" } #pragma pop +#endif /* 8061D05C-8061D064 001A1C 0008+00 1/0 0/0 0/0 .text daB_OH_IsDelete__FP10b_oh_class */ -static bool daB_OH_IsDelete(b_oh_class* param_0) { - return true; +static int daB_OH_IsDelete(b_oh_class* i_this) { + return 1; } /* ############################################################################################## */ @@ -910,14 +1358,14 @@ SECTION_DEAD static char const* const stringBase_8061DA74 = "B_oh"; #pragma pop /* 8061D064-8061D0B8 001A24 0054+00 1/0 0/0 0/0 .text daB_OH_Delete__FP10b_oh_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daB_OH_Delete(b_oh_class* param_0) { - nofralloc -#include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/daB_OH_Delete__FP10b_oh_class.s" +static int daB_OH_Delete(b_oh_class* i_this) { + dComIfG_resDelete(&i_this->mPhase, "B_oh"); + if (i_this->field_0x1f86) { + data_8061DBB5 = 0; + } + + return 1; } -#pragma pop /* ############################################################################################## */ /* 8061DA6C-8061DA70 000098 0004+00 0/1 0/0 0/0 .rodata @4438 */ @@ -928,20 +1376,73 @@ COMPILER_STRIP_GATE(0x8061DA6C, &lit_4438); #pragma pop /* 8061D0B8-8061D39C 001A78 02E4+00 1/1 0/0 0/0 .text useHeapInit__FP10fopAc_ac_c */ +// matches with literals +#ifdef NONMATCHING +static int useHeapInit(fopAc_ac_c* i_this) { + b_oh_class* this_ = (b_oh_class*)i_this; + + this_->mpMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("B_oh", 0x29), NULL, + NULL, NULL, 2, 1.0f, 0, -1, 1, NULL, 0, 0x11000284); + if (this_->mpMorf == NULL || this_->mpMorf->getModel() == NULL) { + return 0; + } + + if (!this_->mInvisModel.create(this_->mpMorf->getModel(), 1)) { + return 0; + } + + this_->mpMorf->getModel()->setUserArea((u32)this_); + + for (u16 i = 0; i < this_->mpMorf->getModel()->getModelData()->getJointNum(); i++) { + this_->mpMorf->getModel()->getModelData()->getJointNodePointer(i)->setCallBack( + nodeCallBack); + } + + this_->mpBtk = new mDoExt_btkAnm(); + if (this_->mpBtk == NULL) { + return 0; + } + + J3DAnmTextureSRTKey* btk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("B_oh", 0x36); + if (!this_->mpBtk->init(this_->mpMorf->getModel()->getModelData(), btk, TRUE, 2, 1.0f, 0, -1)) { + return 0; + } + + this_->mpBtk->setFrame(cM_rndF(39.0f)); + this_->mpBtk->setPlaySpeed(cM_rndFX(0.1f) + 1.0f); + + this_->mpBrk = new mDoExt_brkAnm(); + if (this_->mpBrk == NULL) { + return 0; + } + + J3DAnmTevRegKey* brk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("B_oh", 0x2F); + if (!this_->mpBrk->init(this_->mpMorf->getModel()->getModelData(), brk, TRUE, 2, 1.0f, 0, -1)) { + return 0; + } + + this_->mpBrk->setFrame(cM_rndF(39.0f)); + this_->mpBrk->setPlaySpeed(cM_rndFX(0.1f) + 1.0f); + + return 1; +} +#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/b/d_a_b_oh/d_a_b_oh/useHeapInit__FP10fopAc_ac_c.s" } #pragma pop +#endif /* 8061D39C-8061D3E4 001D5C 0048+00 1/0 0/0 0/0 .text __dt__12J3DFrameCtrlFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm J3DFrameCtrl::~J3DFrameCtrl() { +// asm J3DFrameCtrl::~J3DFrameCtrl() { +extern "C" asm void __dt__12J3DFrameCtrlFv() { nofralloc #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/__dt__12J3DFrameCtrlFv.s" } @@ -955,13 +1456,66 @@ SECTION_RODATA static f32 const lit_4519 = 65536.0f; COMPILER_STRIP_GATE(0x8061DA70, &lit_4519); #pragma pop -/* 8061DBD8-8061DBDC 000068 0004+00 0/1 0/0 0/0 .bss Cinit */ -#pragma push -#pragma force_active on -static u8 Cinit[4]; -#pragma pop - /* 8061D3E4-8061D718 001DA4 0334+00 1/0 0/0 0/0 .text daB_OH_Create__FP10fopAc_ac_c */ +// matches with literals +#ifdef NONMATCHING +static int daB_OH_Create(fopAc_ac_c* i_this) { + if (!fopAcM_CheckCondition(i_this, 8)) { + new (i_this) b_oh_class(); + fopAcM_OnCondition(i_this, 8); + } + b_oh_class* this_ = (b_oh_class*)i_this; + + int phase = dComIfG_resLoad(&this_->mPhase, "B_oh"); + if (phase == cPhs_COMPLEATE_e) { + this_->field_0x5c8 = fopAcM_GetParam(this_) & 0xFF; + + if (!fopAcM_entrySolidHeap(this_, useHeapInit, 0x23E0)) { + return cPhs_ERROR_e; + } + + if (!data_8061DBB5) { + this_->field_0x1f86 = 1; + data_8061DBB5 = 1; + l_HIO.field_0x4 = -1; + } + + this_->mHealth = 1000; + this_->field_0x560 = 1000; + + this_->field_0x5cc = cM_rndF(65536.0f); + this_->field_0x5f6 = cM_rndF(65536.0f); + this_->field_0x5f8 = cM_rndF(65536.0f); + this_->field_0x5fa = cM_rndF(65536.0f); + this_->field_0x614 = cM_rndF(100.0f) + 400.0f; + + this_->mCcStts.Init(0xFF, 0, this_); + for (int i = 0; i < 15; i++) { + this_->mColliders[i].Set(cc_sph_src); + this_->mColliders[i].SetStts(&this_->mCcStts); + this_->mColliders[i].OnTgNoHitMark(); + } + + this_->current.angle.x = -0x3448; + + if (cDmr_SkipInfo) { + this_->mAction = ACTION_WAIT; + this_->mActionPhase = 1; + this_->mTimers[0] = cM_rndF(100.0f) + 200.0f; + this_->mTentacleLength = l_HIO.mLength; + this_->field_0x608 = 1.0f; + Cinit = 1; + } else { + this_->mAction = ACTION_START; + Cinit = 0; + } + + daB_OH_Execute(this_); + } + + return phase; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -970,12 +1524,14 @@ static asm void daB_OH_Create(fopAc_ac_c* param_0) { #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/daB_OH_Create__FP10fopAc_ac_c.s" } #pragma pop +#endif /* 8061D718-8061D7E4 0020D8 00CC+00 1/1 0/0 0/0 .text __dt__8dCcD_SphFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm dCcD_Sph::~dCcD_Sph() { +// asm dCcD_Sph::~dCcD_Sph() { +extern "C" asm void __dt__8dCcD_SphFv() { nofralloc #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/__dt__8dCcD_SphFv.s" } @@ -985,7 +1541,8 @@ asm dCcD_Sph::~dCcD_Sph() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm dCcD_Sph::dCcD_Sph() { +// asm dCcD_Sph::dCcD_Sph() { +extern "C" asm void __ct__8dCcD_SphFv() { nofralloc #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/__ct__8dCcD_SphFv.s" } @@ -995,7 +1552,8 @@ asm dCcD_Sph::dCcD_Sph() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm cM3dGSph::~cM3dGSph() { +// asm cM3dGSph::~cM3dGSph() { +extern "C" asm void __dt__8cM3dGSphFv() { nofralloc #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/__dt__8cM3dGSphFv.s" } @@ -1005,14 +1563,16 @@ asm cM3dGSph::~cM3dGSph() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm cM3dGAab::~cM3dGAab() { +// asm cM3dGAab::~cM3dGAab() { +extern "C" asm void __dt__8cM3dGAabFv() { nofralloc #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/__dt__8cM3dGAabFv.s" } #pragma pop /* 8061D8F8-8061D8FC 0022B8 0004+00 1/1 0/0 0/0 .text __ct__4cXyzFv */ -cXyz::cXyz() { +// cXyz::cXyz() { +extern "C" void __ct__4cXyzFv() { /* empty function */ } @@ -1020,14 +1580,16 @@ cXyz::cXyz() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm csXyz::~csXyz() { +// asm csXyz::~csXyz() { +extern "C" asm void __dt__5csXyzFv() { nofralloc #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/__dt__5csXyzFv.s" } #pragma pop /* 8061D938-8061D93C 0022F8 0004+00 1/1 0/0 0/0 .text __ct__5csXyzFv */ -csXyz::csXyz() { +// csXyz::csXyz() { +extern "C" void __ct__5csXyzFv() { /* empty function */ } @@ -1041,21 +1603,6 @@ asm daB_OH_HIO_c::~daB_OH_HIO_c() { } #pragma pop -/* 8061D984-8061D9C0 002344 003C+00 0/0 1/0 0/0 .text __sinit_d_a_b_oh_cpp */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void __sinit_d_a_b_oh_cpp() { - nofralloc -#include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/__sinit_d_a_b_oh_cpp.s" -} -#pragma pop - -#pragma push -#pragma force_active on -REGISTER_CTORS(0x8061D984, __sinit_d_a_b_oh_cpp); -#pragma pop - /* ############################################################################################## */ /* 8061DBDC-8061DBE0 00006C 0004+00 0/0 0/0 0/0 .bss * sInstance__40JASGlobalInstance<19JASDefaultBankTable> */