From f547247a81c67940bddd6bc0c8ee6ca364936808 Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Tue, 3 Jan 2023 00:16:08 -0700 Subject: [PATCH 01/34] food_check --- Makefile | 1 + include/rel/d/a/d_a_do/d_a_do.h | 130 +++++++++++++ rel/d/a/d_a_do/d_a_do.cpp | 317 +++++--------------------------- 3 files changed, 181 insertions(+), 267 deletions(-) diff --git a/Makefile b/Makefile index 7ddf95c491d..8de543faaae 100644 --- a/Makefile +++ b/Makefile @@ -154,6 +154,7 @@ docs: rels: $(ELF) $(RELS) @echo generating RELs from .plf @$(PYTHON) $(MAKEREL) build --string-table $(BUILD_DIR)/frameworkF.str $(RELS) $(ELF) + @$(PYTHON) tools/tp.py check --rels $(ELF): $(LIBS) $(O_FILES) @echo $(O_FILES) > build/o_files diff --git a/include/rel/d/a/d_a_do/d_a_do.h b/include/rel/d/a/d_a_do/d_a_do.h index d957b0c775b..cc8e969a555 100644 --- a/include/rel/d/a/d_a_do/d_a_do.h +++ b/include/rel/d/a/d_a_do/d_a_do.h @@ -2,5 +2,135 @@ #define D_A_DO_H #include "dolphin/types.h" +#include "d/a/d_a_player.h" +// #include "d/a/d_a_item_static.h" +#include "d/msg/d_msg_flow.h" +#include "d/particle/d_particle.h" +#include "f_op/f_op_actor.h" +#include "m_Do/m_Do_mtx.h" +#include "m_Do/m_Do_ext.h" +#include "m_Do/m_Do_controller_pad.h" +#include "JSystem/J3DGraphAnimator/J3DAnimation.h" +#include "SSystem/SComponent/c_phase.h" + + +struct do_class : public fopAc_ac_c { +public: + /* 0x56C */ u8 field_0x56c[138]; + /* 0x5F2 */ s16 field_0x5f2; + /* 0x5F4 */ u8 field_0x5f4[2]; + /* 0x5F6 */ u16 field_0x5f6; + /* 0x5F8 */ u8 field_0x5f8[140]; + /* 0x684 */ u32 isFood; + +public: + /* 8066EAE4 */ do_class(); +}; + +class daDo_HIO_c : public J3DFrameCtrl { +private: + /* 0x14 */ u32 field_0x14; + /* 0x18 */ u32 field_0x18; + /* 0x1C */ u8 field_0x1c; + /* 0x1D */ u8 field_0x1d; + /* 0x1E */ u16 field_0x1e; + +public: + /* 80667D4C */ daDo_HIO_c(); + /* 8066ED40 */ virtual ~daDo_HIO_c(); +}; + +struct daItem_c { + /* 80037BF4 */ void startControl(); + /* 80037C04 */ void endControl(); +}; + +struct dEvt_control_c { + /* 80042468 */ void reset(); +}; + +struct dCcD_Stts { + /* 80083860 */ void Init(int, int, fopAc_ac_c*); +}; + +struct dCcD_SrcSph {}; + +struct dCcD_Sph { + /* 80084A34 */ void Set(dCcD_SrcSph const&); +}; + +struct dCcD_GStts { + /* 80083760 */ dCcD_GStts(); +}; + +struct dCcD_GObjInf { + /* 80083A28 */ dCcD_GObjInf(); +}; + +struct dBgS_PolyPassChk { + /* 80078E68 */ void SetObj(); +}; + +struct dBgS_ObjGndChk_Spl { + /* 800777B0 */ dBgS_ObjGndChk_Spl(); + /* 80077848 */ ~dBgS_ObjGndChk_Spl(); +}; + +struct dBgS_ObjAcch { + /* 8066ECD0 */ ~dBgS_ObjAcch(); +}; + +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 dBgS_AcchCir { + /* 80075EAC */ dBgS_AcchCir(); + /* 80075F58 */ void SetWall(f32, f32); +}; + +struct dBgS {}; + +struct dBgS_Acch { + /* 80075F94 */ ~dBgS_Acch(); + /* 800760A0 */ dBgS_Acch(); + /* 80076248 */ void Set(cXyz*, cXyz*, fopAc_ac_c*, int, dBgS_AcchCir*, cXyz*, csXyz*, csXyz*); + /* 80076AAC */ void CrrPos(dBgS&); +}; + +struct cM3dGSph { + /* 8026F648 */ void SetC(cXyz const&); + /* 8026F708 */ void SetR(f32); + /* 8066EC40 */ ~cM3dGSph(); +}; + +struct cM3dGAab { + /* 8066EC88 */ ~cM3dGAab(); +}; + +struct cCcD_Obj {}; + +struct cCcS { + /* 80264BA8 */ void Set(cCcD_Obj*); +}; + +struct cBgS_LinChk {}; + +struct cBgS_GndChk { + /* 80267D28 */ void SetPos(cXyz const*); + /* 80267D0C */ void SetPos(Vec const*); +}; + +struct cBgS { + /* 800743B4 */ void LineCross(cBgS_LinChk*); + /* 800744A0 */ void GroundCross(cBgS_GndChk*); +}; #endif /* D_A_DO_H */ diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 390b34922f8..3d24df718ff 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -6,250 +6,7 @@ #include "rel/d/a/d_a_do/d_a_do.h" #include "dol2asm.h" #include "dolphin/types.h" - -// -// Types: -// - -struct request_of_phase_process_class {}; - -struct mDoMtx_stack_c { - /* 8000CE38 */ void scaleM(f32, f32, f32); - - static u8 now[48]; -}; - -struct J3DMaterialTable {}; - -struct J3DAnmTexPattern {}; - -struct mDoExt_btpAnm { - /* 8000D54C */ void init(J3DMaterialTable*, J3DAnmTexPattern*, int, int, f32, s16, s16); - /* 8000D5E8 */ void entry(J3DMaterialTable*, s16); -}; - -struct J3DAnmTextureSRTKey {}; - -struct mDoExt_btkAnm { - /* 8000D63C */ void init(J3DMaterialTable*, J3DAnmTextureSRTKey*, int, int, f32, s16, s16); - /* 8000D6D8 */ void entry(J3DMaterialTable*, f32); -}; - -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); - /* 8001037C */ void setAnm(J3DAnmTransform*, int, f32, f32, f32, f32, void*); - /* 800105C8 */ void play(Vec*, u32, s8); - /* 80010680 */ void entryDL(); - /* 800106AC */ void modelCalc(); -}; - -struct mDoCPd_c { - static u8 m_cpadInfo[256]; -}; - -struct fopAc_ac_c { - /* 80018B64 */ fopAc_ac_c(); -}; - -struct do_class { - /* 8066EAE4 */ do_class(); -}; - -struct daPy_py_c { - /* 8015F55C */ void linkGrabSubjectNoDraw(fopAc_ac_c*); -}; - -struct daItem_c { - /* 80037BF4 */ void startControl(); - /* 80037C04 */ void endControl(); -}; - -struct daDo_HIO_c { - /* 80667D4C */ daDo_HIO_c(); - /* 8066ED40 */ ~daDo_HIO_c(); -}; - -struct dKy_tevstr_c {}; - -struct cXyz { - /* 80266AE4 */ void operator+(Vec const&) const; - /* 80266B34 */ void operator-(Vec const&) const; - /* 80266B84 */ void operator*(f32) const; - /* 80668134 */ ~cXyz(); -}; - -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 {}; - -struct _GXColor {}; - -struct dPa_control_c { - /* 8004CA90 */ void set(u8, u16, cXyz const*, dKy_tevstr_c const*, csXyz const*, cXyz const*, - u8, dPa_levelEcallBack*, s8, _GXColor const*, _GXColor const*, - cXyz const*, f32); - /* 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 dMsgFlow_c { - /* 80249F00 */ dMsgFlow_c(); - /* 80249F90 */ void init(fopAc_ac_c*, int, int, fopAc_ac_c**); - /* 8024A2D8 */ void doFlow(fopAc_ac_c*, fopAc_ac_c**, int); -}; - -struct dEvt_control_c { - /* 80042468 */ void reset(); -}; - -struct dDlst_shadowControl_c { - static u8 mSimpleTexObj[32]; -}; - -struct dCcD_Stts { - /* 80083860 */ void Init(int, int, fopAc_ac_c*); -}; - -struct dCcD_SrcSph {}; - -struct dCcD_Sph { - /* 80084A34 */ void Set(dCcD_SrcSph const&); -}; - -struct dCcD_GStts { - /* 80083760 */ dCcD_GStts(); -}; - -struct dCcD_GObjInf { - /* 80083A28 */ dCcD_GObjInf(); -}; - -struct dBgS_PolyPassChk { - /* 80078E68 */ void SetObj(); -}; - -struct dBgS_ObjGndChk_Spl { - /* 800777B0 */ dBgS_ObjGndChk_Spl(); - /* 80077848 */ ~dBgS_ObjGndChk_Spl(); -}; - -struct dBgS_ObjAcch { - /* 8066ECD0 */ ~dBgS_ObjAcch(); -}; - -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 dBgS_AcchCir { - /* 80075EAC */ dBgS_AcchCir(); - /* 80075F58 */ void SetWall(f32, f32); -}; - -struct dBgS {}; - -struct dBgS_Acch { - /* 80075F94 */ ~dBgS_Acch(); - /* 800760A0 */ dBgS_Acch(); - /* 80076248 */ void Set(cXyz*, cXyz*, fopAc_ac_c*, int, dBgS_AcchCir*, cXyz*, csXyz*, csXyz*); - /* 80076AAC */ void CrrPos(dBgS&); -}; - -struct cM3dGSph { - /* 8026F648 */ void SetC(cXyz const&); - /* 8026F708 */ void SetR(f32); - /* 8066EC40 */ ~cM3dGSph(); -}; - -struct cM3dGAab { - /* 8066EC88 */ ~cM3dGAab(); -}; - -struct cCcD_Obj {}; - -struct cCcS { - /* 80264BA8 */ void Set(cCcD_Obj*); -}; - -struct cBgS_PolyInfo {}; - -struct cBgS_LinChk {}; - -struct cBgS_GndChk { - /* 80267D28 */ void SetPos(cXyz const*); - /* 80267D0C */ void SetPos(Vec const*); -}; - -struct cBgS { - /* 800743B4 */ void LineCross(cBgS_LinChk*); - /* 800744A0 */ void GroundCross(cBgS_GndChk*); -}; - -struct _GXTexObj {}; - -struct Z2SoundObjSimple { - /* 802BE844 */ Z2SoundObjSimple(); -}; - -struct Z2SoundObjBase { - /* 802BDFF8 */ void deleteObject(); -}; - -struct JMath { - static u8 sincosTable_[65536]; -}; - -struct JGeometry { - template - struct TVec3 {}; - /* TVec3 */ - struct TVec3__template0 {}; -}; - -struct J3DSys { - static u8 mCurrentMtx[48]; -}; - -struct J3DModel {}; - -struct J3DJoint {}; - -struct J3DFrameCtrl { - /* 803283FC */ void init(s16); - /* 8032842C */ void checkPass(f32); - /* 8066E7D4 */ ~J3DFrameCtrl(); -}; +#include "f_op/f_op_actor_mng.h" // // Forward References: @@ -336,7 +93,7 @@ extern "C" void fopAcM_searchActorAngleY__FPC10fopAc_ac_cPC10fopAc_ac_c(); extern "C" void fopAcM_searchActorDistance__FPC10fopAc_ac_cPC10fopAc_ac_c(); extern "C" void fopAcM_createItem__FPC4cXyziiiPC5csXyzPC4cXyzi(); extern "C" void fopAcM_effHamonSet__FPUlPC4cXyzff(); -extern "C" bool fopAcM_riverStream__FP4cXyzPsPff(); +// extern "C" bool fopAcM_riverStream__FP4cXyzPsPff(); extern "C" void fpcEx_Search__FPFPvPv_PvPv(); extern "C" void fpcSch_JudgeByID__FPvPv(); extern "C" void dComIfG_resLoad__FP30request_of_phase_process_classPCc(); @@ -401,10 +158,6 @@ extern "C" void* __nw__FUl(); extern "C" void __dl__FPv(); extern "C" void init__12J3DFrameCtrlFs(); extern "C" void checkPass__12J3DFrameCtrlFf(); -extern "C" void PSMTXCopy(); -extern "C" void PSMTXTrans(); -extern "C" void PSVECAdd(); -extern "C" void PSVECSquareMag(); extern "C" void _savegpr_22(); extern "C" void _savegpr_24(); extern "C" void _savegpr_26(); @@ -417,9 +170,7 @@ extern "C" void _restgpr_26(); extern "C" void _restgpr_27(); extern "C" void _restgpr_28(); extern "C" void _restgpr_29(); -extern "C" void strcmp(); 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]; @@ -429,12 +180,9 @@ extern "C" u8 m_cpadInfo__8mDoCPd_c[256]; extern "C" u8 now__14mDoMtx_stack_c[48]; extern "C" extern u8 g_dComIfG_gameInfo[122384]; extern "C" u8 mSimpleTexObj__21dDlst_shadowControl_c[32]; -extern "C" extern u8 g_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 u32 __float_nan; +// extern "C" extern void* calc_mtx[1 + 1 /* padding */]; extern "C" void __register_global_object(); // @@ -635,7 +383,25 @@ SECTION_DATA extern void* __vt__10daDo_HIO_c[3] = { (void*)__dt__10daDo_HIO_cFv, }; + /* 80667D4C-80667DA8 0000EC 005C+00 1/1 0/0 0/0 .text __ct__10daDo_HIO_cFv */ +#ifdef NONMATCHING +daDo_HIO_c::daDo_HIO_c() { + f32 value1 = FLOAT_LABEL(lit_3662); + f32 value2 = FLOAT_LABEL(lit_3663); + f32 value3 = FLOAT_LABEL(lit_3664); + f32 value4 = FLOAT_LABEL(lit_3664); + setAttribute(-1); + setEnd(0x3f800000); + setRate(value1); + setFrame(value2); + field_0x14 = value3; + field_0x18 = value4; + field_0x1c = 0; + field_0x1d = 0; + field_0x1e = 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -644,6 +410,7 @@ asm daDo_HIO_c::daDo_HIO_c() { #include "asm/rel/d/a/d_a_do/d_a_do/__ct__10daDo_HIO_cFv.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066EDFC-8066EE00 000014 0004+00 0/16 0/0 0/0 .rodata @3682 */ @@ -720,7 +487,8 @@ static asm void daDo_Draw(do_class* param_0) { #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/d_a_do/d_a_do/__dt__4cXyzFv.s" } @@ -894,23 +662,34 @@ static u8 target_bgc[20]; #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void search_food(do_class* param_0) { +static asm u32 search_food(do_class* param_0) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/search_food__FP8do_class.s" } #pragma pop /* 8066858C-806685EC 00092C 0060+00 1/1 0/0 0/0 .text food_check__FP8do_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void food_check(do_class* param_0) { - nofralloc -#include "asm/rel/d/a/d_a_do/d_a_do/food_check__FP8do_class.s" +static void food_check(do_class* i_dogP) { + i_dogP->isFood = search_food(i_dogP); + + if (fopAcM_SearchByID(i_dogP->isFood)) { + i_dogP->field_0x5f2 = 5; + i_dogP->field_0x5f6 = 0; + } } -#pragma pop /* 806685EC-80668624 00098C 0038+00 1/1 0/0 0/0 .text do_carry_check__FP8do_class */ +#ifndef NONMATCHING +static int do_carry_check(do_class* i_dogP) { + if (i_dogP->field_0x5f2 != 0x23 && fopAcM_checkCarryNow(i_dogP)) { + i_dogP->field_0x5f2 = 0x23; + i_dogP->field_0x5f6 = 0; + return 1; + } + + return 0; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -919,6 +698,7 @@ static asm void do_carry_check(do_class* param_0) { #include "asm/rel/d/a/d_a_do/d_a_do/do_carry_check__FP8do_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066EE1C-8066EE20 000034 0004+00 0/2 0/0 0/0 .rodata @3981 */ @@ -1889,7 +1669,8 @@ static asm void useHeapInit(fopAc_ac_c* param_0) { #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/d_a_do/d_a_do/__dt__12J3DFrameCtrlFv.s" } @@ -1948,7 +1729,8 @@ asm do_class::do_class() { #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/d_a_do/d_a_do/__dt__8cM3dGSphFv.s" } @@ -1958,7 +1740,8 @@ 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/d_a_do/d_a_do/__dt__8cM3dGAabFv.s" } From 63afb14d8b02758ea27b00f30069090a2501e329 Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Tue, 3 Jan 2023 00:18:06 -0700 Subject: [PATCH 02/34] do_carry_check --- rel/d/a/d_a_do/d_a_do.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 3d24df718ff..b67ee0f7987 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -679,7 +679,6 @@ static void food_check(do_class* i_dogP) { } /* 806685EC-80668624 00098C 0038+00 1/1 0/0 0/0 .text do_carry_check__FP8do_class */ -#ifndef NONMATCHING static int do_carry_check(do_class* i_dogP) { if (i_dogP->field_0x5f2 != 0x23 && fopAcM_checkCarryNow(i_dogP)) { i_dogP->field_0x5f2 = 0x23; @@ -689,16 +688,6 @@ static int do_carry_check(do_class* i_dogP) { return 0; } -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void do_carry_check(do_class* param_0) { - nofralloc -#include "asm/rel/d/a/d_a_do/d_a_do/do_carry_check__FP8do_class.s" -} -#pragma pop -#endif /* ############################################################################################## */ /* 8066EE1C-8066EE20 000034 0004+00 0/2 0/0 0/0 .rodata @3981 */ From 67fc1447da0bf025074e44e2a0a3a1c93009616e Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Wed, 4 Jan 2023 09:21:20 -0700 Subject: [PATCH 03/34] checkpoint --- include/d/bg/d_bg_s_acch.h | 6 +- include/rel/d/a/d_a_do/d_a_do.h | 188 ++++++++++-------- rel/d/a/d_a_do/d_a_do.cpp | 100 ++++++---- .../obj/d_a_obj_yobikusa/d_a_obj_yobikusa.cpp | 6 +- 4 files changed, 176 insertions(+), 124 deletions(-) diff --git a/include/d/bg/d_bg_s_acch.h b/include/d/bg/d_bg_s_acch.h index a00f1768aee..e73e3225b7e 100644 --- a/include/d/bg/d_bg_s_acch.h +++ b/include/d/bg/d_bg_s_acch.h @@ -38,7 +38,7 @@ public: /* 80075F58 */ void SetWall(f32, f32); /* 80075F80 */ void SetWallHDirect(f32); - /* 80077414 */ virtual ~dBgS_AcchCir(); + /* 80077414 */ virtual ~dBgS_AcchCir() {} f32 GetWallH() { return m_wall_h; } f32 GetWallR() { return m_wall_r; } @@ -108,7 +108,7 @@ public: /* 800D00DC */ void ClrGroundHit(); /* 80141404 */ bool ChkGroundHit() const; - /* 80075F94 */ virtual ~dBgS_Acch(); + /* 80075F94 */ virtual ~dBgS_Acch() {} cXyz* GetPos() { return pm_pos; } cXyz* GetOldPos() { return pm_old_pos; } @@ -205,7 +205,7 @@ public: SetObj(); } - /* 80BB336C */ virtual ~dBgS_ObjAcch(); + /* 80BB336C */ virtual ~dBgS_ObjAcch() {} }; class dBgS_StatueAcch : public dBgS_Acch { diff --git a/include/rel/d/a/d_a_do/d_a_do.h b/include/rel/d/a/d_a_do/d_a_do.h index cc8e969a555..da72620e7cf 100644 --- a/include/rel/d/a/d_a_do/d_a_do.h +++ b/include/rel/d/a/d_a_do/d_a_do.h @@ -4,6 +4,8 @@ #include "dolphin/types.h" #include "d/a/d_a_player.h" // #include "d/a/d_a_item_static.h" +#include "d/bg/d_bg_s_acch.h" +#include "d/cc/d_cc_d.h" #include "d/msg/d_msg_flow.h" #include "d/particle/d_particle.h" #include "f_op/f_op_actor.h" @@ -12,32 +14,82 @@ #include "m_Do/m_Do_controller_pad.h" #include "JSystem/J3DGraphAnimator/J3DAnimation.h" #include "SSystem/SComponent/c_phase.h" +#include "Z2AudioLib/Z2SoundObject.h" -struct do_class : public fopAc_ac_c { + +// this might actually inherit from npc_tr_class? +class do_class : public fopAc_ac_c { public: - /* 0x56C */ u8 field_0x56c[138]; + /* 0x56C */ u8 field_0x56c[68]; + /* 0x5AC */ request_of_phase_process_class mPhase; + /* 0x5B4 */ u8 field_0x5b4[20]; + /* 0x5C8 */ float field_0x5c8; + /* 0x5CC */ u8 field_0x5cc[4]; + /* 0x5D0 */ int field_0x5d0; + /* 0x5D4 */ u8 field_0x5d4[4]; + /* 0x5D8 */ mDoExt_McaMorf* mpMorf; + /* 0x5DC */ u8 field_0x5dc[8]; + /* 0x5E4 */ u8 field_0x5e4; + /* 0x5E5 */ u8 field_0x5e5[3]; + /* 0x5E8 */ float field_0x5e8; + /* 0x5EC */ float field_0x5ec; + /* 0x5F0 */ u8 field_0x5f0[2]; /* 0x5F2 */ s16 field_0x5f2; /* 0x5F4 */ u8 field_0x5f4[2]; /* 0x5F6 */ u16 field_0x5f6; - /* 0x5F8 */ u8 field_0x5f8[140]; - /* 0x684 */ u32 isFood; + /* 0x5F8 */ u8 field_0x5f8[4]; + /* 0x5FC */ u16 field_0x5fc; + /* 0x5FE */ u8 field_0x5fe[6]; + /* 0x604 */ u16 field_0x604; + /* 0x606 */ u8 field_0x606[10]; + /* 0x610 */ float field_0x610; + /* 0x614 */ u16 field_0x614; + /* 0x616 */ u8 field_0x616[30]; + /* 0x634 */ u32 field_0x634; + /* 0x638 */ u8 field_0x638[16]; + /* 0x648 */ u32 field_0x648; + /* 0x64c */ u8 field_0x64c[12]; + /* 0x658 */ float field_0x658; + /* 0x65C */ u8 field_0x65c[32]; + /* 0x67C */ float field_0x67c; + /* 0x680 */ u8 field_0x680[4]; + /* 0x684 */ u32 isFood; // maybe can pick a better name here + /* 0x688 */ u8 field_0x688[4]; + /* 0x68C */ float field_0x68c; + /* 0x690 */ float field_0x690; + /* 0x694 */ float field_0x694; + /* 0x698 */ u8 field_0x698[36]; + /* 0x6BC */ dBgS_AcchCir mBgS_AcchCir; + /* 0x6FC */ dBgS_Acch mBgS_Acch; + /* 0x8D4 */ u8 field_0x8d4[24]; + /* 0x8EC */ dCcD_GStts mCcD_GStts; + /* 0x90C */ u8 field_0x90c[4]; + /* 0x910 */ dCcD_GObjInf mCcD_GObjInf1; + /* 0xA14 */ u8 field_0xa14[52]; + /* 0xA48 */ dCcD_GObjInf mCcD_GObjInf2; + /* 0xB4C */ u8 field_0xb4c[152]; + /* 0xBE4 */ Z2SoundObjSimple mSound; + /* 0xC04 */ u8 field_0xc04[8]; + /* 0xC0C */ dMsgFlow_c mMsg; + /* 0xC58 */ u8 field_0xc58[104]; + /* 0xCC0 */ u8 field_0xcc0; public: /* 8066EAE4 */ do_class(); }; -class daDo_HIO_c : public J3DFrameCtrl { +class daDo_HIO_c : public do_class { private: - /* 0x14 */ u32 field_0x14; - /* 0x18 */ u32 field_0x18; - /* 0x1C */ u8 field_0x1c; - /* 0x1D */ u8 field_0x1d; - /* 0x1E */ u16 field_0x1e; +/* 0x14 */ u32 field_0x14; +/* 0x18 */ u32 field_0x18; +/* 0x1C */ u8 field_0x1c; +/* 0x1D */ u8 field_0x1d; +/* 0x1E */ u16 field_0x1e; public: /* 80667D4C */ daDo_HIO_c(); - /* 8066ED40 */ virtual ~daDo_HIO_c(); + /* 8066ED40 */ virtual ~daDo_HIO_c() {}; }; struct daItem_c { @@ -49,88 +101,58 @@ struct dEvt_control_c { /* 80042468 */ void reset(); }; -struct dCcD_Stts { - /* 80083860 */ void Init(int, int, fopAc_ac_c*); -}; +// struct dBgS_PolyPassChk { +// /* 80078E68 */ void SetObj(); +// }; -struct dCcD_SrcSph {}; +// struct dBgS_ObjGndChk_Spl { +// /* 800777B0 */ dBgS_ObjGndChk_Spl(); +// /* 80077848 */ ~dBgS_ObjGndChk_Spl(); +// }; -struct dCcD_Sph { - /* 80084A34 */ void Set(dCcD_SrcSph const&); -}; +// struct dBgS_ObjAcch { +// /* 8066ECD0 */ ~dBgS_ObjAcch(); +// }; -struct dCcD_GStts { - /* 80083760 */ dCcD_GStts(); -}; +// struct dBgS_LinChk { +// /* 80077C68 */ dBgS_LinChk(); +// /* 80077CDC */ ~dBgS_LinChk(); +// /* 80077D64 */ void Set(cXyz const*, cXyz const*, fopAc_ac_c const*); +// }; -struct dCcD_GObjInf { - /* 80083A28 */ dCcD_GObjInf(); -}; +// struct dBgS_GndChk { +// /* 8007757C */ dBgS_GndChk(); +// /* 800775F0 */ ~dBgS_GndChk(); +// }; -struct dBgS_PolyPassChk { - /* 80078E68 */ void SetObj(); -}; +// struct dBgS_AcchCir { +// /* 80075EAC */ dBgS_AcchCir(); +// /* 80075F58 */ void SetWall(f32, f32); +// }; -struct dBgS_ObjGndChk_Spl { - /* 800777B0 */ dBgS_ObjGndChk_Spl(); - /* 80077848 */ ~dBgS_ObjGndChk_Spl(); -}; +// struct dBgS {}; -struct dBgS_ObjAcch { - /* 8066ECD0 */ ~dBgS_ObjAcch(); -}; +// struct dBgS_Acch { +// /* 80075F94 */ ~dBgS_Acch(); +// /* 800760A0 */ dBgS_Acch(); +// /* 80076248 */ void Set(cXyz*, cXyz*, fopAc_ac_c*, int, dBgS_AcchCir*, cXyz*, csXyz*, csXyz*); +// /* 80076AAC */ void CrrPos(dBgS&); +// }; -struct dBgS_LinChk { - /* 80077C68 */ dBgS_LinChk(); - /* 80077CDC */ ~dBgS_LinChk(); - /* 80077D64 */ void Set(cXyz const*, cXyz const*, fopAc_ac_c const*); -}; +// struct cCcS { +// /* 80264BA8 */ void Set(cCcD_Obj*); +// }; -struct dBgS_GndChk { - /* 8007757C */ dBgS_GndChk(); - /* 800775F0 */ ~dBgS_GndChk(); -}; +// struct cBgS_LinChk {}; -struct dBgS_AcchCir { - /* 80075EAC */ dBgS_AcchCir(); - /* 80075F58 */ void SetWall(f32, f32); -}; +// struct cBgS_GndChk { +// /* 80267D28 */ void SetPos(cXyz const*); +// /* 80267D0C */ void SetPos(Vec const*); +// }; -struct dBgS {}; - -struct dBgS_Acch { - /* 80075F94 */ ~dBgS_Acch(); - /* 800760A0 */ dBgS_Acch(); - /* 80076248 */ void Set(cXyz*, cXyz*, fopAc_ac_c*, int, dBgS_AcchCir*, cXyz*, csXyz*, csXyz*); - /* 80076AAC */ void CrrPos(dBgS&); -}; - -struct cM3dGSph { - /* 8026F648 */ void SetC(cXyz const&); - /* 8026F708 */ void SetR(f32); - /* 8066EC40 */ ~cM3dGSph(); -}; - -struct cM3dGAab { - /* 8066EC88 */ ~cM3dGAab(); -}; - -struct cCcD_Obj {}; - -struct cCcS { - /* 80264BA8 */ void Set(cCcD_Obj*); -}; - -struct cBgS_LinChk {}; - -struct cBgS_GndChk { - /* 80267D28 */ void SetPos(cXyz const*); - /* 80267D0C */ void SetPos(Vec const*); -}; - -struct cBgS { - /* 800743B4 */ void LineCross(cBgS_LinChk*); - /* 800744A0 */ void GroundCross(cBgS_GndChk*); -}; +// struct cBgS { +// /* 800743B4 */ void LineCross(cBgS_LinChk*); +// /* 800744A0 */ void GroundCross(cBgS_GndChk*); +// }; #endif /* D_A_DO_H */ diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index b67ee0f7987..b85e2025814 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -6,6 +6,7 @@ #include "rel/d/a/d_a_do/d_a_do.h" #include "dol2asm.h" #include "dolphin/types.h" +// #include "d/com/d_com_inf_game.h" #include "f_op/f_op_actor_mng.h" // @@ -93,7 +94,6 @@ extern "C" void fopAcM_searchActorAngleY__FPC10fopAc_ac_cPC10fopAc_ac_c(); extern "C" void fopAcM_searchActorDistance__FPC10fopAc_ac_cPC10fopAc_ac_c(); extern "C" void fopAcM_createItem__FPC4cXyziiiPC5csXyzPC4cXyzi(); extern "C" void fopAcM_effHamonSet__FPUlPC4cXyzff(); -// extern "C" bool fopAcM_riverStream__FP4cXyzPsPff(); extern "C" void fpcEx_Search__FPFPvPv_PvPv(); extern "C" void fpcSch_JudgeByID__FPvPv(); extern "C" void dComIfG_resLoad__FP30request_of_phase_process_classPCc(); @@ -182,7 +182,6 @@ extern "C" extern u8 g_dComIfG_gameInfo[122384]; extern "C" u8 mSimpleTexObj__21dDlst_shadowControl_c[32]; extern "C" u8 mCurrentMtx__6J3DSys[48]; extern "C" u8 sincosTable___5JMath[65536]; -// extern "C" extern void* calc_mtx[1 + 1 /* padding */]; extern "C" void __register_global_object(); // @@ -369,6 +368,7 @@ SECTION_DATA extern void* __vt__12dBgS_ObjAcch[9] = { (void*)func_8066EDC4, }; + /* 8066F258-8066F264 00029C 000C+00 2/2 0/0 0/0 .data __vt__12J3DFrameCtrl */ SECTION_DATA extern void* __vt__12J3DFrameCtrl[3] = { (void*)NULL /* RTTI */, @@ -439,14 +439,23 @@ SECTION_DEAD static char const* const stringBase_8066EFB0 = "Do"; #pragma pop /* 80667DA8-80667E68 000148 00C0+00 16/16 0/0 0/0 .text anm_init__FP8do_classifUcf */ +#ifdef NONMATCHING +static void anm_init(do_class* i_dogP, int param_1, f32 param_2, u8 param_3, f32 param_4) { + if (i_dogP->field_0x610 < 1.0f) { + i_dogP->mpMorf->setAnm(dComIfG_getObjectRes("Do",param_1),param_4,param_2,0.0f,0.0f,-1.0f,0); + i_dogP->field_0x5e4 = param_3; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void anm_init(do_class* param_0, int param_1, f32 param_2, u8 param_3, f32 param_4) { +static asm void anm_init(do_class* i_dogP, int param_1, f32 param_2, u8 param_3, f32 param_4) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/anm_init__FP8do_classifUcf.s" } #pragma pop +#endif /* 80667E68-80667FE4 000208 017C+00 1/1 0/0 0/0 .text nodeCallBack__FP8J3DJointi */ #pragma push @@ -477,7 +486,7 @@ COMPILER_STRIP_GATE(0x8066EE08, &lit_3773); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void daDo_Draw(do_class* param_0) { +static asm void daDo_Draw(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/daDo_Draw__FP8do_class.s" } @@ -504,7 +513,7 @@ COMPILER_STRIP_GATE(0x8066EE0C, &lit_3816); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void daDo_other_bg_check(do_class* param_0, fopAc_ac_c* param_1) { +static asm void daDo_other_bg_check(do_class* i_dogP, fopAc_ac_c* i_actorP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/daDo_other_bg_check__FP8do_classP10fopAc_ac_c.s" } @@ -519,7 +528,7 @@ COMPILER_STRIP_GATE(0x8066EE10, &lit_3846); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void daDo_other_bg_check2(do_class* param_0, cXyz* param_1) { +static asm void daDo_other_bg_check2(do_class* i_dogP, cXyz* i_posP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/daDo_other_bg_check2__FP8do_classP4cXyz.s" } @@ -662,7 +671,7 @@ static u8 target_bgc[20]; #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm u32 search_food(do_class* param_0) { +static asm u32 search_food(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/search_food__FP8do_class.s" } @@ -701,7 +710,7 @@ COMPILER_STRIP_GATE(0x8066EE1C, &lit_3981); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void depth_check(do_class* param_0, cXyz param_1, f32 param_2) { +static asm void depth_check(do_class* i_dogP, cXyz i_pos, f32 param_2) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/depth_check__FP8do_class4cXyzf.s" } @@ -716,7 +725,7 @@ COMPILER_STRIP_GATE(0x8066EE20, &lit_3994); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void water_check(do_class* param_0) { +static asm void water_check(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/water_check__FP8do_class.s" } @@ -748,7 +757,7 @@ COMPILER_STRIP_GATE(0x8066EE2C, &lit_4027); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void dansa_check(do_class* param_0, cXyz param_1, f32 param_2) { +static asm void dansa_check(do_class* i_dogP, cXyz param_1, f32 param_2) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/dansa_check__FP8do_class4cXyzf.s" } @@ -773,7 +782,7 @@ COMPILER_STRIP_GATE(0x8066EE34, &lit_4058); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void dansa_check2(do_class* param_0, f32 param_1) { +static asm void dansa_check2(do_class* i_dogP, f32 param_1) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/dansa_check2__FP8do_classf.s" } @@ -792,7 +801,7 @@ COMPILER_STRIP_GATE(0x8066EE3C, &lit_4069); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void move_dansa_check(do_class* param_0, f32 param_1) { +static asm void move_dansa_check(do_class* i_dogP, f32 param_1) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/move_dansa_check__FP8do_classf.s" } @@ -839,7 +848,7 @@ COMPILER_STRIP_GATE(0x8066EE58, &lit_4138); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void area_check(do_class* param_0) { +static asm void area_check(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/area_check__FP8do_class.s" } @@ -857,7 +866,7 @@ COMPILER_STRIP_GATE(0x8066EE60, &lit_4189); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_stay(do_class* param_0) { +static asm void do_stay(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_stay__FP8do_class.s" } @@ -973,7 +982,7 @@ COMPILER_STRIP_GATE(0x8066EE9C, &lit_4345); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_walk(do_class* param_0) { +static asm void do_walk(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_walk__FP8do_class.s" } @@ -998,7 +1007,7 @@ COMPILER_STRIP_GATE(0x8066EEA4, &lit_4378); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_walk_run(do_class* param_0) { +static asm void do_walk_run(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_walk_run__FP8do_class.s" } @@ -1058,7 +1067,7 @@ COMPILER_STRIP_GATE(0x8066EEC0, &lit_4406); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_run(do_class* param_0) { +static asm void do_run(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_run__FP8do_class.s" } @@ -1076,7 +1085,7 @@ COMPILER_STRIP_GATE(0x8066EEC4, &lit_4435); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_run_walk(do_class* param_0) { +static asm void do_run_walk(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_run_walk__FP8do_class.s" } @@ -1086,7 +1095,7 @@ static asm void do_run_walk(do_class* param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_wait_1(do_class* param_0) { +static asm void do_wait_1(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_wait_1__FP8do_class.s" } @@ -1195,7 +1204,7 @@ COMPILER_STRIP_GATE(0x8066EEFC, &lit_4588); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_wait_2(do_class* param_0) { +static asm void do_wait_2(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_wait_2__FP8do_class.s" } @@ -1205,7 +1214,7 @@ static asm void do_wait_2(do_class* param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_sit(do_class* param_0) { +static asm void do_sit(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_sit__FP8do_class.s" } @@ -1230,7 +1239,7 @@ COMPILER_STRIP_GATE(0x8066EF04, &lit_4710); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void hang_set(do_class* param_0) { +static asm void hang_set(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/hang_set__FP8do_class.s" } @@ -1255,7 +1264,7 @@ COMPILER_STRIP_GATE(0x8066EF0C, &lit_4764); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_hang(do_class* param_0) { +static asm void do_hang(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_hang__FP8do_class.s" } @@ -1272,7 +1281,7 @@ SECTION_DEAD static char const* const stringBase_8066EFB3 = "F_SP116"; #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_food(do_class* param_0) { +static asm void do_food(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_food__FP8do_class.s" } @@ -1353,7 +1362,7 @@ COMPILER_STRIP_GATE(0x8066EF34, &lit_4993); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_swim(do_class* param_0) { +static asm void do_swim(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_swim__FP8do_class.s" } @@ -1409,7 +1418,7 @@ COMPILER_STRIP_GATE(0x8066EF48, &lit_5114); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_help(do_class* param_0) { +static asm void do_help(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_help__FP8do_class.s" } @@ -1434,7 +1443,7 @@ COMPILER_STRIP_GATE(0x8066EF50, &lit_5345); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_boat(do_class* param_0) { +static asm void do_boat(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_boat__FP8do_class.s" } @@ -1466,7 +1475,7 @@ COMPILER_STRIP_GATE(0x8066EF5C, &lit_5407); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_a_swim(do_class* param_0) { +static asm void do_a_swim(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_a_swim__FP8do_class.s" } @@ -1497,7 +1506,7 @@ COMPILER_STRIP_GATE(0x8066EF68, &lit_5480); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_carry(do_class* param_0) { +static asm void do_carry(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_carry__FP8do_class.s" } @@ -1507,7 +1516,7 @@ static asm void do_carry(do_class* param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_message(do_class* param_0) { +static asm void do_message(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_message__FP8do_class.s" } @@ -1525,7 +1534,7 @@ COMPILER_STRIP_GATE(0x8066EF70, &lit_5948); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void action(do_class* param_0) { +static asm void action(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/action__FP8do_class.s" } @@ -1535,7 +1544,7 @@ static asm void action(do_class* param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void message(do_class* param_0) { +static asm void message(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/message__FP8do_class.s" } @@ -1623,18 +1632,34 @@ COMPILER_STRIP_GATE(0x8066EF9C, &lit_6214); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void daDo_Execute(do_class* param_0) { +static asm void daDo_Execute(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/daDo_Execute__FP8do_class.s" } #pragma pop /* 8066E494-8066E49C 006834 0008+00 1/0 0/0 0/0 .text daDo_IsDelete__FP8do_class */ -static bool daDo_IsDelete(do_class* param_0) { +static bool daDo_IsDelete(do_class* i_dogP) { return true; } /* 8066E49C-8066E504 00683C 0068+00 1/0 0/0 0/0 .text daDo_Delete__FP8do_class */ +#ifdef NONMATCHING +no clue how to generate the struct assignment... +int dComIfG_resDelete(request_of_phase_process_class* i_phase, char const* resName); +static int daDo_Delete(do_class* i_dogP) { + u32 actor_id = fopAcM_GetID(i_dogP); + dComIfG_resDelete(&i_dogP->mPhase,"Do"); + if (i_dogP->field_0xcc0 != 0) { + u8* tmp = (u8*)struct_8066F2B4+2; + *tmp = 0; + } + if (i_dogP->mHeap) { + i_dogP->mSound.deleteObject(); + } + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1643,6 +1668,7 @@ static asm void daDo_Delete(do_class* param_0) { #include "asm/rel/d/a/d_a_do/d_a_do/daDo_Delete__FP8do_class.s" } #pragma pop +#endif /* 8066E504-8066E7D4 0068A4 02D0+00 1/1 0/0 0/0 .text useHeapInit__FP10fopAc_ac_c */ #pragma push @@ -1740,7 +1766,8 @@ extern "C" asm void __dt__8cM3dGAabFv() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm dBgS_ObjAcch::~dBgS_ObjAcch() { +// asm dBgS_ObjAcch::~dBgS_ObjAcch() { +extern "C" asm void __dt__12dBgS_ObjAcchFv() { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/__dt__12dBgS_ObjAcchFv.s" } @@ -1750,7 +1777,8 @@ asm dBgS_ObjAcch::~dBgS_ObjAcch() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm daDo_HIO_c::~daDo_HIO_c() { +// asm daDo_HIO_c::~daDo_HIO_c() { +extern "C" asm void __dt__10daDo_HIO_cFv() { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/__dt__10daDo_HIO_cFv.s" } diff --git a/rel/d/a/obj/d_a_obj_yobikusa/d_a_obj_yobikusa.cpp b/rel/d/a/obj/d_a_obj_yobikusa/d_a_obj_yobikusa.cpp index ceaf5ab32a0..c72e23f43e9 100644 --- a/rel/d/a/obj/d_a_obj_yobikusa/d_a_obj_yobikusa.cpp +++ b/rel/d/a/obj/d_a_obj_yobikusa/d_a_obj_yobikusa.cpp @@ -474,7 +474,8 @@ asm void daObjYobikusa_c::create_init() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm dBgS_ObjAcch::~dBgS_ObjAcch() { +// asm dBgS_ObjAcch::~dBgS_ObjAcch() { +extern "C" asm void __dt__12dBgS_ObjAcchFv() { nofralloc #include "asm/rel/d/a/obj/d_a_obj_yobikusa/d_a_obj_yobikusa/__dt__12dBgS_ObjAcchFv.s" } @@ -484,7 +485,8 @@ asm dBgS_ObjAcch::~dBgS_ObjAcch() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm dBgS_AcchCir::~dBgS_AcchCir() { +// asm dBgS_AcchCir::~dBgS_AcchCir() { +extern "C" asm void __dt__12dBgS_AcchCirFv() { nofralloc #include "asm/rel/d/a/obj/d_a_obj_yobikusa/d_a_obj_yobikusa/__dt__12dBgS_AcchCirFv.s" } From 11ad89ee81886b87486b2c61d11af851eee056a1 Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Thu, 5 Jan 2023 18:31:58 -0700 Subject: [PATCH 04/34] inlined virtual func problem solution (thanks Julgodis) --- include/d/bg/d_bg_s_acch.h | 4 ++++ src/d/bg/d_bg_s_acch.cpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/include/d/bg/d_bg_s_acch.h b/include/d/bg/d_bg_s_acch.h index e73e3225b7e..5b7f6378666 100644 --- a/include/d/bg/d_bg_s_acch.h +++ b/include/d/bg/d_bg_s_acch.h @@ -38,7 +38,11 @@ public: /* 80075F58 */ void SetWall(f32, f32); /* 80075F80 */ void SetWallHDirect(f32); + #ifdef __dt__12dBgS_AcchCirFv_DEFINED + /* 80077414 */ virtual ~dBgS_AcchCir(); + #else /* 80077414 */ virtual ~dBgS_AcchCir() {} + #endif f32 GetWallH() { return m_wall_h; } f32 GetWallR() { return m_wall_r; } diff --git a/src/d/bg/d_bg_s_acch.cpp b/src/d/bg/d_bg_s_acch.cpp index 25a23d5b76d..8836b0eff68 100644 --- a/src/d/bg/d_bg_s_acch.cpp +++ b/src/d/bg/d_bg_s_acch.cpp @@ -3,6 +3,8 @@ // Translation Unit: d/bg/d_bg_s_acch // +#define __dt__12dBgS_AcchCirFv_DEFINED + #include "d/bg/d_bg_s_acch.h" #include "d/bg/d_bg_s.h" #include "dol2asm.h" From f367d21472ab76c3ebc6b8ce59f8f588e703afa6 Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Thu, 5 Jan 2023 20:50:31 -0700 Subject: [PATCH 05/34] anm_init --- include/rel/d/a/d_a_do/d_a_do.h | 76 +++------------------------------ rel/d/a/d_a_do/d_a_do.cpp | 11 +++-- src/d/bg/d_bg_s_acch.cpp | 1 + 3 files changed, 12 insertions(+), 76 deletions(-) diff --git a/include/rel/d/a/d_a_do/d_a_do.h b/include/rel/d/a/d_a_do/d_a_do.h index da72620e7cf..680b1526d38 100644 --- a/include/rel/d/a/d_a_do/d_a_do.h +++ b/include/rel/d/a/d_a_do/d_a_do.h @@ -3,7 +3,7 @@ #include "dolphin/types.h" #include "d/a/d_a_player.h" -// #include "d/a/d_a_item_static.h" +#include "d/a/d_a_item_static.h" #include "d/bg/d_bg_s_acch.h" #include "d/cc/d_cc_d.h" #include "d/msg/d_msg_flow.h" @@ -26,12 +26,10 @@ public: /* 0x5B4 */ u8 field_0x5b4[20]; /* 0x5C8 */ float field_0x5c8; /* 0x5CC */ u8 field_0x5cc[4]; - /* 0x5D0 */ int field_0x5d0; - /* 0x5D4 */ u8 field_0x5d4[4]; /* 0x5D8 */ mDoExt_McaMorf* mpMorf; + /* 0x5D4 */ u8 field_0x5d4[8]; /* 0x5DC */ u8 field_0x5dc[8]; - /* 0x5E4 */ u8 field_0x5e4; - /* 0x5E5 */ u8 field_0x5e5[3]; + /* 0x5E4 */ s32 field_0x5e4; /* 0x5E8 */ float field_0x5e8; /* 0x5EC */ float field_0x5ec; /* 0x5F0 */ u8 field_0x5f0[2]; @@ -42,8 +40,9 @@ public: /* 0x5FC */ u16 field_0x5fc; /* 0x5FE */ u8 field_0x5fe[6]; /* 0x604 */ u16 field_0x604; - /* 0x606 */ u8 field_0x606[10]; - /* 0x610 */ float field_0x610; + /* 0x606 */ u8 field_0x606[2]; + /* 0x608 */ float field_0x608; + /* 0x60C */ u8 field_0x60c[8]; /* 0x614 */ u16 field_0x614; /* 0x616 */ u8 field_0x616[30]; /* 0x634 */ u32 field_0x634; @@ -92,67 +91,4 @@ public: /* 8066ED40 */ virtual ~daDo_HIO_c() {}; }; -struct daItem_c { - /* 80037BF4 */ void startControl(); - /* 80037C04 */ void endControl(); -}; - -struct dEvt_control_c { - /* 80042468 */ void reset(); -}; - -// struct dBgS_PolyPassChk { -// /* 80078E68 */ void SetObj(); -// }; - -// struct dBgS_ObjGndChk_Spl { -// /* 800777B0 */ dBgS_ObjGndChk_Spl(); -// /* 80077848 */ ~dBgS_ObjGndChk_Spl(); -// }; - -// struct dBgS_ObjAcch { -// /* 8066ECD0 */ ~dBgS_ObjAcch(); -// }; - -// 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 dBgS_AcchCir { -// /* 80075EAC */ dBgS_AcchCir(); -// /* 80075F58 */ void SetWall(f32, f32); -// }; - -// struct dBgS {}; - -// struct dBgS_Acch { -// /* 80075F94 */ ~dBgS_Acch(); -// /* 800760A0 */ dBgS_Acch(); -// /* 80076248 */ void Set(cXyz*, cXyz*, fopAc_ac_c*, int, dBgS_AcchCir*, cXyz*, csXyz*, csXyz*); -// /* 80076AAC */ void CrrPos(dBgS&); -// }; - -// struct cCcS { -// /* 80264BA8 */ void Set(cCcD_Obj*); -// }; - -// struct cBgS_LinChk {}; - -// struct cBgS_GndChk { -// /* 80267D28 */ void SetPos(cXyz const*); -// /* 80267D0C */ void SetPos(Vec const*); -// }; - -// struct cBgS { -// /* 800743B4 */ void LineCross(cBgS_LinChk*); -// /* 800744A0 */ void GroundCross(cBgS_GndChk*); -// }; - #endif /* D_A_DO_H */ diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index b85e2025814..d89b62d7a75 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -6,7 +6,7 @@ #include "rel/d/a/d_a_do/d_a_do.h" #include "dol2asm.h" #include "dolphin/types.h" -// #include "d/com/d_com_inf_game.h" +#include "d/com/d_com_inf_game.h" #include "f_op/f_op_actor_mng.h" // @@ -178,7 +178,6 @@ extern "C" extern void* __vt__14cCcD_ShapeAttr[22]; extern "C" extern void* __vt__9cCcD_Stts[8]; extern "C" u8 m_cpadInfo__8mDoCPd_c[256]; extern "C" u8 now__14mDoMtx_stack_c[48]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; extern "C" u8 mSimpleTexObj__21dDlst_shadowControl_c[32]; extern "C" u8 mCurrentMtx__6J3DSys[48]; extern "C" u8 sincosTable___5JMath[65536]; @@ -439,11 +438,11 @@ SECTION_DEAD static char const* const stringBase_8066EFB0 = "Do"; #pragma pop /* 80667DA8-80667E68 000148 00C0+00 16/16 0/0 0/0 .text anm_init__FP8do_classifUcf */ -#ifdef NONMATCHING +#ifndef NONMATCHING static void anm_init(do_class* i_dogP, int param_1, f32 param_2, u8 param_3, f32 param_4) { - if (i_dogP->field_0x610 < 1.0f) { - i_dogP->mpMorf->setAnm(dComIfG_getObjectRes("Do",param_1),param_4,param_2,0.0f,0.0f,-1.0f,0); - i_dogP->field_0x5e4 = param_3; + if (!(i_dogP->field_0x608 > FLOAT_LABEL(lit_3662))) { + i_dogP->mpMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Do",param_1),param_3,param_2,param_4,FLOAT_LABEL(lit_3682),FLOAT_LABEL(lit_3683),0); + i_dogP->field_0x5e4 = param_1; } } #else diff --git a/src/d/bg/d_bg_s_acch.cpp b/src/d/bg/d_bg_s_acch.cpp index 8836b0eff68..83596cc9422 100644 --- a/src/d/bg/d_bg_s_acch.cpp +++ b/src/d/bg/d_bg_s_acch.cpp @@ -3,6 +3,7 @@ // Translation Unit: d/bg/d_bg_s_acch // +// Temporary fix until the TU matches #define __dt__12dBgS_AcchCirFv_DEFINED #include "d/bg/d_bg_s_acch.h" From 42a6a6ebca5fe6a98546cb85b11478077467119a Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Fri, 6 Jan 2023 08:44:50 -0700 Subject: [PATCH 06/34] nodeCallBack attempt --- include/JSystem/J3DGraphAnimator/J3DModel.h | 20 +++++++-- .../JSystem/J3DGraphAnimator/J3DMtxBuffer.h | 1 + include/m_Do/m_Do_mtx.h | 16 ++++++- rel/d/a/d_a_do/d_a_do.cpp | 45 ++++++++++++++----- rel/d/a/e/d_a_e_wb/d_a_e_wb.cpp | 3 +- rel/d/a/npc/d_a_npc_tr/d_a_npc_tr.cpp | 2 +- src/d/a/d_a_npc.cpp | 4 +- 7 files changed, 72 insertions(+), 19 deletions(-) diff --git a/include/JSystem/J3DGraphAnimator/J3DModel.h b/include/JSystem/J3DGraphAnimator/J3DModel.h index a6537a1bf2b..99c75eec7df 100644 --- a/include/JSystem/J3DGraphAnimator/J3DModel.h +++ b/include/JSystem/J3DGraphAnimator/J3DModel.h @@ -24,6 +24,19 @@ struct J3DUnkCalc2 { virtual void calc(J3DModelData* mpModelData); }; +struct UserArea { + u8 field_0x00[0x60e]; + s16 field_0x60e; + s16 field_0x610; + s16 field_0x612; + u8 field_0x614[0x14]; + s16 field_0x628; + s16 field_0x62a; + u8 field_0x62c[0x12]; + s16 field_0x63e; + s16 field_0x640; +}; + typedef void (*J3DCalcCallBack)(J3DModel*, u32 timing); class J3DModel { @@ -77,18 +90,19 @@ public: Mtx33* getNrmMtxPtr() const { return mMtxBuffer->getNrmMtxPtr(); } Mtx* getDrawMtxPtr() const { return mMtxBuffer->getDrawMtxPtr(); } void setBaseScale(const Vec& scale) { mBaseScale = scale; } - void setUserArea(u32 area) { mUserArea = area; } - u32 getUserArea() const { return mUserArea; } + void setUserArea(UserArea* area) { mUserArea = area; } + UserArea* getUserArea() const { return mUserArea; } Vec* getBaseScale() { return &mBaseScale; } // is there a better way to handle inlines with same name as non-inlines? MtxP i_getAnmMtx(int p1) { return mMtxBuffer->getAnmMtx(p1); } + void setAnmMtx(int p1, Mtx mtx) { return mMtxBuffer->setAnmMtx(p1, mtx); } /* 0x04 */ J3DModelData* mModelData; /* 0x08 */ u32 mFlags; /* 0x0C */ u32 mDiffFlag; /* 0x10 */ J3DCalcCallBack mCalcCallBack; - /* 0x14 */ u32 mUserArea; + /* 0x14 */ UserArea* mUserArea; /* 0x18 */ Vec mBaseScale; /* 0x24 */ Mtx mBaseTransformMtx; /* 0x54 */ Mtx mInternalView; diff --git a/include/JSystem/J3DGraphAnimator/J3DMtxBuffer.h b/include/JSystem/J3DGraphAnimator/J3DMtxBuffer.h index ee497312894..0af381eaec8 100644 --- a/include/JSystem/J3DGraphAnimator/J3DMtxBuffer.h +++ b/include/JSystem/J3DGraphAnimator/J3DMtxBuffer.h @@ -25,6 +25,7 @@ public: /* 80326EF0 */ void calcBBoardMtx(); MtxP getAnmMtx(int idx) const { return mpAnmMtx[idx]; } + void setAnmMtx(int idx, Mtx mtx) { PSMTXCopy(mtx,mpAnmMtx[idx]); } void setScaleFlag(int idx, u8 flag) { mpScaleFlagArr[idx] = flag; } u32* getCurrentViewNoPtr() { return &mCurrentViewNo; } diff --git a/include/m_Do/m_Do_mtx.h b/include/m_Do/m_Do_mtx.h index 9d344948f80..0fef06569cb 100644 --- a/include/m_Do/m_Do_mtx.h +++ b/include/m_Do/m_Do_mtx.h @@ -15,8 +15,9 @@ void mDoMtx_ZXYrotM(Mtx, s16, s16, s16); void mDoMtx_ZrotS(Mtx, s16); void mDoMtx_YrotS(Mtx, s16); void mDoMtx_XrotS(Mtx, s16); -void mDoMtx_XrotM(Mtx mtx, s16 x); +void mDoMtx_XrotM(Mtx, s16); void mDoMtx_YrotM(Mtx, s16); +void mDoMtx_ZrotM(Mtx, s16); void mDoMtx_MtxToRot(CMtxP, csXyz*); void mDoMtx_lookAt(f32 (*param_0)[4], Vec const* param_1, Vec const* param_2, s16 param_3); void mDoMtx_concatProjView(f32 const (*param_0)[4], f32 const (*param_1)[4], f32 (*param_2)[4]); @@ -37,6 +38,19 @@ inline void mDoMtx_trans(Mtx m, f32 x, f32 y, f32 z) { PSMTXTrans(m,x,y,z); } +inline void cMtx_XrotM(Mtx mtx, s16 x) { + mDoMtx_XrotM(mtx, x); +} + +inline void cMtx_YrotM(Mtx mtx, s16 y) { + mDoMtx_YrotM(mtx, y); +} + +inline void cMtx_ZrotM(Mtx mtx, s16 z) { + mDoMtx_ZrotM(mtx, z); +} + + class mDoMtx_stack_c { public: /* 8000CCC8 */ static bool push(); diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index d89b62d7a75..efc3bf7725d 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -438,25 +438,47 @@ SECTION_DEAD static char const* const stringBase_8066EFB0 = "Do"; #pragma pop /* 80667DA8-80667E68 000148 00C0+00 16/16 0/0 0/0 .text anm_init__FP8do_classifUcf */ -#ifndef NONMATCHING static void anm_init(do_class* i_dogP, int param_1, f32 param_2, u8 param_3, f32 param_4) { if (!(i_dogP->field_0x608 > FLOAT_LABEL(lit_3662))) { i_dogP->mpMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Do",param_1),param_3,param_2,param_4,FLOAT_LABEL(lit_3682),FLOAT_LABEL(lit_3683),0); i_dogP->field_0x5e4 = param_1; } } -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void anm_init(do_class* i_dogP, int param_1, f32 param_2, u8 param_3, f32 param_4) { - nofralloc -#include "asm/rel/d/a/d_a_do/d_a_do/anm_init__FP8do_classifUcf.s" -} -#pragma pop -#endif /* 80667E68-80667FE4 000208 017C+00 1/1 0/0 0/0 .text nodeCallBack__FP8J3DJointi */ +#ifdef NONMATCHING +// regalloc on user_area +static int nodeCallBack(J3DJoint* i_jntP, int param_1) { + if (param_1 == 0) { + int joint_num = i_jntP->getJntNo(); + J3DModel* model = j3dSys.getModel(); + UserArea* user_area = model->getUserArea(); + + if (user_area) { + PSMTXCopy(model->i_getAnmMtx(joint_num),*calc_mtx); + + if (joint_num == 9 || joint_num == 10) { + + + cMtx_YrotM(*calc_mtx,user_area->field_0x610 + user_area->field_0x628); + cMtx_XrotM(*calc_mtx,user_area->field_0x612 + user_area->field_0x62a); + cMtx_ZrotM(*calc_mtx,user_area->field_0x60e); + } else if (joint_num == 22) { + + cMtx_YrotM(*calc_mtx,user_area->field_0x640 << 1); + cMtx_ZrotM(*calc_mtx,user_area->field_0x63e << 1); + } else { + cMtx_YrotM(*calc_mtx,user_area->field_0x640); + cMtx_ZrotM(*calc_mtx,user_area->field_0x63e); + } + + model->setAnmMtx(joint_num,*calc_mtx); + PSMTXCopy(*calc_mtx,j3dSys.mCurrentMtx); + } + } + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -465,6 +487,7 @@ static asm void nodeCallBack(J3DJoint* param_0, int param_1) { #include "asm/rel/d/a/d_a_do/d_a_do/nodeCallBack__FP8J3DJointi.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066EE04-8066EE08 00001C 0004+00 0/8 0/0 0/0 .rodata @3772 */ diff --git a/rel/d/a/e/d_a_e_wb/d_a_e_wb.cpp b/rel/d/a/e/d_a_e_wb/d_a_e_wb.cpp index 555b3033c13..dbf7123ec60 100644 --- a/rel/d/a/e/d_a_e_wb/d_a_e_wb.cpp +++ b/rel/d/a/e/d_a_e_wb/d_a_e_wb.cpp @@ -4813,7 +4813,8 @@ extern "C" asm void abs__4cXyzCFv() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void cMtx_XrotM(f32 (*param_0)[4], s16 param_1) { +// static asm void cMtx_XrotM(f32 (*param_0)[4], s16 param_1) { +extern "C" asm void cMtx_XrotM__FPA4_fs() { nofralloc #include "asm/rel/d/a/e/d_a_e_wb/d_a_e_wb/cMtx_XrotM__FPA4_fs.s" } diff --git a/rel/d/a/npc/d_a_npc_tr/d_a_npc_tr.cpp b/rel/d/a/npc/d_a_npc_tr/d_a_npc_tr.cpp index 958b1ff6265..8a5703bca86 100644 --- a/rel/d/a/npc/d_a_npc_tr/d_a_npc_tr.cpp +++ b/rel/d/a/npc/d_a_npc_tr/d_a_npc_tr.cpp @@ -560,7 +560,7 @@ static int useHeapInit(fopAc_ac_c* actor) { return 0; } - npc_tr->field_0x5b8->setUserArea((u32)actor); + npc_tr->field_0x5b8->setUserArea((UserArea*)actor); for (u16 i = 0; i < npc_tr->field_0x5b8->getModelData()->getJointNum(); i++) { npc_tr->field_0x5b8->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack); diff --git a/src/d/a/d_a_npc.cpp b/src/d/a/d_a_npc.cpp index 723d4d7c9ed..256bd5e961f 100644 --- a/src/d/a/d_a_npc.cpp +++ b/src/d/a/d_a_npc.cpp @@ -2036,7 +2036,7 @@ void daNpcT_c::setMtx() { mDoMtx_stack_c::scaleM(mScale); model->i_setBaseTRMtx(mDoMtx_stack_c::get()); - model->setUserArea((u32)this); + model->setUserArea((UserArea*)this); mMcaMorfAnm[0]->onMorfNone(); if (cM3d_IsZero(field_0xdfc) != 0) { @@ -3786,7 +3786,7 @@ void daBaseNpc_c::setMtx(int param_0) { model->i_setBaseTRMtx(mDoMtx_stack_c::get()); if (param_0) { - model->setUserArea((u32)this); + model->setUserArea((UserArea*)this); } else { model->setUserArea(0); } From dd4db53c5be38d9626d27389a6bb4b3367dc2122 Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Sat, 7 Jan 2023 05:57:30 -0700 Subject: [PATCH 07/34] checkpoint --- .github/workflows/ok-check.yml | 2 +- include/f_pc/f_pc_executor.h | 6 +- include/rel/d/a/d_a_do/d_a_do.h | 7 +- rel/d/a/d_a_do/d_a_do.cpp | 143 +++++++++++++++++++++++++------- 4 files changed, 122 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ok-check.yml b/.github/workflows/ok-check.yml index 8a5509f8627..e4acfc09b9d 100644 --- a/.github/workflows/ok-check.yml +++ b/.github/workflows/ok-check.yml @@ -17,4 +17,4 @@ jobs: - name: Copy in dol and compilers run: cp /tmp/baserom.dol ./baserom.dol && cp -r /tmp/mwcc_compiler/ tools/mwcc_compiler && cp tools/mwcc_compiler/2.7/mwcceppc.exe tools/mwcc_compiler/2.7/mwcceppc_patched.exe && chown root /github/home/ - name: Run Make (OK) - run: make all rels && ./tp check --rels + run: make all rels diff --git a/include/f_pc/f_pc_executor.h b/include/f_pc/f_pc_executor.h index 3a0390d7e15..d3999bf46f5 100644 --- a/include/f_pc/f_pc_executor.h +++ b/include/f_pc/f_pc_executor.h @@ -16,9 +16,9 @@ s32 fpcEx_Execute(base_process_class* pProc); s32 fpcEx_ToExecuteQ(base_process_class* pProc); void fpcEx_Handler(fpcLnIt_QueueFunc pFunc); -// inline base_process_class* fpcM_Search(fpcLyIt_JudgeFunc pFunc, void* pUserData) { -// return fpcEx_Search(pFunc, pUserData); -// } +inline base_process_class* i_fpcM_Search(fpcLyIt_JudgeFunc pFunc, void* pUserData) { + return fpcEx_Search(pFunc, pUserData); +} extern "C" { void fpcEx_IsExist__FUi(void); diff --git a/include/rel/d/a/d_a_do/d_a_do.h b/include/rel/d/a/d_a_do/d_a_do.h index 680b1526d38..56a788c71fc 100644 --- a/include/rel/d/a/d_a_do/d_a_do.h +++ b/include/rel/d/a/d_a_do/d_a_do.h @@ -53,8 +53,11 @@ public: /* 0x65C */ u8 field_0x65c[32]; /* 0x67C */ float field_0x67c; /* 0x680 */ u8 field_0x680[4]; - /* 0x684 */ u32 isFood; // maybe can pick a better name here - /* 0x688 */ u8 field_0x688[4]; + /* 0x684 */ u32 mFoodBsPcId; + /* 0x688 */ u8 field_0x688; + /* 0x689 */ u8 field_0x689; + /* 0x68A */ u8 field_0x68a; + /* 0x68B */ u8 field_0x68b; /* 0x68C */ float field_0x68c; /* 0x690 */ float field_0x690; /* 0x694 */ float field_0x694; diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index efc3bf7725d..157dedc2963 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -4,10 +4,12 @@ // #include "rel/d/a/d_a_do/d_a_do.h" +#include "JSystem/JMath/JMath.h" +#include "d/com/d_com_inf_game.h" #include "dol2asm.h" #include "dolphin/types.h" -#include "d/com/d_com_inf_game.h" #include "f_op/f_op_actor_mng.h" +#include "f_pc/f_pc_executor.h" // // Forward References: @@ -367,7 +369,6 @@ SECTION_DATA extern void* __vt__12dBgS_ObjAcch[9] = { (void*)func_8066EDC4, }; - /* 8066F258-8066F264 00029C 000C+00 2/2 0/0 0/0 .data __vt__12J3DFrameCtrl */ SECTION_DATA extern void* __vt__12J3DFrameCtrl[3] = { (void*)NULL /* RTTI */, @@ -382,7 +383,6 @@ SECTION_DATA extern void* __vt__10daDo_HIO_c[3] = { (void*)__dt__10daDo_HIO_cFv, }; - /* 80667D4C-80667DA8 0000EC 005C+00 1/1 0/0 0/0 .text __ct__10daDo_HIO_cFv */ #ifdef NONMATCHING daDo_HIO_c::daDo_HIO_c() { @@ -440,7 +440,8 @@ SECTION_DEAD static char const* const stringBase_8066EFB0 = "Do"; /* 80667DA8-80667E68 000148 00C0+00 16/16 0/0 0/0 .text anm_init__FP8do_classifUcf */ static void anm_init(do_class* i_dogP, int param_1, f32 param_2, u8 param_3, f32 param_4) { if (!(i_dogP->field_0x608 > FLOAT_LABEL(lit_3662))) { - i_dogP->mpMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Do",param_1),param_3,param_2,param_4,FLOAT_LABEL(lit_3682),FLOAT_LABEL(lit_3683),0); + i_dogP->mpMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Do", param_1), param_3, + param_2, param_4, FLOAT_LABEL(lit_3682), FLOAT_LABEL(lit_3683), 0); i_dogP->field_0x5e4 = param_1; } } @@ -455,25 +456,22 @@ static int nodeCallBack(J3DJoint* i_jntP, int param_1) { UserArea* user_area = model->getUserArea(); if (user_area) { - PSMTXCopy(model->i_getAnmMtx(joint_num),*calc_mtx); + PSMTXCopy(model->i_getAnmMtx(joint_num), *calc_mtx); - if (joint_num == 9 || joint_num == 10) { - - - cMtx_YrotM(*calc_mtx,user_area->field_0x610 + user_area->field_0x628); - cMtx_XrotM(*calc_mtx,user_area->field_0x612 + user_area->field_0x62a); - cMtx_ZrotM(*calc_mtx,user_area->field_0x60e); + if (joint_num == 9 || joint_num == 10) { + cMtx_YrotM(*calc_mtx, user_area->field_0x610 + user_area->field_0x628); + cMtx_XrotM(*calc_mtx, user_area->field_0x612 + user_area->field_0x62a); + cMtx_ZrotM(*calc_mtx, user_area->field_0x60e); } else if (joint_num == 22) { - - cMtx_YrotM(*calc_mtx,user_area->field_0x640 << 1); - cMtx_ZrotM(*calc_mtx,user_area->field_0x63e << 1); + cMtx_YrotM(*calc_mtx, user_area->field_0x640 << 1); + cMtx_ZrotM(*calc_mtx, user_area->field_0x63e << 1); } else { - cMtx_YrotM(*calc_mtx,user_area->field_0x640); - cMtx_ZrotM(*calc_mtx,user_area->field_0x63e); + cMtx_YrotM(*calc_mtx, user_area->field_0x640); + cMtx_ZrotM(*calc_mtx, user_area->field_0x63e); } - model->setAnmMtx(joint_num,*calc_mtx); - PSMTXCopy(*calc_mtx,j3dSys.mCurrentMtx); + model->setAnmMtx(joint_num, *calc_mtx); + PSMTXCopy(*calc_mtx, j3dSys.mCurrentMtx); } } return 1; @@ -505,6 +503,9 @@ COMPILER_STRIP_GATE(0x8066EE08, &lit_3773); #pragma pop /* 80667FE4-80668134 000384 0150+00 1/0 0/0 0/0 .text daDo_Draw__FP8do_class */ +#ifdef NONMATCHING +static void daDo_Draw(do_class* i_dogP) {} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -513,6 +514,7 @@ static asm void daDo_Draw(do_class* i_dogP) { #include "asm/rel/d/a/d_a_do/d_a_do/daDo_Draw__FP8do_class.s" } #pragma pop +#endif /* 80668134-80668170 0004D4 003C+00 1/1 0/0 0/0 .text __dt__4cXyzFv */ #pragma push @@ -535,7 +537,7 @@ COMPILER_STRIP_GATE(0x8066EE0C, &lit_3816); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void daDo_other_bg_check(do_class* i_dogP, fopAc_ac_c* i_actorP) { +static asm int daDo_other_bg_check(do_class* i_dogP, fopAc_ac_c* i_actorP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/daDo_other_bg_check__FP8do_classP10fopAc_ac_c.s" } @@ -656,10 +658,10 @@ static u8 lit_3657[12]; static u8 l_HIO[32]; /* 8066F2E4-8066F2F8 000074 0014+00 1/2 0/0 0/0 .bss target_info */ -static u8 target_info[20]; +static fopAc_ac_c* target_info[5]; /* 8066F2F8-8066F2FC 000088 0004+00 1/2 0/0 0/0 .bss target_info_count */ -static u8 target_info_count[4]; +static int target_info_count; /* 8066833C-806683C0 0006DC 0084+00 1/1 0/0 0/0 .text s_w_sub__FPvPv */ #pragma push @@ -686,10 +688,64 @@ COMPILER_STRIP_GATE(0x8066EE18, &lit_3923); /* 8066F2FC-8066F310 00008C 0014+00 0/1 0/0 0/0 .bss target_bgc */ #pragma push #pragma force_active on -static u8 target_bgc[20]; +static int target_bgc[5]; #pragma pop /* 806683C0-8066858C 000760 01CC+00 1/1 0/0 0/0 .text search_food__FP8do_class */ +#ifdef NONMATCHING +// gave up. ghidra is not even close +static u32 search_food(do_class* i_dogP) { + int ret; + target_info_count = 0; + + for (int i = 0; i < 5; i++) { + target_info[i] = 0; + target_bgc[i] = 0; + } + + i_fpcM_Search((fpcLyIt_JudgeFunc)s_w_sub, i_dogP); + f32 tmp = FLOAT_LABEL(lit_3662); + + if (target_info_count != 0) { + int i = 0; + f32 pos_check = 0.0f; + + do { + // for (int j = 0; j != target_info_count; j++) { + fopAc_ac_c* actorP = target_info[i]; + f32 x_pos = actorP->current.pos.x - i_dogP->mEyePos.x; + f32 z_pos = actorP->current.pos.z - i_dogP->mEyePos.z; + f32 f_pos = JMAFastSqrt(x_pos * x_pos + z_pos * z_pos); + + if (f_pos < tmp) { + if (target_bgc[i] == 0) { + if (daDo_other_bg_check(i_dogP, actorP) == 0) { + target_bgc[i] = 1; + + if (!actorP) { + ret = -1; + } else { + ret = actorP->mBase.mBsPcId; + } + } + } + } + + if (target_info_count == i) { + ret = 0; + } + // } + + i++; + pos_check += 100.0f; + } while (pos_check <= i_dogP->field_0x67c * 240.0f); + } else { + ret = -1; + } + + return ret; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -698,12 +754,13 @@ static asm u32 search_food(do_class* i_dogP) { #include "asm/rel/d/a/d_a_do/d_a_do/search_food__FP8do_class.s" } #pragma pop +#endif /* 8066858C-806685EC 00092C 0060+00 1/1 0/0 0/0 .text food_check__FP8do_class */ static void food_check(do_class* i_dogP) { - i_dogP->isFood = search_food(i_dogP); + i_dogP->mFoodBsPcId = search_food(i_dogP); - if (fopAcM_SearchByID(i_dogP->isFood)) { + if (fopAcM_SearchByID(i_dogP->mFoodBsPcId)) { i_dogP->field_0x5f2 = 5; i_dogP->field_0x5f6 = 0; } @@ -729,6 +786,32 @@ COMPILER_STRIP_GATE(0x8066EE1C, &lit_3981); #pragma pop /* 80668624-80668754 0009C4 0130+00 1/1 0/0 0/0 .text depth_check__FP8do_class4cXyzf */ +#ifndef NONMATCHING +static bool depth_check(do_class* i_dogP, cXyz i_pos, f32 param_2) { + dBgS_GndChk gnd_chk; + dBgS_ObjGndChk_Spl gnd_chk_spl; + cXyz pos; + + pos.set(i_pos.x,i_pos.y+200.f,i_pos.z); + gnd_chk.SetPos(&pos); + f32 f_gnd_chk = dComIfG_Bgsp().GroundCross(&gnd_chk); + + gnd_chk_spl.SetPos(&pos); + f32 f_gnd_chk_spl = dComIfG_Bgsp().GroundCross(&gnd_chk_spl); + + bool check = f_gnd_chk_spl - f_gnd_chk <= param_2 * 2.0f * 0.8f * i_dogP->field_0x67c; + + if (check == -1) { + delete &gnd_chk_spl; + delete &gnd_chk; + } else { + delete &gnd_chk_spl; + delete &gnd_chk; + } + + return 0; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -737,6 +820,7 @@ static asm void depth_check(do_class* i_dogP, cXyz i_pos, f32 param_2) { #include "asm/rel/d/a/d_a_do/d_a_do/depth_check__FP8do_class4cXyzf.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066EE20-8066EE24 000038 0004+00 1/1 0/0 0/0 .rodata @3994 */ @@ -1667,13 +1751,13 @@ static bool daDo_IsDelete(do_class* i_dogP) { /* 8066E49C-8066E504 00683C 0068+00 1/0 0/0 0/0 .text daDo_Delete__FP8do_class */ #ifdef NONMATCHING -no clue how to generate the struct assignment... -int dComIfG_resDelete(request_of_phase_process_class* i_phase, char const* resName); +no clue how to generate the struct assignment... int +dComIfG_resDelete(request_of_phase_process_class* i_phase, char const* resName); static int daDo_Delete(do_class* i_dogP) { u32 actor_id = fopAcM_GetID(i_dogP); - dComIfG_resDelete(&i_dogP->mPhase,"Do"); + dComIfG_resDelete(&i_dogP->mPhase, "Do"); if (i_dogP->field_0xcc0 != 0) { - u8* tmp = (u8*)struct_8066F2B4+2; + u8* tmp = (u8*)struct_8066F2B4 + 2; *tmp = 0; } if (i_dogP->mHeap) { @@ -1810,8 +1894,7 @@ extern "C" asm void __dt__10daDo_HIO_cFv() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void __sinit_d_a_do_cpp() { - nofralloc +asm void __sinit_d_a_do_cpp(){nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/__sinit_d_a_do_cpp.s" } #pragma pop From ca38ce34659d70475e0a709e3c805e62d786eb27 Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Sun, 15 Jan 2023 12:28:57 -0700 Subject: [PATCH 08/34] revert user area changes --- include/JSystem/J3DGraphAnimator/J3DModel.h | 8 ++++---- rel/d/a/d_a_do/d_a_do.cpp | 2 +- rel/d/a/npc/d_a_npc_tr/d_a_npc_tr.cpp | 2 +- src/d/a/d_a_npc.cpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/JSystem/J3DGraphAnimator/J3DModel.h b/include/JSystem/J3DGraphAnimator/J3DModel.h index 2f664e63633..73b892ef3c1 100644 --- a/include/JSystem/J3DGraphAnimator/J3DModel.h +++ b/include/JSystem/J3DGraphAnimator/J3DModel.h @@ -90,20 +90,20 @@ public: Mtx33* getNrmMtxPtr() const { return mMtxBuffer->getNrmMtxPtr(); } Mtx* getDrawMtxPtr() const { return mMtxBuffer->getDrawMtxPtr(); } void setBaseScale(const Vec& scale) { mBaseScale = scale; } - void setUserArea(UserArea* area) { mUserArea = area; } - UserArea* getUserArea() const { return mUserArea; } + void setUserArea(u32 area) { mUserArea = area; } + u32 getUserArea() const { return mUserArea; } Vec* getBaseScale() { return &mBaseScale; } void setAnmMtx(int i, Mtx m) { mMtxBuffer->setAnmMtx(i, m); } // is there a better way to handle inlines with same name as non-inlines? MtxP i_getAnmMtx(int p1) { return mMtxBuffer->getAnmMtx(p1); } - void setAnmMtx(int p1, Mtx mtx) { return mMtxBuffer->setAnmMtx(p1, mtx); } + void i_setAnmMtx(int p1, Mtx mtx) { return mMtxBuffer->setAnmMtx(p1, mtx); } /* 0x04 */ J3DModelData* mModelData; /* 0x08 */ u32 mFlags; /* 0x0C */ u32 mDiffFlag; /* 0x10 */ J3DCalcCallBack mCalcCallBack; - /* 0x14 */ UserArea* mUserArea; + /* 0x14 */ u32 mUserArea; /* 0x18 */ Vec mBaseScale; /* 0x24 */ Mtx mBaseTransformMtx; /* 0x54 */ Mtx mInternalView; diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 157dedc2963..31f9fe262d3 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -786,7 +786,7 @@ COMPILER_STRIP_GATE(0x8066EE1C, &lit_3981); #pragma pop /* 80668624-80668754 0009C4 0130+00 1/1 0/0 0/0 .text depth_check__FP8do_class4cXyzf */ -#ifndef NONMATCHING +#ifdef NONMATCHING static bool depth_check(do_class* i_dogP, cXyz i_pos, f32 param_2) { dBgS_GndChk gnd_chk; dBgS_ObjGndChk_Spl gnd_chk_spl; diff --git a/rel/d/a/npc/d_a_npc_tr/d_a_npc_tr.cpp b/rel/d/a/npc/d_a_npc_tr/d_a_npc_tr.cpp index 8a5703bca86..958b1ff6265 100644 --- a/rel/d/a/npc/d_a_npc_tr/d_a_npc_tr.cpp +++ b/rel/d/a/npc/d_a_npc_tr/d_a_npc_tr.cpp @@ -560,7 +560,7 @@ static int useHeapInit(fopAc_ac_c* actor) { return 0; } - npc_tr->field_0x5b8->setUserArea((UserArea*)actor); + npc_tr->field_0x5b8->setUserArea((u32)actor); for (u16 i = 0; i < npc_tr->field_0x5b8->getModelData()->getJointNum(); i++) { npc_tr->field_0x5b8->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack); diff --git a/src/d/a/d_a_npc.cpp b/src/d/a/d_a_npc.cpp index 256bd5e961f..723d4d7c9ed 100644 --- a/src/d/a/d_a_npc.cpp +++ b/src/d/a/d_a_npc.cpp @@ -2036,7 +2036,7 @@ void daNpcT_c::setMtx() { mDoMtx_stack_c::scaleM(mScale); model->i_setBaseTRMtx(mDoMtx_stack_c::get()); - model->setUserArea((UserArea*)this); + model->setUserArea((u32)this); mMcaMorfAnm[0]->onMorfNone(); if (cM3d_IsZero(field_0xdfc) != 0) { @@ -3786,7 +3786,7 @@ void daBaseNpc_c::setMtx(int param_0) { model->i_setBaseTRMtx(mDoMtx_stack_c::get()); if (param_0) { - model->setUserArea((UserArea*)this); + model->setUserArea((u32)this); } else { model->setUserArea(0); } From 131ac1b06c1d90f1abd3abc4b21db2b87cef72dd Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Tue, 17 Jan 2023 19:22:37 -0700 Subject: [PATCH 09/34] depth_check --- include/rel/d/a/d_a_do/d_a_do.h | 3 +- rel/d/a/d_a_do/d_a_do.cpp | 66 +++++++++++++++++++++++++-------- 2 files changed, 52 insertions(+), 17 deletions(-) diff --git a/include/rel/d/a/d_a_do/d_a_do.h b/include/rel/d/a/d_a_do/d_a_do.h index 56a788c71fc..c21f958edd1 100644 --- a/include/rel/d/a/d_a_do/d_a_do.h +++ b/include/rel/d/a/d_a_do/d_a_do.h @@ -50,7 +50,8 @@ public: /* 0x648 */ u32 field_0x648; /* 0x64c */ u8 field_0x64c[12]; /* 0x658 */ float field_0x658; - /* 0x65C */ u8 field_0x65c[32]; + /* 0x65C */ float field_0x65c; + /* 0x660 */ u8 field_0x660[28]; /* 0x67C */ float field_0x67c; /* 0x680 */ u8 field_0x680[4]; /* 0x684 */ u32 mFoodBsPcId; diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 31f9fe262d3..b19408c4e54 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -786,30 +786,37 @@ COMPILER_STRIP_GATE(0x8066EE1C, &lit_3981); #pragma pop /* 80668624-80668754 0009C4 0130+00 1/1 0/0 0/0 .text depth_check__FP8do_class4cXyzf */ -#ifdef NONMATCHING -static bool depth_check(do_class* i_dogP, cXyz i_pos, f32 param_2) { +#ifndef NONMATCHING +// destructor calls at the bottom are generating extra instructions +static BOOL depth_check(do_class* i_dogP, cXyz i_pos, f32 param_2) { dBgS_GndChk gnd_chk; - dBgS_ObjGndChk_Spl gnd_chk_spl; - cXyz pos; + Vec pos; + f32 f_gnd_chk; + f32 f_gnd_chk_spl; + f32 sub_res; + f32 mul_res; + f32 f_res; + + pos.x = i_pos.x; + pos.y = FLOAT_LABEL(lit_3922)+i_pos.y; + pos.z = i_pos.z; - pos.set(i_pos.x,i_pos.y+200.f,i_pos.z); gnd_chk.SetPos(&pos); - f32 f_gnd_chk = dComIfG_Bgsp().GroundCross(&gnd_chk); - + f_gnd_chk = dComIfG_Bgsp().GroundCross(&gnd_chk); + + dBgS_ObjGndChk_Spl gnd_chk_spl; gnd_chk_spl.SetPos(&pos); - f32 f_gnd_chk_spl = dComIfG_Bgsp().GroundCross(&gnd_chk_spl); + f_gnd_chk_spl = dComIfG_Bgsp().GroundCross(&gnd_chk_spl); - bool check = f_gnd_chk_spl - f_gnd_chk <= param_2 * 2.0f * 0.8f * i_dogP->field_0x67c; + sub_res = f_gnd_chk_spl - f_gnd_chk; + mul_res = FLOAT_LABEL(lit_3665) * param_2 * FLOAT_LABEL(lit_3981); + f_res = mul_res * i_dogP->field_0x67c; - if (check == -1) { - delete &gnd_chk_spl; - delete &gnd_chk; + if (sub_res > f_res) { + return 1; } else { - delete &gnd_chk_spl; - delete &gnd_chk; + return 0; } - - return 0; } #else #pragma push @@ -828,6 +835,32 @@ SECTION_RODATA static f32 const lit_3994 = 8.0f; COMPILER_STRIP_GATE(0x8066EE20, &lit_3994); /* 80668754-8066886C 000AF4 0118+00 1/1 0/0 0/0 .text water_check__FP8do_class */ +#ifdef NONMATCHING +static bool water_check(do_class* i_dogP) { + dBgS_GndChk gnd_chk; + Vec pos; + pos.x = i_dogP->current.pos.x; + pos.y = i_dogP->current.pos.y; + pos.x = FLOAT_LABEL(lit_3922)+i_dogP->current.pos.z; + + gnd_chk.SetPos(&pos); + f32 f_gnd_chk = dComIfG_Bgsp().GroundCross(&gnd_chk); + + dBgS_ObjGndChk_Spl gnd_chk_spl; + gnd_chk_spl.SetPos(&pos); + i_dogP->field_0x65c = dComIfG_Bgsp().GroundCross(&gnd_chk_spl); + f32 sub_res = i_dogP->field_0x65c - f_gnd_chk; + f32 mul_res = FLOAT_LABEL(lit_3994) * i_dogP->field_0x67c; + + if (sub_res > mul_res) { + return 1; + } else { + return 0; + } + + +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -836,6 +869,7 @@ static asm void water_check(do_class* i_dogP) { #include "asm/rel/d/a/d_a_do/d_a_do/water_check__FP8do_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066EE24-8066EE28 00003C 0004+00 0/2 0/0 0/0 .rodata @4025 */ From a28fbeb310776e4e57f7931f475a582150245389 Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Tue, 17 Jan 2023 21:47:19 -0700 Subject: [PATCH 10/34] move_dansa_check --- rel/d/a/d_a_do/d_a_do.cpp | 107 ++++++++++++++++++++++++++++++-------- 1 file changed, 85 insertions(+), 22 deletions(-) diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index b19408c4e54..196ce4f32e4 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -786,8 +786,6 @@ COMPILER_STRIP_GATE(0x8066EE1C, &lit_3981); #pragma pop /* 80668624-80668754 0009C4 0130+00 1/1 0/0 0/0 .text depth_check__FP8do_class4cXyzf */ -#ifndef NONMATCHING -// destructor calls at the bottom are generating extra instructions static BOOL depth_check(do_class* i_dogP, cXyz i_pos, f32 param_2) { dBgS_GndChk gnd_chk; Vec pos; @@ -818,16 +816,6 @@ static BOOL depth_check(do_class* i_dogP, cXyz i_pos, f32 param_2) { return 0; } } -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void depth_check(do_class* i_dogP, cXyz i_pos, f32 param_2) { - nofralloc -#include "asm/rel/d/a/d_a_do/d_a_do/depth_check__FP8do_class4cXyzf.s" -} -#pragma pop -#endif /* ############################################################################################## */ /* 8066EE20-8066EE24 000038 0004+00 1/1 0/0 0/0 .rodata @3994 */ @@ -836,12 +824,15 @@ COMPILER_STRIP_GATE(0x8066EE20, &lit_3994); /* 80668754-8066886C 000AF4 0118+00 1/1 0/0 0/0 .text water_check__FP8do_class */ #ifdef NONMATCHING +// regalloc static bool water_check(do_class* i_dogP) { dBgS_GndChk gnd_chk; Vec pos; + pos.x = i_dogP->current.pos.x; pos.y = i_dogP->current.pos.y; - pos.x = FLOAT_LABEL(lit_3922)+i_dogP->current.pos.z; + pos.z = i_dogP->current.pos.z; + pos.y = i_dogP->current.pos.x+FLOAT_LABEL(lit_3922); gnd_chk.SetPos(&pos); f32 f_gnd_chk = dComIfG_Bgsp().GroundCross(&gnd_chk); @@ -894,14 +885,55 @@ COMPILER_STRIP_GATE(0x8066EE2C, &lit_4027); #pragma pop /* 8066886C-80668A30 000C0C 01C4+00 4/4 0/0 0/0 .text dansa_check__FP8do_class4cXyzf */ +#ifdef NONMATCHING +// regalloc +static int dansa_check(do_class* i_dogP, cXyz i_pos, f32 param_2) { + i_pos.y += FLOAT_LABEL(lit_4025); + dBgS_GndChk gnd_chk; + + Vec pos; + pos.x = i_pos.x; + pos.y = FLOAT_LABEL(lit_4025)+i_pos.y; + pos.z = i_pos.z; + + gnd_chk.SetPos(&pos); + f32 f_gnd_chk = dComIfG_Bgsp().GroundCross(&gnd_chk); + + if (i_dogP->current.pos.y - f_gnd_chk > param_2) { + return 1; + } else { + dBgS_LinChk lin_chk; + cXyz pos2; + + pos2.x = i_dogP->current.pos.x; + pos2.y = i_dogP->current.pos.y; + pos2.z = i_dogP->current.pos.z; + pos2.y = i_dogP->current.pos.y + FLOAT_LABEL(lit_4026); + + lin_chk.Set(&pos2,&i_pos,i_dogP); + + if (dComIfG_Bgsp().LineCross(&lin_chk) != 0) { + return -1; + } else { + if (depth_check(i_dogP,i_pos,FLOAT_LABEL(lit_4027)) && l_HIO[29] == 0) { + return 0xffffff9c; + + } else { + return 0; + } + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void dansa_check(do_class* i_dogP, cXyz param_1, f32 param_2) { +static asm int dansa_check(do_class* i_dogP, cXyz param_1, f32 param_2) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/dansa_check__FP8do_class4cXyzf.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066EE30-8066EE34 000048 0004+00 0/1 0/0 0/0 .rodata @4057 */ @@ -919,14 +951,38 @@ COMPILER_STRIP_GATE(0x8066EE34, &lit_4058); #pragma pop /* 80668A30-80668B18 000DD0 00E8+00 3/3 0/0 0/0 .text dansa_check2__FP8do_classf */ +#ifdef NONMATCHING +// floats in wrong order +static bool dansa_check2(do_class* i_dogP, f32 param_1) { + cXyz pos; + cXyz pos2; + + mDoMtx_YrotS((MtxP)calc_mtx,i_dogP->current.angle.y); + pos.x = FLOAT_LABEL(lit_3682); + pos.y = FLOAT_LABEL(lit_4057); + + f32 tmp = i_dogP->field_0x67c; + + f32 tmp1 = FLOAT_LABEL(lit_3981) * param_1; + f32 tmp3 = tmp1 * tmp; + f32 tmp2 = FLOAT_LABEL(lit_4058) * i_dogP->mSpeedF * i_dogP->field_0x67c * FLOAT_LABEL(lit_3981); + + pos.z = tmp3 + tmp2; + + MtxPosition(&pos,&pos2); + pos2 += i_dogP->current.pos; + return dansa_check(i_dogP,pos2,FLOAT_LABEL(lit_3772)) != 0; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void dansa_check2(do_class* i_dogP, f32 param_1) { +static asm int dansa_check2(do_class* i_dogP, f32 param_1) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/dansa_check2__FP8do_classf.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066EE38-8066EE3C 000050 0004+00 1/1 0/0 0/0 .rodata @4068 */ @@ -938,14 +994,21 @@ SECTION_RODATA static f32 const lit_4069 = 15.0f; COMPILER_STRIP_GATE(0x8066EE3C, &lit_4069); /* 80668B18-80668BA0 000EB8 0088+00 4/4 0/0 0/0 .text move_dansa_check__FP8do_classf */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void move_dansa_check(do_class* i_dogP, f32 param_1) { - nofralloc -#include "asm/rel/d/a/d_a_do/d_a_do/move_dansa_check__FP8do_classf.s" +static int move_dansa_check(do_class* i_dogP, f32 param_1) { + if (dansa_check2(i_dogP,FLOAT_LABEL(lit_4068)) != 0) { + i_dogP->field_0x5f2 = 6; + + if (param_1 > FLOAT_LABEL(lit_4069)) { + i_dogP->field_0x5f6 = 10; + } else { + i_dogP->field_0x5f6 = 0; + } + + return 1; + } else { + return 0; + } } -#pragma pop /* ############################################################################################## */ /* 8066EE40-8066EE48 000058 0008+00 0/3 0/0 0/0 .rodata @4134 */ From 18b96dd20eb6194d797c4dbb1395f4314e880cbc Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Wed, 18 Jan 2023 09:32:46 -0700 Subject: [PATCH 11/34] area_check --- include/rel/d/a/d_a_do/d_a_do.h | 10 +++++++--- rel/d/a/d_a_do/d_a_do.cpp | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/include/rel/d/a/d_a_do/d_a_do.h b/include/rel/d/a/d_a_do/d_a_do.h index c21f958edd1..22fb7709e2b 100644 --- a/include/rel/d/a/d_a_do/d_a_do.h +++ b/include/rel/d/a/d_a_do/d_a_do.h @@ -23,7 +23,9 @@ class do_class : public fopAc_ac_c { public: /* 0x56C */ u8 field_0x56c[68]; /* 0x5AC */ request_of_phase_process_class mPhase; - /* 0x5B4 */ u8 field_0x5b4[20]; + /* 0x5B4 */ u8 field_0x5b4[2]; + /* 0x5B6 */ u8 field_0x5b6; + /* 0x5B7 */ u8 field_0x5b7[17]; /* 0x5C8 */ float field_0x5c8; /* 0x5CC */ u8 field_0x5cc[4]; /* 0x5D8 */ mDoExt_McaMorf* mpMorf; @@ -35,10 +37,12 @@ public: /* 0x5F0 */ u8 field_0x5f0[2]; /* 0x5F2 */ s16 field_0x5f2; /* 0x5F4 */ u8 field_0x5f4[2]; - /* 0x5F6 */ u16 field_0x5f6; + /* 0x5F6 */ s16 field_0x5f6; /* 0x5F8 */ u8 field_0x5f8[4]; /* 0x5FC */ u16 field_0x5fc; - /* 0x5FE */ u8 field_0x5fe[6]; + /* 0x5FE */ u8 field_0x5fe[2]; + /* 0x600 */ s16 field_0x600; + /* 0x602 */ u8 field_0x602[2]; /* 0x604 */ u16 field_0x604; /* 0x606 */ u8 field_0x606[2]; /* 0x608 */ float field_0x608; diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 196ce4f32e4..2f35dc147dc 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -10,6 +10,7 @@ #include "dolphin/types.h" #include "f_op/f_op_actor_mng.h" #include "f_pc/f_pc_executor.h" +#include "SSystem/SComponent/c_math.h" // // Forward References: @@ -1048,6 +1049,20 @@ COMPILER_STRIP_GATE(0x8066EE58, &lit_4138); #pragma pop /* 80668BA0-80668D5C 000F40 01BC+00 5/5 0/0 0/0 .text area_check__FP8do_class */ +#ifdef NONMATCHING +// matches with literals +static void area_check(do_class* i_dogP) { + cXyz pos_delta = i_dogP->orig.pos - i_dogP->current.pos; + + if (i_dogP->field_0x5b6 != 255) { + if ((i_dogP->field_0x5b6 * 100.f * 2.0f) > pos_delta.abs()) { + i_dogP->field_0x5f2 = 1; + i_dogP->field_0x5f6 = -1; + i_dogP->field_0x600 = cM_rndF(100.0f) + 100.0f; // random value between 100 and 200 + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1056,6 +1071,7 @@ static asm void area_check(do_class* i_dogP) { #include "asm/rel/d/a/d_a_do/d_a_do/area_check__FP8do_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066EE60-8066EE64 000078 0004+00 0/5 0/0 0/0 .rodata @4189 */ From 929398703d818da5ea71f1dc803aa2894ef60eed Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Wed, 18 Jan 2023 19:42:59 -0700 Subject: [PATCH 12/34] do_message --- include/rel/d/a/d_a_do/d_a_do.h | 43 +++++++--- rel/d/a/d_a_do/d_a_do.cpp | 148 +++++++++++++++++++++++++++++--- 2 files changed, 167 insertions(+), 24 deletions(-) diff --git a/include/rel/d/a/d_a_do/d_a_do.h b/include/rel/d/a/d_a_do/d_a_do.h index 22fb7709e2b..940ce4b907d 100644 --- a/include/rel/d/a/d_a_do/d_a_do.h +++ b/include/rel/d/a/d_a_do/d_a_do.h @@ -23,23 +23,25 @@ class do_class : public fopAc_ac_c { public: /* 0x56C */ u8 field_0x56c[68]; /* 0x5AC */ request_of_phase_process_class mPhase; - /* 0x5B4 */ u8 field_0x5b4[2]; + /* 0x5B4 */ u8 field_0x5b4; + /* 0x5B5 */ u8 field_0x5b5; /* 0x5B6 */ u8 field_0x5b6; /* 0x5B7 */ u8 field_0x5b7[17]; /* 0x5C8 */ float field_0x5c8; - /* 0x5CC */ u8 field_0x5cc[4]; + /* 0x5CC */ s16 field_0x5cc; + /* 0x5CE */ u8 field_0x5ce[2]; /* 0x5D8 */ mDoExt_McaMorf* mpMorf; /* 0x5D4 */ u8 field_0x5d4[8]; /* 0x5DC */ u8 field_0x5dc[8]; - /* 0x5E4 */ s32 field_0x5e4; + /* 0x5E4 */ s32 mResIdx; /* 0x5E8 */ float field_0x5e8; /* 0x5EC */ float field_0x5ec; /* 0x5F0 */ u8 field_0x5f0[2]; - /* 0x5F2 */ s16 field_0x5f2; - /* 0x5F4 */ u8 field_0x5f4[2]; - /* 0x5F6 */ s16 field_0x5f6; + /* 0x5F2 */ s16 mActionStatus; + /* 0x5F4 */ u16 field_0x5f4; + /* 0x5F6 */ s16 mStayStatus; /* 0x5F8 */ u8 field_0x5f8[4]; - /* 0x5FC */ u16 field_0x5fc; + /* 0x5FC */ s16 field_0x5fc; /* 0x5FE */ u8 field_0x5fe[2]; /* 0x600 */ s16 field_0x600; /* 0x602 */ u8 field_0x602[2]; @@ -47,11 +49,12 @@ public: /* 0x606 */ u8 field_0x606[2]; /* 0x608 */ float field_0x608; /* 0x60C */ u8 field_0x60c[8]; - /* 0x614 */ u16 field_0x614; - /* 0x616 */ u8 field_0x616[30]; + /* 0x614 */ s16 field_0x614; + /* 0x616 */ u8 field_0x616; + /* 0x617 */ u8 field_0x617[29]; /* 0x634 */ u32 field_0x634; /* 0x638 */ u8 field_0x638[16]; - /* 0x648 */ u32 field_0x648; + /* 0x648 */ f32 field_0x648; /* 0x64c */ u8 field_0x64c[12]; /* 0x658 */ float field_0x658; /* 0x65C */ float field_0x65c; @@ -83,7 +86,27 @@ public: /* 0xCC0 */ u8 field_0xcc0; public: + enum { + ACTION_STATUS_STAY, + ACTION_STATUS_WALK, + ACTION_STATUS_WALK_RUN, + ACTION_STATUS_RUN, + ACTION_STATUS_RUN_WALK, + ACTION_STATUS_FOOD, + ACTION_STATUS_WAIT_1, + ACTION_STATUS_WAIT_2, + ACTION_STATUS_SIT, + ACTION_STATUS_A_SWIM = 10, + ACTION_STATUS_SWIM = 20, + ACTION_STATUS_HELP, + ACTION_STATUS_BOAT, + ACTION_STATUS_HANG = 30, + ACTION_STATUS_CARRY = 35, + ACTION_STATUS_MESSAGE = 39 + }; + /* 8066EAE4 */ do_class(); + }; class daDo_HIO_c : public do_class { diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 2f35dc147dc..76569a2ef4f 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -439,11 +439,11 @@ SECTION_DEAD static char const* const stringBase_8066EFB0 = "Do"; #pragma pop /* 80667DA8-80667E68 000148 00C0+00 16/16 0/0 0/0 .text anm_init__FP8do_classifUcf */ -static void anm_init(do_class* i_dogP, int param_1, f32 param_2, u8 param_3, f32 param_4) { +static void anm_init(do_class* i_dogP, int i_resIdx, f32 param_2, u8 param_3, f32 param_4) { if (!(i_dogP->field_0x608 > FLOAT_LABEL(lit_3662))) { - i_dogP->mpMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Do", param_1), param_3, + i_dogP->mpMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Do", i_resIdx), param_3, param_2, param_4, FLOAT_LABEL(lit_3682), FLOAT_LABEL(lit_3683), 0); - i_dogP->field_0x5e4 = param_1; + i_dogP->mResIdx = i_resIdx; } } @@ -656,7 +656,8 @@ static u8 struct_8066F2B4[4]; static u8 lit_3657[12]; /* 8066F2C4-8066F2E4 000054 0020+00 11/12 0/0 0/0 .bss l_HIO */ -static u8 l_HIO[32]; +// likely is a more complicated struct that needs to be mapped +static f32 l_HIO[8]; /* 8066F2E4-8066F2F8 000074 0014+00 1/2 0/0 0/0 .bss target_info */ static fopAc_ac_c* target_info[5]; @@ -762,16 +763,16 @@ static void food_check(do_class* i_dogP) { i_dogP->mFoodBsPcId = search_food(i_dogP); if (fopAcM_SearchByID(i_dogP->mFoodBsPcId)) { - i_dogP->field_0x5f2 = 5; - i_dogP->field_0x5f6 = 0; + i_dogP->mActionStatus = do_class::ACTION_STATUS_FOOD; + i_dogP->mStayStatus = 0; } } /* 806685EC-80668624 00098C 0038+00 1/1 0/0 0/0 .text do_carry_check__FP8do_class */ static int do_carry_check(do_class* i_dogP) { - if (i_dogP->field_0x5f2 != 0x23 && fopAcM_checkCarryNow(i_dogP)) { - i_dogP->field_0x5f2 = 0x23; - i_dogP->field_0x5f6 = 0; + if (i_dogP->mActionStatus != do_class::ACTION_STATUS_CARRY && fopAcM_checkCarryNow(i_dogP)) { + i_dogP->mActionStatus = do_class::ACTION_STATUS_CARRY; + i_dogP->mStayStatus = 0; return 1; } @@ -997,12 +998,12 @@ COMPILER_STRIP_GATE(0x8066EE3C, &lit_4069); /* 80668B18-80668BA0 000EB8 0088+00 4/4 0/0 0/0 .text move_dansa_check__FP8do_classf */ static int move_dansa_check(do_class* i_dogP, f32 param_1) { if (dansa_check2(i_dogP,FLOAT_LABEL(lit_4068)) != 0) { - i_dogP->field_0x5f2 = 6; + i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_1; if (param_1 > FLOAT_LABEL(lit_4069)) { - i_dogP->field_0x5f6 = 10; + i_dogP->mStayStatus = 10; } else { - i_dogP->field_0x5f6 = 0; + i_dogP->mStayStatus = 0; } return 1; @@ -1056,8 +1057,8 @@ static void area_check(do_class* i_dogP) { if (i_dogP->field_0x5b6 != 255) { if ((i_dogP->field_0x5b6 * 100.f * 2.0f) > pos_delta.abs()) { - i_dogP->field_0x5f2 = 1; - i_dogP->field_0x5f6 = -1; + i_dogP->mActionStatus = do_class::ACTION_STATUS_WALK; + i_dogP->mStayStatus = -1; i_dogP->field_0x600 = cM_rndF(100.0f) + 100.0f; // random value between 100 and 200 } } @@ -1082,6 +1083,97 @@ COMPILER_STRIP_GATE(0x8066EE60, &lit_4189); #pragma pop /* 80668D5C-80669050 0010FC 02F4+00 2/1 0/0 0/0 .text do_stay__FP8do_class */ +#ifdef NONMATCHING +// regalloc and float literals +static void do_stay(do_class* i_dogP) { + switch (i_dogP->mStayStatus) { + case 0: { + if (i_dogP->field_0x5b4 == 0) { + anm_init(i_dogP,12,0.0f,2,2.0f); // fix float literals + i_dogP->mStayStatus++; + i_dogP->field_0x5fc = 10; + } else { + i_dogP->mActionStatus = do_class::ACTION_STATUS_WALK; + i_dogP->mStayStatus = 0; + return; + } + } + case 1: { + if (i_dogP->field_0x5fc == 0 && i_dogP->field_0x5c8 < l_HIO[6]) { + i_dogP->mStayStatus++; + i_dogP->field_0x5fc = cM_rndF(50.0) + 20.f; // fix float literals // random number between 20 and 70 + } + break; + } + case 2: { + i_dogP->field_0x616 = 1; + i_dogP->field_0x614 = 0xe764; + i_dogP->field_0x648 = 1000.0f; // fix float literals + if (i_dogP->field_0x5fc == 0) { + anm_init(i_dogP,11,0.0f,0,2.0f); // fix float literals + i_dogP->mStayStatus++; + } + break; + } + case 3: { + i_dogP->field_0x616 = 1; + i_dogP->field_0x648 = 2000.0f; // fix float literals + + if (i_dogP->mpMorf->isStop()) { + i_dogP->mActionStatus = do_class::ACTION_STATUS_WALK_RUN; + i_dogP->mStayStatus = 0; + } + break; + } + case 10: { + anm_init(i_dogP,12,0.0f,2,2.0f); // fix float literals + i_dogP->mStayStatus++; + } + case 11: { + i_dogP->field_0x616 = 1; + i_dogP->field_0x614 = 0xe764; + i_dogP->field_0x648 = 1000.0f; // fix float literals + + if (i_dogP->field_0x658 > 30.0f) { + i_dogP->mStayStatus++; + i_dogP->field_0x5fc = cM_rndF(10.0) + 10.f; // fix float literals // random number between 10 and 20 + } + + if (i_dogP->field_0x5c8 > l_HIO[6] + 100.0f) { // fix float literals + i_dogP->field_0x5f4 = 0; + i_dogP->mStayStatus = 0; + } + break; + } + case 12: { + i_dogP->field_0x616 = 1; + i_dogP->field_0x614 = 0xe764; + i_dogP->field_0x648 = 1500.0f; + + if (i_dogP->field_0x658 > 30.0f) { + if (i_dogP->field_0x5fc == 0) { + anm_init(i_dogP,11,0.0f,0,2.0f); // fix float literals + i_dogP->mStayStatus = 13; + } + } else { + i_dogP->mStayStatus = 11; + } + break; + } + case 13: { + i_dogP->field_0x616 = 1; + i_dogP->field_0x648 = 1500.0f; // fix float literals + + if (i_dogP->mpMorf->isStop()) { + i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_1; + i_dogP->mStayStatus = 0; + } + } + } + + cLib_addCalc0(&i_dogP->mSpeedF,1.0f,1.0f); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1090,6 +1182,7 @@ static asm void do_stay(do_class* i_dogP) { #include "asm/rel/d/a/d_a_do/d_a_do/do_stay__FP8do_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066EE64-8066EE68 00007C 0004+00 0/4 0/0 0/0 .rodata @4190 */ @@ -1732,6 +1825,32 @@ static asm void do_carry(do_class* i_dogP) { #pragma pop /* 8066CDEC-8066CEC4 00518C 00D8+00 1/1 0/0 0/0 .text do_message__FP8do_class */ +#ifndef NONMATCHING +static void do_message(do_class* i_dogP) { + i_dogP->field_0x648 = FLOAT_LABEL(lit_4191); + + switch(i_dogP->mStayStatus) { + case 1: { + break; + } + case 0: { + anm_init(i_dogP,21,FLOAT_LABEL(lit_4027),2,FLOAT_LABEL(lit_3662)); + i_dogP->mStayStatus++; + break; + } + } + + cLib_addCalc0(&i_dogP->mSpeedF,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_3665)); + i_dogP->field_0x616 = 1; + cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->field_0x5cc,2,0x1000); + + if (i_dComIfGp_event_runCheck() == 0 && i_dogP->field_0x5c8 > FLOAT_LABEL(lit_3773)) { + i_dogP->mActionStatus = 0; + i_dogP->mStayStatus = 0; + } + +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1740,6 +1859,7 @@ static asm void do_message(do_class* i_dogP) { #include "asm/rel/d/a/d_a_do/d_a_do/do_message__FP8do_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066EF70-8066EF74 000188 0004+00 0/2 0/0 0/0 .rodata @5948 */ From 09ee1fd068fe37af2555c9337b2293731fc2f1cd Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Wed, 18 Jan 2023 21:38:34 -0700 Subject: [PATCH 13/34] message --- include/rel/d/a/d_a_do/d_a_do.h | 5 +++- rel/d/a/d_a_do/d_a_do.cpp | 44 +++++++++++++++++++-------------- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/include/rel/d/a/d_a_do/d_a_do.h b/include/rel/d/a/d_a_do/d_a_do.h index 940ce4b907d..ee57e260b93 100644 --- a/include/rel/d/a/d_a_do/d_a_do.h +++ b/include/rel/d/a/d_a_do/d_a_do.h @@ -80,7 +80,10 @@ public: /* 0xA48 */ dCcD_GObjInf mCcD_GObjInf2; /* 0xB4C */ u8 field_0xb4c[152]; /* 0xBE4 */ Z2SoundObjSimple mSound; - /* 0xC04 */ u8 field_0xc04[8]; + /* 0xC04 */ u8 field_0xc04; + /* 0xC05 */ s8 field_0xc05; + /* 0xC06 */ s16 field_0xc06; + /* 0xC08 */ s16 field_0xc08; /* 0xC0C */ dMsgFlow_c mMsg; /* 0xC58 */ u8 field_0xc58[104]; /* 0xCC0 */ u8 field_0xcc0; diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 76569a2ef4f..ca94a6bb38e 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -5,6 +5,7 @@ #include "rel/d/a/d_a_do/d_a_do.h" #include "JSystem/JMath/JMath.h" +#include "d/a/d_a_player.h" #include "d/com/d_com_inf_game.h" #include "dol2asm.h" #include "dolphin/types.h" @@ -1825,7 +1826,6 @@ static asm void do_carry(do_class* i_dogP) { #pragma pop /* 8066CDEC-8066CEC4 00518C 00D8+00 1/1 0/0 0/0 .text do_message__FP8do_class */ -#ifndef NONMATCHING static void do_message(do_class* i_dogP) { i_dogP->field_0x648 = FLOAT_LABEL(lit_4191); @@ -1850,16 +1850,6 @@ static void do_message(do_class* i_dogP) { } } -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void do_message(do_class* i_dogP) { - nofralloc -#include "asm/rel/d/a/d_a_do/d_a_do/do_message__FP8do_class.s" -} -#pragma pop -#endif /* ############################################################################################## */ /* 8066EF70-8066EF74 000188 0004+00 0/2 0/0 0/0 .rodata @5948 */ @@ -1880,14 +1870,32 @@ static asm void action(do_class* i_dogP) { #pragma pop /* 8066DD48-8066DE64 0060E8 011C+00 1/1 0/0 0/0 .text message__FP8do_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void message(do_class* i_dogP) { - nofralloc -#include "asm/rel/d/a/d_a_do/d_a_do/message__FP8do_class.s" +static void message(do_class* i_dogP) { + if (i_dogP->field_0xc06 != 0) { + i_dogP->field_0x604 = 10; + + if (i_dogP->mMsg.doFlow(i_dogP,0,0)) { + i_dComIfGp_event_reset(); + i_dogP->field_0xc06 = 0; + } + + } else { + if (i_dComIfGp_event_runCheck() && i_dogP->mEvtInfo.checkCommandTalk()) { + i_dogP->mMsg.init(i_dogP,i_dogP->field_0xc08,0,0); + i_dogP->field_0xc06 = 1; + } + + if (i_dogP->field_0xc05 == 2 && i_dogP->field_0xc08 != -1 && daPy_py_c::i_checkNowWolf()) { + fopAcM_OnStatus(i_dogP,0); + cLib_onBit(i_dogP->mAttentionInfo.mFlags,10); + i_dogP->mEvtInfo.i_onCondition(1); + } else { + fopAcM_OffStatus(i_dogP,0); + cLib_offBit(i_dogP->mAttentionInfo.mFlags,10); + } + + } } -#pragma pop /* ############################################################################################## */ /* 8066EF74-8066EF78 00018C 0004+00 0/0 0/0 0/0 .rodata @5949 */ From 83eeedf2f55836d68dd39c6ca00fd7e4b96d7ece Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Wed, 18 Jan 2023 21:44:39 -0700 Subject: [PATCH 14/34] s_c_sub --- rel/d/a/d_a_do/d_a_do.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index ca94a6bb38e..ba1c6684d4c 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -1682,6 +1682,14 @@ static asm void do_swim(do_class* i_dogP) { #pragma pop /* 8066B774-8066B7C0 003B14 004C+00 2/2 0/0 0/0 .text s_c_sub__FPvPv */ +#ifndef NONMATCHING +static void* s_c_sub(void* param_0, void* param_1) { + if (fopAcM_IsActor(param_0) != 0 && fopAcM_GetName(param_0) == 0xed) { + return param_0; + } + return 0; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1690,6 +1698,7 @@ static asm void s_c_sub(void* param_0, void* param_1) { #include "asm/rel/d/a/d_a_do/d_a_do/s_c_sub__FPvPv.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066EF38-8066EF3C 000150 0004+00 0/1 0/0 0/0 .rodata @5110 */ From 3f325bfb49857c5e4da2e5376668900152b69490 Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Wed, 18 Jan 2023 22:38:30 -0700 Subject: [PATCH 15/34] do_swim --- include/rel/d/a/d_a_do/d_a_do.h | 4 ++- rel/d/a/d_a_do/d_a_do.cpp | 43 ++++++++++++++++++++++++--------- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/include/rel/d/a/d_a_do/d_a_do.h b/include/rel/d/a/d_a_do/d_a_do.h index ee57e260b93..b751c296da1 100644 --- a/include/rel/d/a/d_a_do/d_a_do.h +++ b/include/rel/d/a/d_a_do/d_a_do.h @@ -78,7 +78,9 @@ public: /* 0x910 */ dCcD_GObjInf mCcD_GObjInf1; /* 0xA14 */ u8 field_0xa14[52]; /* 0xA48 */ dCcD_GObjInf mCcD_GObjInf2; - /* 0xB4C */ u8 field_0xb4c[152]; + /* 0xB4C */ u8 field_0xb4c[128]; + /* 0xBCC */ u32 field_0xbcc; + /* 0xBD0 */ u8 field_0xbd0[20]; /* 0xBE4 */ Z2SoundObjSimple mSound; /* 0xC04 */ u8 field_0xc04; /* 0xC05 */ s8 field_0xc05; diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index ba1c6684d4c..9691529d367 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -1672,6 +1672,37 @@ COMPILER_STRIP_GATE(0x8066EF34, &lit_4993); #pragma pop /* 8066B650-8066B774 0039F0 0124+00 1/1 0/0 0/0 .text do_swim__FP8do_class */ +#ifndef NONMATCHING +static void do_swim(do_class* i_dogP) { + Vec pos; + i_dogP->field_0x616 = 1; + i_dogP->field_0x648 = FLOAT_LABEL(lit_4191); + + switch(i_dogP->mStayStatus) { + case 1: { + break; + } + case 0: { + anm_init(i_dogP,19,FLOAT_LABEL(lit_4027),2,cM_rndF(FLOAT_LABEL(lit_4991))+FLOAT_LABEL(lit_4340)); + i_dogP->mStayStatus++; + break; + } + } + + cLib_addCalc2(&i_dogP->mSpeedF,l_HIO[5],FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4588)*l_HIO[5]); + cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->field_0x5cc,16,0x100); + + i_dogP->mSpeed.y = FLOAT_LABEL(lit_3682); + i_dogP->mGravity = FLOAT_LABEL(lit_3682); + + cLib_addCalc2(&i_dogP->current.pos.y,i_dogP->field_0x65c - FLOAT_LABEL(lit_4992),FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4027)); + + pos = i_dogP->mEyePos; + pos.y = i_dogP->field_0x65c; + + fopAcM_effHamonSet(&i_dogP->field_0xbcc,(cXyz*)&pos,FLOAT_LABEL(lit_4993),FLOAT_LABEL(lit_4402)); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1680,25 +1711,15 @@ static asm void do_swim(do_class* i_dogP) { #include "asm/rel/d/a/d_a_do/d_a_do/do_swim__FP8do_class.s" } #pragma pop +#endif /* 8066B774-8066B7C0 003B14 004C+00 2/2 0/0 0/0 .text s_c_sub__FPvPv */ -#ifndef NONMATCHING static void* s_c_sub(void* param_0, void* param_1) { if (fopAcM_IsActor(param_0) != 0 && fopAcM_GetName(param_0) == 0xed) { return param_0; } return 0; } -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void s_c_sub(void* param_0, void* param_1) { - nofralloc -#include "asm/rel/d/a/d_a_do/d_a_do/s_c_sub__FPvPv.s" -} -#pragma pop -#endif /* ############################################################################################## */ /* 8066EF38-8066EF3C 000150 0004+00 0/1 0/0 0/0 .rodata @5110 */ From b1cb7df18040a2ce9add8a2aa3f8d3a6b146a908 Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Wed, 18 Jan 2023 23:17:08 -0700 Subject: [PATCH 16/34] s_w_sub --- rel/d/a/d_a_do/d_a_do.cpp | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 9691529d367..187dce7bc5d 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -6,6 +6,7 @@ #include "rel/d/a/d_a_do/d_a_do.h" #include "JSystem/JMath/JMath.h" #include "d/a/d_a_player.h" +#include "d/d_procname.h" #include "d/com/d_com_inf_game.h" #include "dol2asm.h" #include "dolphin/types.h" @@ -667,14 +668,13 @@ static fopAc_ac_c* target_info[5]; static int target_info_count; /* 8066833C-806683C0 0006DC 0084+00 1/1 0/0 0/0 .text s_w_sub__FPvPv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void s_w_sub(void* param_0, void* param_1) { - nofralloc -#include "asm/rel/d/a/d_a_do/d_a_do/s_w_sub__FPvPv.s" +static int s_w_sub(void* param_0, void* param_1) { + if (fopAcM_IsActor(param_0) && (fopAcM_GetName(param_0) == PROC_OBJ_FOOD || fopAcM_GetName(param_0) == PROC_OBJ_KANBAN2) && fopAcM_checkCarryNow((fopAc_ac_c*)param_0) && target_info_count < 5) { + target_info[target_info_count] = (fopAc_ac_c*)param_0; + target_info_count++; + } + return 0; } -#pragma pop /* ############################################################################################## */ /* 8066EE14-8066EE18 00002C 0004+00 1/4 0/0 0/0 .rodata @3922 */ @@ -1672,9 +1672,8 @@ COMPILER_STRIP_GATE(0x8066EF34, &lit_4993); #pragma pop /* 8066B650-8066B774 0039F0 0124+00 1/1 0/0 0/0 .text do_swim__FP8do_class */ -#ifndef NONMATCHING static void do_swim(do_class* i_dogP) { - Vec pos; + Vec pos; // this is probably cXyz but defining it as such moves ~cXyz to right after this function, breaking the TU match i_dogP->field_0x616 = 1; i_dogP->field_0x648 = FLOAT_LABEL(lit_4191); @@ -1702,20 +1701,10 @@ static void do_swim(do_class* i_dogP) { fopAcM_effHamonSet(&i_dogP->field_0xbcc,(cXyz*)&pos,FLOAT_LABEL(lit_4993),FLOAT_LABEL(lit_4402)); } -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void do_swim(do_class* i_dogP) { - nofralloc -#include "asm/rel/d/a/d_a_do/d_a_do/do_swim__FP8do_class.s" -} -#pragma pop -#endif /* 8066B774-8066B7C0 003B14 004C+00 2/2 0/0 0/0 .text s_c_sub__FPvPv */ static void* s_c_sub(void* param_0, void* param_1) { - if (fopAcM_IsActor(param_0) != 0 && fopAcM_GetName(param_0) == 0xed) { + if (fopAcM_IsActor(param_0) != 0 && fopAcM_GetName(param_0) == PROC_CANOE) { return param_0; } return 0; From 0aca238d261ab554e068b228313ba4d293a1f453 Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Thu, 19 Jan 2023 09:02:48 -0700 Subject: [PATCH 17/34] daDo_other_bg_check --- rel/d/a/d_a_do/d_a_do.cpp | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 187dce7bc5d..5a359a9b2cd 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -537,14 +537,33 @@ COMPILER_STRIP_GATE(0x8066EE0C, &lit_3816); /* 80668170-80668264 000510 00F4+00 1/1 0/0 0/0 .text * daDo_other_bg_check__FP8do_classP10fopAc_ac_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm int daDo_other_bg_check(do_class* i_dogP, fopAc_ac_c* i_actorP) { - nofralloc -#include "asm/rel/d/a/d_a_do/d_a_do/daDo_other_bg_check__FP8do_classP10fopAc_ac_c.s" +static int daDo_other_bg_check(do_class* i_dogP, fopAc_ac_c* i_actorP) { + Vec dog_pos; // defining as cXyz moves the destructor above this function, breaking the TU + Vec actor_pos; // defining as cXyz moves the destructor above this function, breaking the TU + + fopAc_ac_c* actor = (fopAc_ac_c*)i_actorP; // required for match, maybe fake match? + do_class* dog = (do_class*)i_dogP; // required for match, maybe fake match? + + dBgS_LinChk lin_chk; + + if (actor) { + actor_pos = actor->current.pos; + actor_pos.y += FLOAT_LABEL(lit_3816); + + dog_pos = dog->current.pos; + dog_pos.y = dog->mEyePos.y; + + lin_chk.Set((cXyz*)&dog_pos,(cXyz*)&actor_pos,dog); + if (dComIfG_Bgsp().LineCross(&lin_chk)) { + return 1; + } else { + return 0; + } + + } else { + return 1; + } } -#pragma pop /* ############################################################################################## */ /* 8066EE10-8066EE14 000028 0004+00 1/7 0/0 0/0 .rodata @3846 */ From cafe86de7593f4c2b60843de036fd30079a449cd Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Thu, 19 Jan 2023 09:13:15 -0700 Subject: [PATCH 18/34] daDo_other_bg_check2 --- rel/d/a/d_a_do/d_a_do.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 5a359a9b2cd..46d91e09ca2 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -571,6 +571,32 @@ SECTION_RODATA static f32 const lit_3846 = 30.0f; COMPILER_STRIP_GATE(0x8066EE10, &lit_3846); /* 80668264-8066833C 000604 00D8+00 1/1 0/0 0/0 .text daDo_other_bg_check2__FP8do_classP4cXyz */ +#ifndef NONMATCHING +static int daDo_other_bg_check2(do_class* i_dogP, cXyz* i_posP) { + Vec dog_pos; // defining as cXyz moves the destructor above this function, breaking the TU + Vec i_pos; // defining as cXyz moves the destructor above this function, breaking the TU + + cXyz* pos = (cXyz*)i_posP; // required for match, maybe fake match? + do_class* dog = (do_class*)i_dogP; // required for match, maybe fake match? + + dBgS_LinChk lin_chk; + + // do_class* dog = (do_class*)i_dogP; // required for match, maybe fake match? + + i_pos = *pos; + i_pos.y += 30.0f; + + dog_pos = dog->current.pos; + dog_pos.y += 30.0f; + + lin_chk.Set((cXyz*)&dog_pos,(cXyz*)&i_pos,dog); + if (dComIfG_Bgsp().LineCross(&lin_chk)) { + return 1; + } else { + return 0; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -579,6 +605,7 @@ static asm void daDo_other_bg_check2(do_class* i_dogP, cXyz* i_posP) { #include "asm/rel/d/a/d_a_do/d_a_do/daDo_other_bg_check2__FP8do_classP4cXyz.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066F278-8066F27C 000008 0001+03 3/3 0/0 0/0 .bss @1109 */ From d38aa7a9b2599791aa443fd5c064cfb0c527164c Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Thu, 19 Jan 2023 09:17:04 -0700 Subject: [PATCH 19/34] fix literal --- rel/d/a/d_a_do/d_a_do.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 46d91e09ca2..ee592aadb42 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -571,7 +571,6 @@ SECTION_RODATA static f32 const lit_3846 = 30.0f; COMPILER_STRIP_GATE(0x8066EE10, &lit_3846); /* 80668264-8066833C 000604 00D8+00 1/1 0/0 0/0 .text daDo_other_bg_check2__FP8do_classP4cXyz */ -#ifndef NONMATCHING static int daDo_other_bg_check2(do_class* i_dogP, cXyz* i_posP) { Vec dog_pos; // defining as cXyz moves the destructor above this function, breaking the TU Vec i_pos; // defining as cXyz moves the destructor above this function, breaking the TU @@ -584,10 +583,10 @@ static int daDo_other_bg_check2(do_class* i_dogP, cXyz* i_posP) { // do_class* dog = (do_class*)i_dogP; // required for match, maybe fake match? i_pos = *pos; - i_pos.y += 30.0f; + i_pos.y += FLOAT_LABEL(lit_3846); dog_pos = dog->current.pos; - dog_pos.y += 30.0f; + dog_pos.y += FLOAT_LABEL(lit_3846); lin_chk.Set((cXyz*)&dog_pos,(cXyz*)&i_pos,dog); if (dComIfG_Bgsp().LineCross(&lin_chk)) { @@ -596,16 +595,6 @@ static int daDo_other_bg_check2(do_class* i_dogP, cXyz* i_posP) { return 0; } } -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daDo_other_bg_check2(do_class* i_dogP, cXyz* i_posP) { - nofralloc -#include "asm/rel/d/a/d_a_do/d_a_do/daDo_other_bg_check2__FP8do_classP4cXyz.s" -} -#pragma pop -#endif /* ############################################################################################## */ /* 8066F278-8066F27C 000008 0001+03 3/3 0/0 0/0 .bss @1109 */ From ff44356585055b3b654b17372d012fc10bd78f31 Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Thu, 19 Jan 2023 16:57:30 -0700 Subject: [PATCH 20/34] do_walk_run --- include/rel/d/a/d_a_do/d_a_do.h | 69 ++++++++++++++++++++++----------- rel/d/a/d_a_do/d_a_do.cpp | 58 +++++++++++++++++++++++++-- 2 files changed, 101 insertions(+), 26 deletions(-) diff --git a/include/rel/d/a/d_a_do/d_a_do.h b/include/rel/d/a/d_a_do/d_a_do.h index b751c296da1..ed8904e6151 100644 --- a/include/rel/d/a/d_a_do/d_a_do.h +++ b/include/rel/d/a/d_a_do/d_a_do.h @@ -27,52 +27,76 @@ public: /* 0x5B5 */ u8 field_0x5b5; /* 0x5B6 */ u8 field_0x5b6; /* 0x5B7 */ u8 field_0x5b7[17]; - /* 0x5C8 */ float field_0x5c8; + /* 0x5C8 */ f32 field_0x5c8; /* 0x5CC */ s16 field_0x5cc; /* 0x5CE */ u8 field_0x5ce[2]; /* 0x5D8 */ mDoExt_McaMorf* mpMorf; /* 0x5D4 */ u8 field_0x5d4[8]; - /* 0x5DC */ u8 field_0x5dc[8]; + /* 0x5DC */ u8 field_0x5dc[2]; + /* 0x5DE */ s16 field_0x5de; + /* 0x5E0 */ s16 field_0x5e0; + /* 0x5E2 */ u8 field_0x5e2[2]; /* 0x5E4 */ s32 mResIdx; - /* 0x5E8 */ float field_0x5e8; - /* 0x5EC */ float field_0x5ec; - /* 0x5F0 */ u8 field_0x5f0[2]; + /* 0x5E8 */ f32 field_0x5e8; + /* 0x5EC */ f32 field_0x5ec; + /* 0x5F0 */ s16 field_0x5f0; /* 0x5F2 */ s16 mActionStatus; /* 0x5F4 */ u16 field_0x5f4; - /* 0x5F6 */ s16 mStayStatus; + /* 0x5F6 */ s16 mStayStatus; // probably a better name for this /* 0x5F8 */ u8 field_0x5f8[4]; /* 0x5FC */ s16 field_0x5fc; /* 0x5FE */ u8 field_0x5fe[2]; /* 0x600 */ s16 field_0x600; /* 0x602 */ u8 field_0x602[2]; /* 0x604 */ u16 field_0x604; - /* 0x606 */ u8 field_0x606[2]; - /* 0x608 */ float field_0x608; - /* 0x60C */ u8 field_0x60c[8]; + /* 0x606 */ s16 field_0x606; + /* 0x608 */ f32 field_0x608; + /* 0x60C */ u8 field_0x60c[2]; + /* 0x60E */ s16 field_0x60e; + /* 0x60E */ s16 field_0x610; + /* 0x60E */ s16 field_0x612; /* 0x614 */ s16 field_0x614; /* 0x616 */ u8 field_0x616; - /* 0x617 */ u8 field_0x617[29]; - /* 0x634 */ u32 field_0x634; - /* 0x638 */ u8 field_0x638[16]; + /* 0x617 */ u8 field_0x617[14]; + /* 0x624 */ s16 field_0x624; + /* 0x626 */ u8 field_0x626[2]; + /* 0x628 */ s16 field_0x628; + /* 0x62A */ s16 field_0x62a; + /* 0x62C */ u8 field_0x62c[2]; + /* 0x62E */ u16 field_0x62e; + /* 0x630 */ u16 field_0x630; + /* 0x632 */ s16 field_0x632; + /* 0x634 */ f32 field_0x634; + /* 0x638 */ f32 field_0x638; + /* 0x63C */ s16 field_0x63c; + /* 0x63E */ s16 field_0x63e; + /* 0x640 */ s16 field_0x640; + /* 0x642 */ u8 field_0x642[2]; // some weird alignmnet here /* 0x648 */ f32 field_0x648; - /* 0x64c */ u8 field_0x64c[12]; - /* 0x658 */ float field_0x658; - /* 0x65C */ float field_0x65c; - /* 0x660 */ u8 field_0x660[28]; - /* 0x67C */ float field_0x67c; - /* 0x680 */ u8 field_0x680[4]; + /* 0x64C */ f32 field_0x64c; + /* 0x650 */ f32 field_0x650; + /* 0x654 */ u8 field_0x654[4]; + /* 0x658 */ f32 field_0x658; + /* 0x65C */ f32 field_0x65c; + /* 0x660 */ u16 field_0x660; + /* 0x662 */ u8 field_0x662[26]; + /* 0x67C */ f32 field_0x67c; + /* 0x680 */ u32 field_0x680; /* 0x684 */ u32 mFoodBsPcId; /* 0x688 */ u8 field_0x688; /* 0x689 */ u8 field_0x689; /* 0x68A */ u8 field_0x68a; /* 0x68B */ u8 field_0x68b; - /* 0x68C */ float field_0x68c; - /* 0x690 */ float field_0x690; - /* 0x694 */ float field_0x694; + /* 0x68C */ f32 field_0x68c; + /* 0x690 */ f32 field_0x690; + /* 0x694 */ f32 field_0x694; /* 0x698 */ u8 field_0x698[36]; /* 0x6BC */ dBgS_AcchCir mBgS_AcchCir; /* 0x6FC */ dBgS_Acch mBgS_Acch; - /* 0x8D4 */ u8 field_0x8d4[24]; + /* 0x8D4 */ f32 field_0x8d4; + /* 0x8D8 */ u8 field_0x8d8[4]; + /* 0x8DC */ f32 field_0x8dc; + /* 0x8E0 */ u8 field_0x8e0[12]; /* 0x8EC */ dCcD_GStts mCcD_GStts; /* 0x90C */ u8 field_0x90c[4]; /* 0x910 */ dCcD_GObjInf mCcD_GObjInf1; @@ -86,6 +110,7 @@ public: /* 0xC05 */ s8 field_0xc05; /* 0xC06 */ s16 field_0xc06; /* 0xC08 */ s16 field_0xc08; + /* 0xC0A */ u8 field_0xc0a[2]; /* 0xC0C */ dMsgFlow_c mMsg; /* 0xC58 */ u8 field_0xc58[104]; /* 0xCC0 */ u8 field_0xcc0; diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index ee592aadb42..1aeca49d9fe 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -694,7 +694,18 @@ static u8 lit_3657[12]; /* 8066F2C4-8066F2E4 000054 0020+00 11/12 0/0 0/0 .bss l_HIO */ // likely is a more complicated struct that needs to be mapped -static f32 l_HIO[8]; +struct do_class_HIO { + /* 0x00 */ f32 field_0x00; + /* 0x04 */ f32 field_0x04; + /* 0x08 */ f32 field_0x08; + /* 0x0C */ f32 field_0x0c; + /* 0x10 */ f32 field_0x10; + /* 0x14 */ f32 field_0x14; + /* 0x18 */ f32 field_0x18; + /* 0x1C */ u8 field_0x1c; + /* 0x1D */ u8 field_0x1d; +}; +static do_class_HIO l_HIO; /* 8066F2E4-8066F2F8 000074 0014+00 1/2 0/0 0/0 .bss target_info */ static fopAc_ac_c* target_info[5]; @@ -886,8 +897,6 @@ static bool water_check(do_class* i_dogP) { } else { return 0; } - - } #else #pragma push @@ -1352,6 +1361,46 @@ COMPILER_STRIP_GATE(0x8066EEA4, &lit_4378); #pragma pop /* 8066973C-806698D0 001ADC 0194+00 1/1 0/0 0/0 .text do_walk_run__FP8do_class */ +#ifndef NONMATCHING +static void do_walk_run(do_class* i_dogP) { + i_dogP->field_0x616 = 1; + i_dogP->field_0x648 = FLOAT_LABEL(lit_4344); + + switch (i_dogP->mStayStatus) { + case 0: { + i_dogP->field_0x5e8 = FLOAT_LABEL(lit_4377); + + anm_init(i_dogP,22,FLOAT_LABEL(lit_4192),2,i_dogP->field_0x5e8); + i_dogP->mStayStatus++; + } + case 1: { + cLib_addCalc2(&i_dogP->field_0x5e8,FLOAT_LABEL(lit_3665),FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4345)); + i_dogP->mpMorf->setPlaySpeed(i_dogP->field_0x5e8); + + if (i_dogP->field_0x5e8 >= FLOAT_LABEL(lit_3665) ) { + i_dogP->mActionStatus = do_class::ACTION_STATUS_RUN; + i_dogP->mStayStatus = 0; + + + i_dogP->mSound.startSound(JAISoundID(327693),0,-1); + } + } + default: { + cLib_addCalc2(&i_dogP->mSpeedF, i_dogP->field_0x5e8 * l_HIO.field_0x0c, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4342) * l_HIO.field_0x0c); + cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->field_0x5cc,8,0x400); + + if (i_dogP->field_0x5c8 < FLOAT_LABEL(lit_4378) * i_dogP->field_0x67c) { + + l_HIO.field_0x1c != 0 ? i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_2 : i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_1; + i_dogP->mStayStatus = 0; + } + + area_check(i_dogP); + move_dansa_check(i_dogP,i_dogP->mSpeedF); + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1360,6 +1409,7 @@ static asm void do_walk_run(do_class* i_dogP) { #include "asm/rel/d/a/d_a_do/d_a_do/do_walk_run__FP8do_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066EEA8-8066EEAC 0000C0 0004+00 0/3 0/0 0/0 .rodata @4400 */ @@ -1723,7 +1773,7 @@ static void do_swim(do_class* i_dogP) { } } - cLib_addCalc2(&i_dogP->mSpeedF,l_HIO[5],FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4588)*l_HIO[5]); + cLib_addCalc2(&i_dogP->mSpeedF,l_HIO.field_0x14,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4588)*l_HIO.field_0x14); cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->field_0x5cc,16,0x100); i_dogP->mSpeed.y = FLOAT_LABEL(lit_3682); From 6f7d58a02c3b85b9cd6d89a7ee5e5e406f1c31ef Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Fri, 20 Jan 2023 11:42:52 -0700 Subject: [PATCH 21/34] do_run start --- rel/d/a/d_a_do/d_a_do.cpp | 53 +++++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 1aeca49d9fe..480ba709cf5 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -1361,7 +1361,6 @@ COMPILER_STRIP_GATE(0x8066EEA4, &lit_4378); #pragma pop /* 8066973C-806698D0 001ADC 0194+00 1/1 0/0 0/0 .text do_walk_run__FP8do_class */ -#ifndef NONMATCHING static void do_walk_run(do_class* i_dogP) { i_dogP->field_0x616 = 1; i_dogP->field_0x648 = FLOAT_LABEL(lit_4344); @@ -1400,16 +1399,6 @@ static void do_walk_run(do_class* i_dogP) { } } } -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void do_walk_run(do_class* i_dogP) { - nofralloc -#include "asm/rel/d/a/d_a_do/d_a_do/do_walk_run__FP8do_class.s" -} -#pragma pop -#endif /* ############################################################################################## */ /* 8066EEA8-8066EEAC 0000C0 0004+00 0/3 0/0 0/0 .rodata @4400 */ @@ -1462,6 +1451,47 @@ COMPILER_STRIP_GATE(0x8066EEC0, &lit_4406); #pragma pop /* 806698D0-80669A1C 001C70 014C+00 1/1 0/0 0/0 .text do_run__FP8do_class */ +#ifdef NONMATCHING +static void do_run(do_class* i_dogP) { + i_dogP->field_0x616 = 1; + i_dogP->field_0x648 = FLOAT_LABEL(lit_4400); + + switch (i_dogP->mStayStatus) { + case 0: { + i_dogP->field_0x5e8 = FLOAT_LABEL(lit_4377); + i_dogP->field_0x5ec = FLOAT_LABEL(lit_3662); + + anm_init(i_dogP,22,FLOAT_LABEL(lit_4192),2,i_dogP->field_0x5e8); + i_dogP->mStayStatus++; + } + case 1: { + cLib_addCalc2(&i_dogP->field_0x5e8,FLOAT_LABEL(lit_3665),FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4345)); + i_dogP->mpMorf->setPlaySpeed(i_dogP->field_0x5e8); + + if (i_dogP->field_0x5e8 >= FLOAT_LABEL(lit_3665) ) { + i_dogP->mActionStatus = do_class::ACTION_STATUS_RUN; + i_dogP->mStayStatus = 0; + + + // i_dogP->mSound.startSosund(JAISoundID(327693),0,-1); + } + } + default: { + cLib_addCalc2(&i_dogP->mSpeedF, i_dogP->field_0x5e8 * l_HIO.field_0x0c, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4342) * l_HIO.field_0x0c); + cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->field_0x5cc,8,0x400); + + if (i_dogP->field_0x5c8 < FLOAT_LABEL(lit_4378) * i_dogP->field_0x67c) { + + l_HIO.field_0x1c != 0 ? i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_2 : i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_1; + i_dogP->mStayStatus = 0; + } + + area_check(i_dogP); + move_dansa_check(i_dogP,i_dogP->mSpeedF); + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1470,6 +1500,7 @@ static asm void do_run(do_class* i_dogP) { #include "asm/rel/d/a/d_a_do/d_a_do/do_run__FP8do_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066EEC4-8066EEC8 0000DC 0004+00 0/1 0/0 0/0 .rodata @4435 */ From bf6a407b2cc041dee09171b9fc578453c8edb3d8 Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Fri, 20 Jan 2023 13:53:08 -0700 Subject: [PATCH 22/34] do_run --- rel/d/a/d_a_do/d_a_do.cpp | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 480ba709cf5..8ef33c08956 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -1451,41 +1451,31 @@ COMPILER_STRIP_GATE(0x8066EEC0, &lit_4406); #pragma pop /* 806698D0-80669A1C 001C70 014C+00 1/1 0/0 0/0 .text do_run__FP8do_class */ -#ifdef NONMATCHING +#ifndef NONMATCHING static void do_run(do_class* i_dogP) { i_dogP->field_0x616 = 1; i_dogP->field_0x648 = FLOAT_LABEL(lit_4400); switch (i_dogP->mStayStatus) { case 0: { - i_dogP->field_0x5e8 = FLOAT_LABEL(lit_4377); - i_dogP->field_0x5ec = FLOAT_LABEL(lit_3662); + i_dogP->field_0x5e8 = FLOAT_LABEL(lit_3662); + i_dogP->field_0x5ec = cM_rndF(FLOAT_LABEL(lit_4402))+FLOAT_LABEL(lit_4401); - anm_init(i_dogP,22,FLOAT_LABEL(lit_4192),2,i_dogP->field_0x5e8); + anm_init(i_dogP,14,FLOAT_LABEL(lit_3665),2,FLOAT_LABEL(lit_4403)*i_dogP->field_0x5e8); i_dogP->mStayStatus++; } case 1: { - cLib_addCalc2(&i_dogP->field_0x5e8,FLOAT_LABEL(lit_3665),FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4345)); + cLib_addCalc2(&i_dogP->field_0x5e8,i_dogP->field_0x5ec,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4404)); i_dogP->mpMorf->setPlaySpeed(i_dogP->field_0x5e8); - if (i_dogP->field_0x5e8 >= FLOAT_LABEL(lit_3665) ) { - i_dogP->mActionStatus = do_class::ACTION_STATUS_RUN; + if (i_dogP->field_0x5c8 < FLOAT_LABEL(lit_4405)*i_dogP->field_0x67c) { + i_dogP->mActionStatus = do_class::ACTION_STATUS_RUN_WALK; i_dogP->mStayStatus = 0; - - - // i_dogP->mSound.startSosund(JAISoundID(327693),0,-1); } } default: { - cLib_addCalc2(&i_dogP->mSpeedF, i_dogP->field_0x5e8 * l_HIO.field_0x0c, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4342) * l_HIO.field_0x0c); - cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->field_0x5cc,8,0x400); - - if (i_dogP->field_0x5c8 < FLOAT_LABEL(lit_4378) * i_dogP->field_0x67c) { - - l_HIO.field_0x1c != 0 ? i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_2 : i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_1; - i_dogP->mStayStatus = 0; - } - + cLib_addCalc2(&i_dogP->mSpeedF, i_dogP->field_0x5e8 * l_HIO.field_0x10 * FLOAT_LABEL(lit_4406), FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4342) * l_HIO.field_0x10); + cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->field_0x5cc,8,0x800); area_check(i_dogP); move_dansa_check(i_dogP,i_dogP->mSpeedF); } From c47f11e2ae66345183ffb331d093782ea7c4207f Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Fri, 20 Jan 2023 14:41:36 -0700 Subject: [PATCH 23/34] do_run_walk --- rel/d/a/d_a_do/d_a_do.cpp | 53 ++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 8ef33c08956..673ffaf35af 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -1451,7 +1451,6 @@ COMPILER_STRIP_GATE(0x8066EEC0, &lit_4406); #pragma pop /* 806698D0-80669A1C 001C70 014C+00 1/1 0/0 0/0 .text do_run__FP8do_class */ -#ifndef NONMATCHING static void do_run(do_class* i_dogP) { i_dogP->field_0x616 = 1; i_dogP->field_0x648 = FLOAT_LABEL(lit_4400); @@ -1481,16 +1480,6 @@ static void do_run(do_class* i_dogP) { } } } -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void do_run(do_class* i_dogP) { - nofralloc -#include "asm/rel/d/a/d_a_do/d_a_do/do_run__FP8do_class.s" -} -#pragma pop -#endif /* ############################################################################################## */ /* 8066EEC4-8066EEC8 0000DC 0004+00 0/1 0/0 0/0 .rodata @4435 */ @@ -1501,14 +1490,42 @@ COMPILER_STRIP_GATE(0x8066EEC4, &lit_4435); #pragma pop /* 80669A1C-80669B80 001DBC 0164+00 1/1 0/0 0/0 .text do_run_walk__FP8do_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void do_run_walk(do_class* i_dogP) { - nofralloc -#include "asm/rel/d/a/d_a_do/d_a_do/do_run_walk__FP8do_class.s" +static void do_run_walk(do_class* i_dogP) { + i_dogP->field_0x616 = 1; + i_dogP->field_0x648 = FLOAT_LABEL(lit_4344); + + switch (i_dogP->mStayStatus) { + case 0: { + i_dogP->field_0x5e8 = FLOAT_LABEL(lit_4336); + + anm_init(i_dogP,22,FLOAT_LABEL(lit_4194),2,i_dogP->field_0x5e8); + i_dogP->mStayStatus++; + } + case 1: { + cLib_addCalc2(&i_dogP->field_0x5e8,FLOAT_LABEL(lit_4401),FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4345)); + i_dogP->mpMorf->setPlaySpeed(i_dogP->field_0x5e8); + } + default: { + cLib_addCalc2(&i_dogP->mSpeedF, i_dogP->field_0x5e8 * l_HIO.field_0x0c, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4027)); + cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->field_0x5cc,8,0x400); + + if (i_dogP->field_0x5c8 < FLOAT_LABEL(lit_4378) * i_dogP->field_0x67c) { + + l_HIO.field_0x1c != 0 ? i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_2 : i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_1; + i_dogP->mStayStatus = 0; + + + } else { + if (i_dogP->field_0x5c8 > FLOAT_LABEL(lit_4435) * i_dogP->field_0x67c) { + i_dogP->mActionStatus = do_class::ACTION_STATUS_RUN; + i_dogP->mStayStatus = 0; + } + } + area_check(i_dogP); + move_dansa_check(i_dogP,i_dogP->mSpeedF); + } + } } -#pragma pop /* 80669B80-8066A1C4 001F20 0644+00 2/1 0/0 0/0 .text do_wait_1__FP8do_class */ #pragma push From 8dcee96cb7089607a24af69b3db7b8378b6c502a Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Sat, 21 Jan 2023 13:44:20 -0700 Subject: [PATCH 24/34] action checkpoint --- include/d/msg/d_msg_flow.h | 1 + include/rel/d/a/d_a_do/d_a_do.h | 35 ++- rel/d/a/d_a_do/d_a_do.cpp | 465 +++++++++++++++++++++++++++++--- 3 files changed, 451 insertions(+), 50 deletions(-) diff --git a/include/d/msg/d_msg_flow.h b/include/d/msg/d_msg_flow.h index 1e0b9075025..378fb187a10 100644 --- a/include/d/msg/d_msg_flow.h +++ b/include/d/msg/d_msg_flow.h @@ -160,6 +160,7 @@ public: void onNonStopJunpFlowFlag() { mNonStopJunpFlowFlag = 1; } int getSelectNum() { return query005(NULL, NULL, 0); } s16 getChoiceNo() { return mChoiceNo; } + void setMsg(u32 msg) { mMsg = msg; } static queryFunc mQueryList[53]; static eventFunc mEventList[43]; diff --git a/include/rel/d/a/d_a_do/d_a_do.h b/include/rel/d/a/d_a_do/d_a_do.h index ed8904e6151..ccc3c8b8c18 100644 --- a/include/rel/d/a/d_a_do/d_a_do.h +++ b/include/rel/d/a/d_a_do/d_a_do.h @@ -16,7 +16,17 @@ #include "SSystem/SComponent/c_phase.h" #include "Z2AudioLib/Z2SoundObject.h" - +struct do_class_HIO { + /* 0x00 */ f32 field_0x00; + /* 0x04 */ f32 field_0x04; + /* 0x08 */ f32 field_0x08; + /* 0x0C */ f32 field_0x0c; + /* 0x10 */ f32 field_0x10; + /* 0x14 */ f32 field_0x14; + /* 0x18 */ f32 field_0x18; + /* 0x1C */ u8 field_0x1c; + /* 0x1D */ u8 field_0x1d; +}; // this might actually inherit from npc_tr_class? class do_class : public fopAc_ac_c { @@ -27,15 +37,16 @@ public: /* 0x5B5 */ u8 field_0x5b5; /* 0x5B6 */ u8 field_0x5b6; /* 0x5B7 */ u8 field_0x5b7[17]; - /* 0x5C8 */ f32 field_0x5c8; - /* 0x5CC */ s16 field_0x5cc; + /* 0x5C8 */ f32 mDistFromPlayer; + /* 0x5CC */ s16 mAngleYFromPlayer; /* 0x5CE */ u8 field_0x5ce[2]; /* 0x5D8 */ mDoExt_McaMorf* mpMorf; /* 0x5D4 */ u8 field_0x5d4[8]; /* 0x5DC */ u8 field_0x5dc[2]; /* 0x5DE */ s16 field_0x5de; /* 0x5E0 */ s16 field_0x5e0; - /* 0x5E2 */ u8 field_0x5e2[2]; + /* 0x5E2 */ u8 field_0x5e2; + /* 0x5E3 */ u8 field_0x5e3; /* 0x5E4 */ s32 mResIdx; /* 0x5E8 */ f32 field_0x5e8; /* 0x5EC */ f32 field_0x5ec; @@ -51,13 +62,15 @@ public: /* 0x604 */ u16 field_0x604; /* 0x606 */ s16 field_0x606; /* 0x608 */ f32 field_0x608; - /* 0x60C */ u8 field_0x60c[2]; + /* 0x60C */ u16 field_0x60c; /* 0x60E */ s16 field_0x60e; /* 0x60E */ s16 field_0x610; /* 0x60E */ s16 field_0x612; /* 0x614 */ s16 field_0x614; /* 0x616 */ u8 field_0x616; - /* 0x617 */ u8 field_0x617[14]; + /* 0x617 */ u8 field_0x617; + /* 0x618 */ cXyz mUnkPos; // something to do with the dog's eye position + u8 alignment[4]; // remove later /* 0x624 */ s16 field_0x624; /* 0x626 */ u8 field_0x626[2]; /* 0x628 */ s16 field_0x628; @@ -76,12 +89,12 @@ public: /* 0x64C */ f32 field_0x64c; /* 0x650 */ f32 field_0x650; /* 0x654 */ u8 field_0x654[4]; - /* 0x658 */ f32 field_0x658; + /* 0x658 */ f32 mEyePosYDistFromPlayer; /* 0x65C */ f32 field_0x65c; /* 0x660 */ u16 field_0x660; /* 0x662 */ u8 field_0x662[26]; /* 0x67C */ f32 field_0x67c; - /* 0x680 */ u32 field_0x680; + /* 0x680 */ u32 field_0x680; // some proc ID /* 0x684 */ u32 mFoodBsPcId; /* 0x688 */ u8 field_0x688; /* 0x689 */ u8 field_0x689; @@ -90,7 +103,11 @@ public: /* 0x68C */ f32 field_0x68c; /* 0x690 */ f32 field_0x690; /* 0x694 */ f32 field_0x694; - /* 0x698 */ u8 field_0x698[36]; + /* 0x698 */ u8 field_0x698[22]; + /* 0x6AE */ u8 field_0x6ae; + /* 0x6AF */ u8 field_0x6af[9]; + /* 0x6B8 */ u8 field_0x6b8; + /* 0x6B9 */ u8 field_0x6b9[3]; /* 0x6BC */ dBgS_AcchCir mBgS_AcchCir; /* 0x6FC */ dBgS_Acch mBgS_Acch; /* 0x8D4 */ f32 field_0x8d4; diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 673ffaf35af..ed8cbd1540f 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -693,18 +693,6 @@ static u8 struct_8066F2B4[4]; static u8 lit_3657[12]; /* 8066F2C4-8066F2E4 000054 0020+00 11/12 0/0 0/0 .bss l_HIO */ -// likely is a more complicated struct that needs to be mapped -struct do_class_HIO { - /* 0x00 */ f32 field_0x00; - /* 0x04 */ f32 field_0x04; - /* 0x08 */ f32 field_0x08; - /* 0x0C */ f32 field_0x0c; - /* 0x10 */ f32 field_0x10; - /* 0x14 */ f32 field_0x14; - /* 0x18 */ f32 field_0x18; - /* 0x1C */ u8 field_0x1c; - /* 0x1D */ u8 field_0x1d; -}; static do_class_HIO l_HIO; /* 8066F2E4-8066F2F8 000074 0014+00 1/2 0/0 0/0 .bss target_info */ @@ -1041,11 +1029,11 @@ SECTION_RODATA static f32 const lit_4069 = 15.0f; COMPILER_STRIP_GATE(0x8066EE3C, &lit_4069); /* 80668B18-80668BA0 000EB8 0088+00 4/4 0/0 0/0 .text move_dansa_check__FP8do_classf */ -static int move_dansa_check(do_class* i_dogP, f32 param_1) { +static int move_dansa_check(do_class* i_dogP, f32 i_speed) { if (dansa_check2(i_dogP,FLOAT_LABEL(lit_4068)) != 0) { i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_1; - if (param_1 > FLOAT_LABEL(lit_4069)) { + if (i_speed > FLOAT_LABEL(lit_4069)) { i_dogP->mStayStatus = 10; } else { i_dogP->mStayStatus = 0; @@ -1144,7 +1132,7 @@ static void do_stay(do_class* i_dogP) { } } case 1: { - if (i_dogP->field_0x5fc == 0 && i_dogP->field_0x5c8 < l_HIO[6]) { + if (i_dogP->field_0x5fc == 0 && i_dogP->mDistFromPlayer < l_HIO[6]) { i_dogP->mStayStatus++; i_dogP->field_0x5fc = cM_rndF(50.0) + 20.f; // fix float literals // random number between 20 and 70 } @@ -1179,12 +1167,12 @@ static void do_stay(do_class* i_dogP) { i_dogP->field_0x614 = 0xe764; i_dogP->field_0x648 = 1000.0f; // fix float literals - if (i_dogP->field_0x658 > 30.0f) { + if (i_dogP->mEyePosYDistFromPlayer > 30.0f) { i_dogP->mStayStatus++; i_dogP->field_0x5fc = cM_rndF(10.0) + 10.f; // fix float literals // random number between 10 and 20 } - if (i_dogP->field_0x5c8 > l_HIO[6] + 100.0f) { // fix float literals + if (i_dogP->mDistFromPlayer > l_HIO[6] + 100.0f) { // fix float literals i_dogP->field_0x5f4 = 0; i_dogP->mStayStatus = 0; } @@ -1195,7 +1183,7 @@ static void do_stay(do_class* i_dogP) { i_dogP->field_0x614 = 0xe764; i_dogP->field_0x648 = 1500.0f; - if (i_dogP->field_0x658 > 30.0f) { + if (i_dogP->mEyePosYDistFromPlayer > 30.0f) { if (i_dogP->field_0x5fc == 0) { anm_init(i_dogP,11,0.0f,0,2.0f); // fix float literals i_dogP->mStayStatus = 13; @@ -1368,7 +1356,6 @@ static void do_walk_run(do_class* i_dogP) { switch (i_dogP->mStayStatus) { case 0: { i_dogP->field_0x5e8 = FLOAT_LABEL(lit_4377); - anm_init(i_dogP,22,FLOAT_LABEL(lit_4192),2,i_dogP->field_0x5e8); i_dogP->mStayStatus++; } @@ -1379,17 +1366,14 @@ static void do_walk_run(do_class* i_dogP) { if (i_dogP->field_0x5e8 >= FLOAT_LABEL(lit_3665) ) { i_dogP->mActionStatus = do_class::ACTION_STATUS_RUN; i_dogP->mStayStatus = 0; - - - i_dogP->mSound.startSound(JAISoundID(327693),0,-1); + i_dogP->mSound.startSound(JAISoundID(Z2SE_DOG_BARK),0,-1); } } default: { cLib_addCalc2(&i_dogP->mSpeedF, i_dogP->field_0x5e8 * l_HIO.field_0x0c, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4342) * l_HIO.field_0x0c); - cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->field_0x5cc,8,0x400); - - if (i_dogP->field_0x5c8 < FLOAT_LABEL(lit_4378) * i_dogP->field_0x67c) { + cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->mAngleYFromPlayer,8,0x400); + if (i_dogP->mDistFromPlayer < FLOAT_LABEL(lit_4378) * i_dogP->field_0x67c) { l_HIO.field_0x1c != 0 ? i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_2 : i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_1; i_dogP->mStayStatus = 0; } @@ -1459,7 +1443,6 @@ static void do_run(do_class* i_dogP) { case 0: { i_dogP->field_0x5e8 = FLOAT_LABEL(lit_3662); i_dogP->field_0x5ec = cM_rndF(FLOAT_LABEL(lit_4402))+FLOAT_LABEL(lit_4401); - anm_init(i_dogP,14,FLOAT_LABEL(lit_3665),2,FLOAT_LABEL(lit_4403)*i_dogP->field_0x5e8); i_dogP->mStayStatus++; } @@ -1467,14 +1450,14 @@ static void do_run(do_class* i_dogP) { cLib_addCalc2(&i_dogP->field_0x5e8,i_dogP->field_0x5ec,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4404)); i_dogP->mpMorf->setPlaySpeed(i_dogP->field_0x5e8); - if (i_dogP->field_0x5c8 < FLOAT_LABEL(lit_4405)*i_dogP->field_0x67c) { + if (i_dogP->mDistFromPlayer < FLOAT_LABEL(lit_4405)*i_dogP->field_0x67c) { i_dogP->mActionStatus = do_class::ACTION_STATUS_RUN_WALK; i_dogP->mStayStatus = 0; } } default: { cLib_addCalc2(&i_dogP->mSpeedF, i_dogP->field_0x5e8 * l_HIO.field_0x10 * FLOAT_LABEL(lit_4406), FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4342) * l_HIO.field_0x10); - cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->field_0x5cc,8,0x800); + cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->mAngleYFromPlayer,8,0x800); area_check(i_dogP); move_dansa_check(i_dogP,i_dogP->mSpeedF); } @@ -1497,7 +1480,6 @@ static void do_run_walk(do_class* i_dogP) { switch (i_dogP->mStayStatus) { case 0: { i_dogP->field_0x5e8 = FLOAT_LABEL(lit_4336); - anm_init(i_dogP,22,FLOAT_LABEL(lit_4194),2,i_dogP->field_0x5e8); i_dogP->mStayStatus++; } @@ -1507,20 +1489,18 @@ static void do_run_walk(do_class* i_dogP) { } default: { cLib_addCalc2(&i_dogP->mSpeedF, i_dogP->field_0x5e8 * l_HIO.field_0x0c, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4027)); - cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->field_0x5cc,8,0x400); - - if (i_dogP->field_0x5c8 < FLOAT_LABEL(lit_4378) * i_dogP->field_0x67c) { + cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->mAngleYFromPlayer,8,0x400); + if (i_dogP->mDistFromPlayer < FLOAT_LABEL(lit_4378) * i_dogP->field_0x67c) { l_HIO.field_0x1c != 0 ? i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_2 : i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_1; i_dogP->mStayStatus = 0; - - } else { - if (i_dogP->field_0x5c8 > FLOAT_LABEL(lit_4435) * i_dogP->field_0x67c) { + if (i_dogP->mDistFromPlayer > FLOAT_LABEL(lit_4435) * i_dogP->field_0x67c) { i_dogP->mActionStatus = do_class::ACTION_STATUS_RUN; i_dogP->mStayStatus = 0; } } + area_check(i_dogP); move_dansa_check(i_dogP,i_dogP->mSpeedF); } @@ -1675,7 +1655,7 @@ COMPILER_STRIP_GATE(0x8066EF04, &lit_4710); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void hang_set(do_class* i_dogP) { +static asm u16 hang_set(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/hang_set__FP8do_class.s" } @@ -1812,7 +1792,7 @@ static void do_swim(do_class* i_dogP) { } cLib_addCalc2(&i_dogP->mSpeedF,l_HIO.field_0x14,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4588)*l_HIO.field_0x14); - cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->field_0x5cc,16,0x100); + cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->mAngleYFromPlayer,16,0x100); i_dogP->mSpeed.y = FLOAT_LABEL(lit_3682); i_dogP->mGravity = FLOAT_LABEL(lit_3682); @@ -1898,7 +1878,7 @@ COMPILER_STRIP_GATE(0x8066EF50, &lit_5345); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_boat(do_class* i_dogP) { +static asm u8 do_boat(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_boat__FP8do_class.s" } @@ -1984,10 +1964,10 @@ static void do_message(do_class* i_dogP) { cLib_addCalc0(&i_dogP->mSpeedF,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_3665)); i_dogP->field_0x616 = 1; - cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->field_0x5cc,2,0x1000); + cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->mAngleYFromPlayer,2,0x1000); - if (i_dComIfGp_event_runCheck() == 0 && i_dogP->field_0x5c8 > FLOAT_LABEL(lit_3773)) { - i_dogP->mActionStatus = 0; + if (i_dComIfGp_event_runCheck() == 0 && i_dogP->mDistFromPlayer > FLOAT_LABEL(lit_3773)) { + i_dogP->mActionStatus = do_class::ACTION_STATUS_STAY; i_dogP->mStayStatus = 0; } @@ -2002,6 +1982,408 @@ COMPILER_STRIP_GATE(0x8066EF70, &lit_5948); #pragma pop /* 8066CEC4-8066DD48 005264 0E84+00 2/1 0/0 0/0 .text action__FP8do_class */ +#ifdef NONMATCHING +extern "C" u8 scc[12]; +static void action(do_class* i_dogP) { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + + i_dogP->mGravity = -7.0f; + i_dogP->mDistFromPlayer = fopAcM_searchPlayerDistance(i_dogP); + + if (daPy_getLinkPlayerActorClass()->checkHorseRide()) { + i_dogP->mDistFromPlayer -= 100.0f; + } + + i_dogP->mAngleYFromPlayer = fopAcM_searchPlayerAngleY(i_dogP); + i_dogP->mEyePosYDistFromPlayer = fabsf(i_dogP->mEyePos.y - player->current.pos.y); + + if (mDoCPd_c::getHoldR(PAD_1) || 50.0f < fabsf(i_dogP->current.pos.y - player->current.pos.y)) { + i_dogP->mEyePosYDistFromPlayer = 300.0f; + } + + i_dogP->mEyePosYDistFromPlayer *= 0.6f; + + u8 tmp1 = 1; + bool tmp2 = true; + bool tmp3 = true; + + i_dogP->mCcD_GObjInf1.OnCoSetBit(); + + if (i_dogP->field_0x608 < 1.0f) { + i_dogP->field_0xc05 = 0; + + switch(i_dogP->mActionStatus) { + case do_class::ACTION_STATUS_STAY: { + do_stay(i_dogP); + food_check(i_dogP); + i_dogP->field_0xc05 = 1; + break; + } + case do_class::ACTION_STATUS_WALK: { + do_walk(i_dogP); + food_check(i_dogP); + i_dogP->field_0xc05 = 1; + break; + } + case do_class::ACTION_STATUS_WALK_RUN: { + do_walk_run(i_dogP); + food_check(i_dogP); + i_dogP->field_0xc05 = 1; + break; + } + case do_class::ACTION_STATUS_RUN: { + do_run(i_dogP); + food_check(i_dogP); + i_dogP->field_0xc05 = 1; + break; + } + case do_class::ACTION_STATUS_RUN_WALK: { + do_run_walk(i_dogP); + food_check(i_dogP); + i_dogP->field_0xc05 = 1; + break; + } + case do_class::ACTION_STATUS_FOOD: { + do_food(i_dogP); + i_dogP->field_0xc05 = 1; + break; + } + case do_class::ACTION_STATUS_WAIT_1: { + do_wait_1(i_dogP); + food_check(i_dogP); + i_dogP->field_0xc05 = 1; + break; + } + case do_class::ACTION_STATUS_WAIT_2: { + do_wait_2(i_dogP); + food_check(i_dogP); + i_dogP->field_0xc05 = 1; + break; + } + case do_class::ACTION_STATUS_SIT: { + do_sit(i_dogP); + food_check(i_dogP); + i_dogP->field_0xc05 = 1; + break; + } + case do_class::ACTION_STATUS_A_SWIM: { + do_a_swim(i_dogP); + break; + } + case do_class::ACTION_STATUS_SWIM: { + do_swim(i_dogP); + tmp3 = false; + fopAcM_riverStream(0,0,0,0); + break; + } + case do_class::ACTION_STATUS_HELP: { + do_help(i_dogP); + break; + } + case do_class::ACTION_STATUS_BOAT: { + tmp1 = do_boat(i_dogP); + break; + } + case do_class::ACTION_STATUS_HANG: { + do_hang(i_dogP); + break; + } + case do_class::ACTION_STATUS_CARRY: { + do_carry(i_dogP); + i_dogP->mCcD_GObjInf1.OffCoSetBit(); + tmp2 = false; + break; + } + case do_class::ACTION_STATUS_MESSAGE: { + do_message(i_dogP); + i_dogP->field_0xc05 = 2; + } + } + } + + if (i_dogP->field_0x680 != -1 && i_dogP->mDistFromPlayer < i_dogP->field_0x67c * 160.0) { + daItem_c* item = (daItem_c*)fopAcM_SearchByID(i_dogP->field_0x680); + + if (item) { + item->endControl(); + } + + i_dogP->field_0x6b8 = 0; + i_dogP->field_0x680 = -1; + } + + if (i_dogP->field_0x6ae != 0) { + i_dogP->field_0x6ae--; + if (i_dogP->field_0x6ae == 0) { + i_dogP->mSound.startSound(JAISoundID(Z2SE_M007_DOG_COME_RUNNING),0,-1); + } + } + + if (i_dogP->field_0xc05 == 1 && daPy_py_c::i_checkNowWolf() && i_dogP->mDistFromPlayer < 300.0f) { + i_dogP->mActionStatus = do_class::ACTION_STATUS_MESSAGE; + i_dogP->mStayStatus = 0; + } + + if (tmp2 || 2.0 <= player->mSpeedF) {i_dogP->field_0x610 = cM_ssin(i_dogP->field_0x634 * 3000.0f); + cLib_offBit(i_dogP->mAttentionInfo.mFlags,0x80); + } else { + cLib_onBit(i_dogP->mAttentionInfo.mFlags,0x80); + + if (do_carry_check(i_dogP)) { + return; + } + } + + cLib_addCalcAngleS2(&i_dogP->current.angle.x,0,1,0x400); + + if (i_dogP->mActionStatus == do_class::ACTION_STATUS_HANG) { + if (i_dogP->field_0x608 < 1.0f) { + cXyz pos = i_dogP->current.pos; + int check = dansa_check(i_dogP,pos,pos.x); + + if ((-check & ~check) < 0) { + i_dogP->field_0x660 = hang_set(i_dogP); + + if (i_dogP->field_0x660 == 0xdcf) { + i_dogP->mActionStatus = do_class::ACTION_STATUS_HANG; + i_dogP->mStayStatus = 0; + i_dogP->field_0x63c = 0; + } + } + } + } else { + mDoMtx_YrotS((MtxP)calc_mtx,i_dogP->current.angle.y); + + cXyz pos1; + cXyz pos2; + cXyz pos3; + + pos1.x = 0.0f; + pos1.z = 0.0f; + pos1.y = l_HIO.field_0x10 * i_dogP->mSpeedF * 0.8f * i_dogP->field_0x67c; + + MtxPosition(&pos1,&pos2); + i_dogP->current.pos += pos2; + + if (i_dogP->mSpeed.y < -80.0f) { + i_dogP->mSpeed.y = -80.0f; + } + + if (fopAcM_checkCarryNow(i_dogP) && i_dogP->field_0x8d4 != 0.0f) { + i_dogP->current.pos.x += i_dogP->field_0x8d4 * 0.3f; + i_dogP->current.pos.z += i_dogP->field_0x8dc * 0.3f; + } + + if (1.0 < i_dogP->field_0x608) { + pos1.x = 0.0f; + pos1.y = 0.0f; + pos1.z = i_dogP->field_0x608; + + mDoMtx_YrotS((MtxP)calc_mtx,i_dogP->field_0x60c); + MtxPosition(&pos1,&pos2); + + i_dogP->current.pos += pos2; + cLib_addCalc0(&i_dogP->field_0x608,1.0,6.0); + + i_dogP->mSpeedF = 0.0; + tmp1 = 1; + } + if (tmp1 == 0) { + i_dogP->mBgS_AcchCir.SetWall(30.0f,fabsf(i_dogP->mSpeedF) + fabsf(i_dogP->field_0x608) + 30.0f); + i_dogP->mBgS_Acch.CrrPos(dComIfG_Bgsp()); + + if (i_dogP->mBgS_Acch.ChkGroundHit() && l_HIO.field_0x10 == 0 && fopAcM_checkCarryNow(i_dogP)) { + dBgS_GndChk gnd_chk; + + mDoMtx_YrotS((MtxP)calc_mtx,i_dogP->shape_angle.y); + + pos1.x = 0.0; + pos1.y = 0.0; + pos1.z = i_dogP->field_0x67c * -25.0; + + MtxPosition(&pos1,&pos2); + i_dogP->current.pos += pos2; + + pos3.x = pos2.x; + pos3.y = pos2.y + 100.0f; + pos3.z = pos2.z; + + gnd_chk.SetPos(&pos3); + pos2.y = dComIfG_Bgsp().GroundCross(&gnd_chk); + + pos1 = pos2 - i_dogP->current.pos; + + if (fabsf(pos1.y) < 50.0f) { + i_dogP->current.angle.x = cM_atan2s(pos1.y, JMAFastSqrt(pos1.x * pos1.x + pos1.z * pos1.z)); + } + } + } + } + + water_check(i_dogP); + + if (tmp3) { + if (i_dogP->mActionStatus == do_class::ACTION_STATUS_CARRY) { + if (i_dogP->field_0x63c != 0 && i_dogP->field_0x63c--, i_dogP->field_0x63c == 0) { + i_dogP->mActionStatus = do_class::ACTION_STATUS_A_SWIM; + i_dogP->mStayStatus = 0; + } + + if (45.0f < i_dogP->field_0x65c - i_dogP->current.pos.y) { + i_dogP->mActionStatus = do_class::ACTION_STATUS_SWIM; + i_dogP->mStayStatus = 0; + i_dogP->field_0x608 = 0.0f; + + if (i_dogP->field_0x606 == 0) { + + i_dogP->field_0x606 = 0x14; + cXyz pos = i_dogP->current.pos; + pos.y = i_dogP->field_0x65c; + + if (l_HIO.field_0x10 == 0) { + scc[0] = 0; // fix later + l_HIO.field_0x0c = 0.0f; + l_HIO.field_0x10 = 0.0f; + l_HIO.field_0x1c = 1; + } + + for (int i = 0; i < 4; i++) { + // wrong + i_dogP->mMsg.setMsg(dComIfGp_particle_set((u32)0,(u16)l_HIO.field_0x1c,&pos,&i_dogP->mTevStr,(csXyz*)0,(cXyz*)&scc,(u8)0xFF,(dPa_levelEcallBack *)0,(s8)-1,(GXColor*)0,(GXColor*)0,(cXyz*)0)); + } + + i_dogP->mSound.startSound(JAISoundID(Z2SE_CM_BODYFALL_WATER_S),0,-1); + } + } + } + } else { + i_dogP->field_0x63c = cM_rndF(25.0f) + 30.0f; + + if (i_dogP->field_0x65c - i_dogP->current.pos.y < 35.0f) { + i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_1; + i_dogP->mStayStatus = 0; + } + } + + cLib_addCalcAngleS2(&i_dogP->shape_angle.y,i_dogP->current.angle.y,2,0x2000); + cLib_addCalcAngleS2(&i_dogP->shape_angle.x,i_dogP->current.angle.x,4,0x1000); + i_dogP->shape_angle.z = i_dogP->current.angle.z; + + int tmp4 = 0; + int tmp5 = 0; + + if (i_dogP->field_0x616 != 0 || i_dogP->field_0x624 != 0) { + if (i_dogP->field_0x616 == 2) { + i_dogP->field_0x5f0 & 8U ? tmp4 = -10000 : tmp4 = 10000; + } else { + cXyz eyePosDiff; + + if (i_dogP->field_0x624 == 0) { + eyePosDiff = player->mEyePos - i_dogP->mEyePos; + + } else { + i_dogP->field_0x624++; + eyePosDiff = i_dogP->mUnkPos - i_dogP->mEyePos; + } + + eyePosDiff.y += i_dogP->field_0x67c * -16.0f; + + s16 some_angle = cM_atan2s(eyePosDiff.x,eyePosDiff.z) - i_dogP->shape_angle.y; + s16 some_angle2 = cM_atan2s(eyePosDiff.y,JMAFastSqrt(eyePosDiff.x * eyePosDiff.x + eyePosDiff.z * eyePosDiff.z)); + tmp5 = i_dogP->shape_angle.x + some_angle2; + + if (i_dogP->field_0x624 == 0 && some_angle > 24000 || some_angle < -24000) { + some_angle = 0; + } + + if (some_angle < 12001) { + if (some_angle < -12000) { + some_angle = -12000; + } + } else { + some_angle = 12000; + } + + if (tmp5 < 12001) { + if (tmp5 < -12000) { + tmp5 = -12000; + } + } else { + tmp5 = 12000; + } + + tmp4 = some_angle + i_dogP->field_0x614; + } + + i_dogP->field_0x616 = 0; + } + + cLib_addCalcAngleS2(&i_dogP->field_0x610,tmp4 / 2,4,0x2000); + cLib_addCalcAngleS2(&i_dogP->field_0x60e,tmp5 / 2,4,0x2000); + cLib_addCalcAngleS2(&i_dogP->field_0x614,0,2,0x300); + cLib_addCalcAngleS2(&i_dogP->field_0x628,i_dogP->field_0x62e,4,0x400); + cLib_addCalcAngleS2(&i_dogP->field_0x62a,i_dogP->field_0x630,4,0x400); + + if (2.0f <= fabsf(player->mSpeedF) || 2.0f <= fabsf(i_dogP->mSpeedF)) { + i_dogP->field_0x630 = 0; + i_dogP->field_0x62e = 0; + i_dogP->field_0x632 = cM_rndF(100.0) + 80.0f; + } else if (i_dogP->field_0x632 != 0 && i_dogP->field_0x632--, i_dogP->field_0x632 == 0) { + i_dogP->field_0x632 = cM_rndF(100.0) + 20.0f; + + if (cM_rndF(1.0) < 0.5) { + i_dogP->field_0x62e = cM_rndFX(2000.0); + } + + if (cM_rndF(1.0) < 0.5) { + i_dogP->field_0x630 = cM_rndFX(2000.0); + } + } + + if (0.025 <= i_dogP->field_0x634) { + if (l_HIO.field_0x1c == 0) { + i_dogP->field_0x612 = 0; + i_dogP->field_0x610 = 0; + } else { + i_dogP->field_0x610 = cM_ssin(i_dogP->field_0x634 * 3000.0f); + i_dogP->field_0x612 = cM_ssin(i_dogP->field_0x634 * 3000.0f); + } + } + + cLib_addCalc2(&i_dogP->field_0x634,i_dogP->field_0x638,1.0,0.15); + cLib_addCalc0(&i_dogP->field_0x638,1.0,0.04); + + i_dogP->field_0x640 = cM_ssin(i_dogP->field_0x648 * i_dogP->field_0x64c); + i_dogP->field_0x63e = cM_ssin(i_dogP->field_0x648 * i_dogP->field_0x650); + i_dogP->field_0x64c += i_dogP->field_0x648 * 2.0f; + + if (65536.0 < i_dogP->field_0x64c) { + i_dogP->field_0x64c -= 65536.0f; + } + + i_dogP->field_0x650 += i_dogP->field_0x648 * 1.5f; + + if (65536.0 < i_dogP->field_0x650) { + i_dogP->field_0x650 -= 65536.0f; + } + + cLib_addCalc2(&i_dogP->field_0x648,i_dogP->field_0x648,1.0,100.0); + i_dogP->field_0x648 = 0.0; + + if (i_dogP->field_0x5e2 == 0) { + if (i_dogP->field_0x5e0 == 0) { + i_dogP->field_0x5e0 = cM_rndF(100.0) + 30.0f; + } else { + i_dogP->field_0x5e0--; + i_dogP->field_0x5e0 < 6 ? i_dogP->field_0x5de = 5 - i_dogP->field_0x5e0 : i_dogP->field_0x5e0 = 0; + } + } else { + cLib_addCalcAngleS2(&i_dogP->field_0x5de,3,1,1); + i_dogP->field_0x5e2 = 0; + i_dogP->field_0x5e0 = 0x3c; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -2010,6 +2392,7 @@ static asm void action(do_class* i_dogP) { #include "asm/rel/d/a/d_a_do/d_a_do/action__FP8do_class.s" } #pragma pop +#endif /* 8066DD48-8066DE64 0060E8 011C+00 1/1 0/0 0/0 .text message__FP8do_class */ static void message(do_class* i_dogP) { From 014b36877f43f0fbe087e6256900db0ccf6a0883 Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Sun, 22 Jan 2023 10:38:04 -0700 Subject: [PATCH 25/34] daDo_HIO_c --- include/rel/d/a/d_a_do/d_a_do.h | 224 ++++--- rel/d/a/d_a_do/d_a_do.cpp | 1078 +++++++++++++++++-------------- 2 files changed, 712 insertions(+), 590 deletions(-) diff --git a/include/rel/d/a/d_a_do/d_a_do.h b/include/rel/d/a/d_a_do/d_a_do.h index ccc3c8b8c18..7b4a76eafab 100644 --- a/include/rel/d/a/d_a_do/d_a_do.h +++ b/include/rel/d/a/d_a_do/d_a_do.h @@ -16,112 +16,167 @@ #include "SSystem/SComponent/c_phase.h" #include "Z2AudioLib/Z2SoundObject.h" -struct do_class_HIO { - /* 0x00 */ f32 field_0x00; - /* 0x04 */ f32 field_0x04; - /* 0x08 */ f32 field_0x08; - /* 0x0C */ f32 field_0x0c; - /* 0x10 */ f32 field_0x10; - /* 0x14 */ f32 field_0x14; - /* 0x18 */ f32 field_0x18; - /* 0x1C */ u8 field_0x1c; - /* 0x1D */ u8 field_0x1d; +enum daDo_Anm { + ANM_BULBUL = 6, + ANM_CARRY_B, + ANM_CLIFF, + ANM_CLIFF_WT, + ANM_DEFEND, + ANM_DOWN, + ANM_DOWN_WT, + ANM_JOYFUL, + ANM_RUN, + ANM_SIT, + ANM_SIT_WAIT, + ANM_STEP, + ANM_STEP_2, + ANM_SWIM, + ANM_TO_CARRY_B, + ANM_WAIT, + ANM_WALK }; -// this might actually inherit from npc_tr_class? -class do_class : public fopAc_ac_c { +enum daDo_Action { + ACT_STAY, + ACT_WALK, + ACT_WALK_RUN, + ACT_RUN, + ACT_RUN_WALK, + ACT_FOOD, + ACT_WAIT_1, + ACT_WAIT_2, + ACT_SIT, + ACT_A_SWIM = 10, + ACT_SWIM = 20, + ACT_HELP, + ACT_BOAT, + ACT_HANG = 30, + ACT_CARRY = 35, + ACT_MESSAGE = 39 +}; + +struct daDo_HIO_tmp { + /* 0x00 */ u8 field_0x00[4]; + /* 0x04 */ s8 field_0x04; + /* 0x05 */ u8 field_0x05[3]; + /* 0x08 */ f32 mBaseSize; + /* 0x0C */ f32 mWalkSpeed; + /* 0x10 */ f32 mRunSpeed; + /* 0x14 */ f32 mSwimSpeed; + /* 0x18 */ f32 mPlayerRecogniztionDist; + /* 0x1C */ u8 field_0x1c; + /* 0x1D */ u8 mSwimming; + /* 0x1E */ u16 mWaterHuntAnimType; +}; + +struct some_class { + +}; + +class daDo_HIO_c : public some_class { +public: +/* 80667D4C */ daDo_HIO_c(); +/* 8066ED40 */ virtual ~daDo_HIO_c(); + +public: +/* 0x04 */ s8 field_0x04; +/* 0x05 */ u8 field_0x05[3]; +/* 0x08 */ f32 mBaseSize; +/* 0x0C */ f32 mWalkSpeed; +/* 0x10 */ f32 mRunSpeed; +/* 0x14 */ f32 mSwimSpeed; +/* 0x18 */ f32 mPlayerRecogniztionDist; +/* 0x1C */ u8 field_0x1c; +/* 0x1D */ u8 mSwimming; +/* 0x1E */ u16 mWaterHuntAnimType; +}; + +class do_class : public fopEn_enemy_c { public: - /* 0x56C */ u8 field_0x56c[68]; /* 0x5AC */ request_of_phase_process_class mPhase; /* 0x5B4 */ u8 field_0x5b4; /* 0x5B5 */ u8 field_0x5b5; /* 0x5B6 */ u8 field_0x5b6; - /* 0x5B7 */ u8 field_0x5b7[17]; + /* 0x5B7 */ u8 field_0x5b7; + /* 0x5B8 */ cXyz field_0x588; + /* 0x5C4 */ u8 field_0x5c4[4]; /* 0x5C8 */ f32 mDistFromPlayer; /* 0x5CC */ s16 mAngleYFromPlayer; /* 0x5CE */ u8 field_0x5ce[2]; /* 0x5D8 */ mDoExt_McaMorf* mpMorf; - /* 0x5D4 */ u8 field_0x5d4[8]; - /* 0x5DC */ u8 field_0x5dc[2]; + /* 0x5D4 */ mDoExt_btkAnm* mpBtk; + /* 0x5D8 */ mDoExt_btpAnm* mpBtp; + /* 0x5DC */ s8 field_0x5dc; + /* 0x5DD */ u8 field_0x5dd; /* 0x5DE */ s16 field_0x5de; /* 0x5E0 */ s16 field_0x5e0; /* 0x5E2 */ u8 field_0x5e2; /* 0x5E3 */ u8 field_0x5e3; - /* 0x5E4 */ s32 mResIdx; + /* 0x5E4 */ u32 mAnmID; /* 0x5E8 */ f32 field_0x5e8; /* 0x5EC */ f32 field_0x5ec; /* 0x5F0 */ s16 field_0x5f0; - /* 0x5F2 */ s16 mActionStatus; + /* 0x5F2 */ s16 mAction; /* 0x5F4 */ u16 field_0x5f4; /* 0x5F6 */ s16 mStayStatus; // probably a better name for this - /* 0x5F8 */ u8 field_0x5f8[4]; - /* 0x5FC */ s16 field_0x5fc; - /* 0x5FE */ u8 field_0x5fe[2]; - /* 0x600 */ s16 field_0x600; - /* 0x602 */ u8 field_0x602[2]; + /* 0x5F8 */ u32 mShadowKey; + /* 0x5FC */ s16 field_0x5fc[4]; /* 0x604 */ u16 field_0x604; /* 0x606 */ s16 field_0x606; /* 0x608 */ f32 field_0x608; - /* 0x60C */ u16 field_0x60c; - /* 0x60E */ s16 field_0x60e; - /* 0x60E */ s16 field_0x610; - /* 0x60E */ s16 field_0x612; + /* 0x60C */ s16 field_0x60c; + /* 0x60E */ csXyz field_0x60e; /* 0x614 */ s16 field_0x614; /* 0x616 */ u8 field_0x616; /* 0x617 */ u8 field_0x617; /* 0x618 */ cXyz mUnkPos; // something to do with the dog's eye position - u8 alignment[4]; // remove later /* 0x624 */ s16 field_0x624; - /* 0x626 */ u8 field_0x626[2]; - /* 0x628 */ s16 field_0x628; - /* 0x62A */ s16 field_0x62a; - /* 0x62C */ u8 field_0x62c[2]; - /* 0x62E */ u16 field_0x62e; - /* 0x630 */ u16 field_0x630; - /* 0x632 */ s16 field_0x632; - /* 0x634 */ f32 field_0x634; - /* 0x638 */ f32 field_0x638; /* 0x63C */ s16 field_0x63c; - /* 0x63E */ s16 field_0x63e; - /* 0x640 */ s16 field_0x640; - /* 0x642 */ u8 field_0x642[2]; // some weird alignmnet here + /* 0x63E */ csXyz field_0x63e; + /* 0x644 */ f32 field_0x644; + /* 0x000 */ u8 field_0x000[20]; // some alignment issue here /* 0x648 */ f32 field_0x648; /* 0x64C */ f32 field_0x64c; /* 0x650 */ f32 field_0x650; - /* 0x654 */ u8 field_0x654[4]; + /* 0x654 */ s16 field_0x654; + /* 0x656 */ s16 field_0x656; /* 0x658 */ f32 mEyePosYDistFromPlayer; /* 0x65C */ f32 field_0x65c; - /* 0x660 */ u16 field_0x660; - /* 0x662 */ u8 field_0x662[26]; - /* 0x67C */ f32 field_0x67c; - /* 0x680 */ u32 field_0x680; // some proc ID - /* 0x684 */ u32 mFoodBsPcId; + /* 0x660 */ s16 field_0x660; + /* 0x662 */ u8 field_0x662[2]; + /* 0x664 */ cXyz field_0x664; + /* 0x670 */ f32 field_0x670; + /* 0x674 */ cXyz field_0x674; + /* 0x680 */ u32 mItemActorID; + /* 0x684 */ u32 mFoodActorID; /* 0x688 */ u8 field_0x688; /* 0x689 */ u8 field_0x689; /* 0x68A */ u8 field_0x68a; /* 0x68B */ u8 field_0x68b; - /* 0x68C */ f32 field_0x68c; - /* 0x690 */ f32 field_0x690; - /* 0x694 */ f32 field_0x694; - /* 0x698 */ u8 field_0x698[22]; - /* 0x6AE */ u8 field_0x6ae; - /* 0x6AF */ u8 field_0x6af[9]; + /* 0x68C */ cXyz field_0x68c; + /* 0x698 */ cXyz field_0x698; + /* 0x6A4 */ u8 field_0x6a4[10]; + /* 0x6AE */ s8 field_0x6ae; + /* 0x6B0 */ s16 field_0x6b0; + /* 0x6B2 */ u8 field_0x6b2[2]; + /* 0x6B4 */ f32 field_0x6b4; /* 0x6B8 */ u8 field_0x6b8; /* 0x6B9 */ u8 field_0x6b9[3]; /* 0x6BC */ dBgS_AcchCir mBgS_AcchCir; - /* 0x6FC */ dBgS_Acch mBgS_Acch; - /* 0x8D4 */ f32 field_0x8d4; - /* 0x8D8 */ u8 field_0x8d8[4]; - /* 0x8DC */ f32 field_0x8dc; - /* 0x8E0 */ u8 field_0x8e0[12]; - /* 0x8EC */ dCcD_GStts mCcD_GStts; - /* 0x90C */ u8 field_0x90c[4]; - /* 0x910 */ dCcD_GObjInf mCcD_GObjInf1; - /* 0xA14 */ u8 field_0xa14[52]; - /* 0xA48 */ dCcD_GObjInf mCcD_GObjInf2; - /* 0xB4C */ u8 field_0xb4c[128]; + /* 0x6FC */ dBgS_ObjAcch mBgS_Acch; + /* 0x8D4 */ dCcD_Stts mStts; + /* 0x910 */ dCcD_Sph mCcSph1; + /* 0xA48 */ dCcD_Sph mCcSph2; + /* 0xB80 */ cXyz field_0xb80; + /* 0xB8C */ cXyz field_0xb8c; + /* 0xB98 */ cXyz field_0xb98; + /* 0xBA4 */ cXyz field_0xba4; + /* 0xBB0 */ cXyz field_0xbb0; + /* 0xBBC */ cXyz field_0xbbc; + /* 0xBC8 */ u8 field_0xb4c[4]; /* 0xBCC */ u32 field_0xbcc; - /* 0xBD0 */ u8 field_0xbd0[20]; + /* 0xBD0 */ u8 field_0xbd0[4]; + /* 0xBD4 */ u32 field_0xbd4[4]; /* 0xBE4 */ Z2SoundObjSimple mSound; /* 0xC04 */ u8 field_0xc04; /* 0xC05 */ s8 field_0xc05; @@ -129,44 +184,19 @@ public: /* 0xC08 */ s16 field_0xc08; /* 0xC0A */ u8 field_0xc0a[2]; /* 0xC0C */ dMsgFlow_c mMsg; - /* 0xC58 */ u8 field_0xc58[104]; + /* 0xC58 */ u8 field_0xc58[40]; + /* 0xC80 */ u8 field_0xc80; + /* 0xC81 */ u8 field_0xc81[3]; + /* 0xC84 */ cXyz field_0xc84; + /* 0xC90 */ cXyz field_0xc90; + /* 0xC9C */ cXyz field_0xc9c; + /* 0xCA8 */ cXyz field_0xca8; + /* 0xCB4 */ cXyz field_0xcb4; /* 0xCC0 */ u8 field_0xcc0; public: - enum { - ACTION_STATUS_STAY, - ACTION_STATUS_WALK, - ACTION_STATUS_WALK_RUN, - ACTION_STATUS_RUN, - ACTION_STATUS_RUN_WALK, - ACTION_STATUS_FOOD, - ACTION_STATUS_WAIT_1, - ACTION_STATUS_WAIT_2, - ACTION_STATUS_SIT, - ACTION_STATUS_A_SWIM = 10, - ACTION_STATUS_SWIM = 20, - ACTION_STATUS_HELP, - ACTION_STATUS_BOAT, - ACTION_STATUS_HANG = 30, - ACTION_STATUS_CARRY = 35, - ACTION_STATUS_MESSAGE = 39 - }; - /* 8066EAE4 */ do_class(); }; -class daDo_HIO_c : public do_class { -private: -/* 0x14 */ u32 field_0x14; -/* 0x18 */ u32 field_0x18; -/* 0x1C */ u8 field_0x1c; -/* 0x1D */ u8 field_0x1d; -/* 0x1E */ u16 field_0x1e; - -public: - /* 80667D4C */ daDo_HIO_c(); - /* 8066ED40 */ virtual ~daDo_HIO_c() {}; -}; - #endif /* D_A_DO_H */ diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index ed8cbd1540f..5692631b24d 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -387,21 +387,17 @@ SECTION_DATA extern void* __vt__10daDo_HIO_c[3] = { }; /* 80667D4C-80667DA8 0000EC 005C+00 1/1 0/0 0/0 .text __ct__10daDo_HIO_cFv */ -#ifdef NONMATCHING +#ifndef NONMATCHING daDo_HIO_c::daDo_HIO_c() { - f32 value1 = FLOAT_LABEL(lit_3662); - f32 value2 = FLOAT_LABEL(lit_3663); - f32 value3 = FLOAT_LABEL(lit_3664); - f32 value4 = FLOAT_LABEL(lit_3664); - setAttribute(-1); - setEnd(0x3f800000); - setRate(value1); - setFrame(value2); - field_0x14 = value3; - field_0x18 = value4; + field_0x04 = -1; + mBaseSize = FLOAT_LABEL(lit_3662); + mWalkSpeed = FLOAT_LABEL(lit_3663); + mRunSpeed = FLOAT_LABEL(lit_3664); + mSwimSpeed = FLOAT_LABEL(lit_3665); + mPlayerRecogniztionDist = FLOAT_LABEL(lit_3666); field_0x1c = 0; - field_0x1d = 0; - field_0x1e = 1; + mSwimming = 1; + mWaterHuntAnimType = 0; } #else #pragma push @@ -445,7 +441,7 @@ static void anm_init(do_class* i_dogP, int i_resIdx, f32 param_2, u8 param_3, f3 if (!(i_dogP->field_0x608 > FLOAT_LABEL(lit_3662))) { i_dogP->mpMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Do", i_resIdx), param_3, param_2, param_4, FLOAT_LABEL(lit_3682), FLOAT_LABEL(lit_3683), 0); - i_dogP->mResIdx = i_resIdx; + i_dogP->mAnmID = (daDo_Anm)i_resIdx; } } @@ -693,7 +689,7 @@ static u8 struct_8066F2B4[4]; static u8 lit_3657[12]; /* 8066F2C4-8066F2E4 000054 0020+00 11/12 0/0 0/0 .bss l_HIO */ -static do_class_HIO l_HIO; +static daDo_HIO_tmp l_HIO; /* 8066F2E4-8066F2F8 000074 0014+00 1/2 0/0 0/0 .bss target_info */ static fopAc_ac_c* target_info[5]; @@ -775,7 +771,7 @@ static u32 search_food(do_class* i_dogP) { i++; pos_check += 100.0f; - } while (pos_check <= i_dogP->field_0x67c * 240.0f); + } while (pos_check <= i_dogP->field_0x674.z * 240.0f); } else { ret = -1; } @@ -795,18 +791,18 @@ static asm u32 search_food(do_class* i_dogP) { /* 8066858C-806685EC 00092C 0060+00 1/1 0/0 0/0 .text food_check__FP8do_class */ static void food_check(do_class* i_dogP) { - i_dogP->mFoodBsPcId = search_food(i_dogP); + i_dogP->mFoodActorID = search_food(i_dogP); - if (fopAcM_SearchByID(i_dogP->mFoodBsPcId)) { - i_dogP->mActionStatus = do_class::ACTION_STATUS_FOOD; + if (fopAcM_SearchByID(i_dogP->mFoodActorID)) { + i_dogP->mAction = ACT_FOOD; i_dogP->mStayStatus = 0; } } /* 806685EC-80668624 00098C 0038+00 1/1 0/0 0/0 .text do_carry_check__FP8do_class */ static int do_carry_check(do_class* i_dogP) { - if (i_dogP->mActionStatus != do_class::ACTION_STATUS_CARRY && fopAcM_checkCarryNow(i_dogP)) { - i_dogP->mActionStatus = do_class::ACTION_STATUS_CARRY; + if (i_dogP->mAction != ACT_CARRY && fopAcM_checkCarryNow(i_dogP)) { + i_dogP->mAction = ACT_CARRY; i_dogP->mStayStatus = 0; return 1; } @@ -845,7 +841,7 @@ static BOOL depth_check(do_class* i_dogP, cXyz i_pos, f32 param_2) { sub_res = f_gnd_chk_spl - f_gnd_chk; mul_res = FLOAT_LABEL(lit_3665) * param_2 * FLOAT_LABEL(lit_3981); - f_res = mul_res * i_dogP->field_0x67c; + f_res = mul_res * i_dogP->field_0x674.z; if (sub_res > f_res) { return 1; @@ -878,7 +874,7 @@ static bool water_check(do_class* i_dogP) { gnd_chk_spl.SetPos(&pos); i_dogP->field_0x65c = dComIfG_Bgsp().GroundCross(&gnd_chk_spl); f32 sub_res = i_dogP->field_0x65c - f_gnd_chk; - f32 mul_res = FLOAT_LABEL(lit_3994) * i_dogP->field_0x67c; + f32 mul_res = FLOAT_LABEL(lit_3994) * i_dogP->field_0x674.z; if (sub_res > mul_res) { return 1; @@ -996,11 +992,11 @@ static bool dansa_check2(do_class* i_dogP, f32 param_1) { pos.x = FLOAT_LABEL(lit_3682); pos.y = FLOAT_LABEL(lit_4057); - f32 tmp = i_dogP->field_0x67c; + f32 tmp = i_dogP->field_0x674.z; f32 tmp1 = FLOAT_LABEL(lit_3981) * param_1; f32 tmp3 = tmp1 * tmp; - f32 tmp2 = FLOAT_LABEL(lit_4058) * i_dogP->mSpeedF * i_dogP->field_0x67c * FLOAT_LABEL(lit_3981); + f32 tmp2 = FLOAT_LABEL(lit_4058) * i_dogP->mSpeedF * i_dogP->field_0x674.z * FLOAT_LABEL(lit_3981); pos.z = tmp3 + tmp2; @@ -1031,7 +1027,7 @@ COMPILER_STRIP_GATE(0x8066EE3C, &lit_4069); /* 80668B18-80668BA0 000EB8 0088+00 4/4 0/0 0/0 .text move_dansa_check__FP8do_classf */ static int move_dansa_check(do_class* i_dogP, f32 i_speed) { if (dansa_check2(i_dogP,FLOAT_LABEL(lit_4068)) != 0) { - i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_1; + i_dogP->mAction = ACT_WAIT_1; if (i_speed > FLOAT_LABEL(lit_4069)) { i_dogP->mStayStatus = 10; @@ -1090,7 +1086,7 @@ static void area_check(do_class* i_dogP) { if (i_dogP->field_0x5b6 != 255) { if ((i_dogP->field_0x5b6 * 100.f * 2.0f) > pos_delta.abs()) { - i_dogP->mActionStatus = do_class::ACTION_STATUS_WALK; + i_dogP->mAction = ACT_WALK; i_dogP->mStayStatus = -1; i_dogP->field_0x600 = cM_rndF(100.0f) + 100.0f; // random value between 100 and 200 } @@ -1122,17 +1118,17 @@ static void do_stay(do_class* i_dogP) { switch (i_dogP->mStayStatus) { case 0: { if (i_dogP->field_0x5b4 == 0) { - anm_init(i_dogP,12,0.0f,2,2.0f); // fix float literals + anm_init(i_dogP,12,0.0f,2,FLOAT_LABEL(lit_3662)); // fix float literals i_dogP->mStayStatus++; i_dogP->field_0x5fc = 10; } else { - i_dogP->mActionStatus = do_class::ACTION_STATUS_WALK; + i_dogP->mAction = ACT_WALK; i_dogP->mStayStatus = 0; return; } } case 1: { - if (i_dogP->field_0x5fc == 0 && i_dogP->mDistFromPlayer < l_HIO[6]) { + if (i_dogP->field_0x5fc == 0 && i_dogP->mDistFromPlayer < l_HIO.mRunSpeed) { i_dogP->mStayStatus++; i_dogP->field_0x5fc = cM_rndF(50.0) + 20.f; // fix float literals // random number between 20 and 70 } @@ -1153,7 +1149,7 @@ static void do_stay(do_class* i_dogP) { i_dogP->field_0x648 = 2000.0f; // fix float literals if (i_dogP->mpMorf->isStop()) { - i_dogP->mActionStatus = do_class::ACTION_STATUS_WALK_RUN; + i_dogP->mAction = ACT_WALK_RUN; i_dogP->mStayStatus = 0; } break; @@ -1172,7 +1168,7 @@ static void do_stay(do_class* i_dogP) { i_dogP->field_0x5fc = cM_rndF(10.0) + 10.f; // fix float literals // random number between 10 and 20 } - if (i_dogP->mDistFromPlayer > l_HIO[6] + 100.0f) { // fix float literals + if (i_dogP->mDistFromPlayer > l_HIO.mRunSpeed + 100.0f) { // fix float literals i_dogP->field_0x5f4 = 0; i_dogP->mStayStatus = 0; } @@ -1198,7 +1194,7 @@ static void do_stay(do_class* i_dogP) { i_dogP->field_0x648 = 1500.0f; // fix float literals if (i_dogP->mpMorf->isStop()) { - i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_1; + i_dogP->mAction = ACT_WAIT_1; i_dogP->mStayStatus = 0; } } @@ -1324,6 +1320,11 @@ COMPILER_STRIP_GATE(0x8066EE9C, &lit_4345); #pragma pop /* 80669050-8066973C 0013F0 06EC+00 2/1 0/0 0/0 .text do_walk__FP8do_class */ +#ifdef NONMATCHING +static void do_walk(do_class* i_dogP) { + +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1332,6 +1333,7 @@ static asm void do_walk(do_class* i_dogP) { #include "asm/rel/d/a/d_a_do/d_a_do/do_walk__FP8do_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066EEA0-8066EEA4 0000B8 0004+00 0/1 0/0 0/0 .rodata @4377 */ @@ -1364,17 +1366,17 @@ static void do_walk_run(do_class* i_dogP) { i_dogP->mpMorf->setPlaySpeed(i_dogP->field_0x5e8); if (i_dogP->field_0x5e8 >= FLOAT_LABEL(lit_3665) ) { - i_dogP->mActionStatus = do_class::ACTION_STATUS_RUN; + i_dogP->mAction = ACT_RUN; i_dogP->mStayStatus = 0; i_dogP->mSound.startSound(JAISoundID(Z2SE_DOG_BARK),0,-1); } } default: { - cLib_addCalc2(&i_dogP->mSpeedF, i_dogP->field_0x5e8 * l_HIO.field_0x0c, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4342) * l_HIO.field_0x0c); + cLib_addCalc2(&i_dogP->mSpeedF, i_dogP->field_0x5e8 * l_HIO.mWalkSpeed, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4342) * l_HIO.mWalkSpeed); cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->mAngleYFromPlayer,8,0x400); - if (i_dogP->mDistFromPlayer < FLOAT_LABEL(lit_4378) * i_dogP->field_0x67c) { - l_HIO.field_0x1c != 0 ? i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_2 : i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_1; + if (i_dogP->mDistFromPlayer < FLOAT_LABEL(lit_4378) * i_dogP->field_0x674.z) { + l_HIO.field_0x1c != 0 ? i_dogP->mAction = ACT_WAIT_2 : i_dogP->mAction = ACT_WAIT_1; i_dogP->mStayStatus = 0; } @@ -1450,13 +1452,13 @@ static void do_run(do_class* i_dogP) { cLib_addCalc2(&i_dogP->field_0x5e8,i_dogP->field_0x5ec,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4404)); i_dogP->mpMorf->setPlaySpeed(i_dogP->field_0x5e8); - if (i_dogP->mDistFromPlayer < FLOAT_LABEL(lit_4405)*i_dogP->field_0x67c) { - i_dogP->mActionStatus = do_class::ACTION_STATUS_RUN_WALK; + if (i_dogP->mDistFromPlayer < FLOAT_LABEL(lit_4405)*i_dogP->field_0x674.z) { + i_dogP->mAction = ACT_RUN_WALK; i_dogP->mStayStatus = 0; } } default: { - cLib_addCalc2(&i_dogP->mSpeedF, i_dogP->field_0x5e8 * l_HIO.field_0x10 * FLOAT_LABEL(lit_4406), FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4342) * l_HIO.field_0x10); + cLib_addCalc2(&i_dogP->mSpeedF, i_dogP->field_0x5e8 * l_HIO.mRunSpeed * FLOAT_LABEL(lit_4406), FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4342) * l_HIO.mRunSpeed); cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->mAngleYFromPlayer,8,0x800); area_check(i_dogP); move_dansa_check(i_dogP,i_dogP->mSpeedF); @@ -1488,15 +1490,15 @@ static void do_run_walk(do_class* i_dogP) { i_dogP->mpMorf->setPlaySpeed(i_dogP->field_0x5e8); } default: { - cLib_addCalc2(&i_dogP->mSpeedF, i_dogP->field_0x5e8 * l_HIO.field_0x0c, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4027)); + cLib_addCalc2(&i_dogP->mSpeedF, i_dogP->field_0x5e8 * l_HIO.mWalkSpeed, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4027)); cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->mAngleYFromPlayer,8,0x400); - if (i_dogP->mDistFromPlayer < FLOAT_LABEL(lit_4378) * i_dogP->field_0x67c) { - l_HIO.field_0x1c != 0 ? i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_2 : i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_1; + if (i_dogP->mDistFromPlayer < FLOAT_LABEL(lit_4378) * i_dogP->field_0x674.z) { + l_HIO.field_0x1c != 0 ? i_dogP->mAction = ACT_WAIT_2 : i_dogP->mAction = ACT_WAIT_1; i_dogP->mStayStatus = 0; } else { - if (i_dogP->mDistFromPlayer > FLOAT_LABEL(lit_4435) * i_dogP->field_0x67c) { - i_dogP->mActionStatus = do_class::ACTION_STATUS_RUN; + if (i_dogP->mDistFromPlayer > FLOAT_LABEL(lit_4435) * i_dogP->field_0x674.z) { + i_dogP->mAction = ACT_RUN; i_dogP->mStayStatus = 0; } } @@ -1508,6 +1510,11 @@ static void do_run_walk(do_class* i_dogP) { } /* 80669B80-8066A1C4 001F20 0644+00 2/1 0/0 0/0 .text do_wait_1__FP8do_class */ +#ifdef NONMATCHING +static void do_wait_1(do_class* i_dogP) { + +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1516,6 +1523,7 @@ static asm void do_wait_1(do_class* i_dogP) { #include "asm/rel/d/a/d_a_do/d_a_do/do_wait_1__FP8do_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066EEC8-8066EECC 0000E0 0004+00 0/1 0/0 0/0 .rodata @4545 */ @@ -1617,6 +1625,11 @@ COMPILER_STRIP_GATE(0x8066EEFC, &lit_4588); #pragma pop /* 8066A1C4-8066A3D0 002564 020C+00 1/1 0/0 0/0 .text do_wait_2__FP8do_class */ +#ifdef NONMATCHING +static void do_wait_2(do_class* i_dogP) { + +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1625,8 +1638,14 @@ static asm void do_wait_2(do_class* i_dogP) { #include "asm/rel/d/a/d_a_do/d_a_do/do_wait_2__FP8do_class.s" } #pragma pop +#endif /* 8066A3D0-8066A5DC 002770 020C+00 1/1 0/0 0/0 .text do_sit__FP8do_class */ +#ifdef NONMATCHING +static void do_sit(do_class* i_dogP) { + +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1635,6 +1654,7 @@ static asm void do_sit(do_class* i_dogP) { #include "asm/rel/d/a/d_a_do/d_a_do/do_sit__FP8do_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066EF00-8066EF04 000118 0004+00 0/1 0/0 0/0 .rodata @4709 */ @@ -1652,6 +1672,11 @@ COMPILER_STRIP_GATE(0x8066EF04, &lit_4710); #pragma pop /* 8066A5DC-8066A80C 00297C 0230+00 1/1 0/0 0/0 .text hang_set__FP8do_class */ +#ifdef NONMATCHING +static u16 hang_set(do_class* i_dogP) { + +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1661,6 +1686,7 @@ static asm u16 hang_set(do_class* i_dogP) { } #pragma pop +#endif /* ############################################################################################## */ /* 8066EF08-8066EF0C 000120 0004+00 0/1 0/0 0/0 .rodata @4763 */ #pragma push @@ -1677,6 +1703,11 @@ COMPILER_STRIP_GATE(0x8066EF0C, &lit_4764); #pragma pop /* 8066A80C-8066AB78 002BAC 036C+00 1/1 0/0 0/0 .text do_hang__FP8do_class */ +#ifdef NONMATCHING +static void do_hang(do_class* i_dogP) { + +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1685,6 +1716,7 @@ static asm void do_hang(do_class* i_dogP) { #include "asm/rel/d/a/d_a_do/d_a_do/do_hang__FP8do_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066EFB0-8066EFB0 0001C8 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ @@ -1694,6 +1726,11 @@ SECTION_DEAD static char const* const stringBase_8066EFB3 = "F_SP116"; #pragma pop /* 8066AB78-8066B650 002F18 0AD8+00 2/1 0/0 0/0 .text do_food__FP8do_class */ +#ifdef NONMATCHING +static void do_food(do_class* i_dogP) { + +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1702,6 +1739,7 @@ static asm void do_food(do_class* i_dogP) { #include "asm/rel/d/a/d_a_do/d_a_do/do_food__FP8do_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066EF10-8066EF14 000128 0004+00 0/0 0/0 0/0 .rodata @4962 */ @@ -1791,7 +1829,7 @@ static void do_swim(do_class* i_dogP) { } } - cLib_addCalc2(&i_dogP->mSpeedF,l_HIO.field_0x14,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4588)*l_HIO.field_0x14); + cLib_addCalc2(&i_dogP->mSpeedF,l_HIO.mSwimSpeed,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4588)*l_HIO.mSwimSpeed); cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->mAngleYFromPlayer,16,0x100); i_dogP->mSpeed.y = FLOAT_LABEL(lit_3682); @@ -1850,6 +1888,11 @@ COMPILER_STRIP_GATE(0x8066EF48, &lit_5114); #pragma pop /* 8066B7C0-8066BD3C 003B60 057C+00 1/1 0/0 0/0 .text do_help__FP8do_class */ +#ifdef NONMATCHING +static void do_help(do_class* i_dogP) { + +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1858,6 +1901,7 @@ static asm void do_help(do_class* i_dogP) { #include "asm/rel/d/a/d_a_do/d_a_do/do_help__FP8do_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066EF4C-8066EF50 000164 0004+00 0/1 0/0 0/0 .rodata @5344 */ @@ -1875,6 +1919,11 @@ COMPILER_STRIP_GATE(0x8066EF50, &lit_5345); #pragma pop /* 8066BD3C-8066C894 0040DC 0B58+00 2/1 0/0 0/0 .text do_boat__FP8do_class */ +#ifdef NONMATCHING +static u8 do_boat(do_class* i_dogP) { + +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1883,6 +1932,7 @@ static asm u8 do_boat(do_class* i_dogP) { #include "asm/rel/d/a/d_a_do/d_a_do/do_boat__FP8do_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066EF54-8066EF58 00016C 0004+00 0/0 0/0 0/0 .rodata @5346 */ @@ -1907,6 +1957,11 @@ COMPILER_STRIP_GATE(0x8066EF5C, &lit_5407); #pragma pop /* 8066C894-8066CAA8 004C34 0214+00 1/1 0/0 0/0 .text do_a_swim__FP8do_class */ +#ifdef NONMATCHING +static void do_a_swim(do_class* i_dogP) { + +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -1915,6 +1970,7 @@ static asm void do_a_swim(do_class* i_dogP) { #include "asm/rel/d/a/d_a_do/d_a_do/do_a_swim__FP8do_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8066EF60-8066EF68 000178 0004+04 0/1 0/0 0/0 .rodata @5477 */ @@ -1941,7 +1997,7 @@ COMPILER_STRIP_GATE(0x8066EF68, &lit_5480); #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_carry(do_class* i_dogP) { +static asm u8 do_carry(do_class* i_dogP) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_carry__FP8do_class.s" } @@ -1967,7 +2023,7 @@ static void do_message(do_class* i_dogP) { cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->mAngleYFromPlayer,2,0x1000); if (i_dComIfGp_event_runCheck() == 0 && i_dogP->mDistFromPlayer > FLOAT_LABEL(lit_3773)) { - i_dogP->mActionStatus = do_class::ACTION_STATUS_STAY; + i_dogP->mAction = ACT_STAY; i_dogP->mStayStatus = 0; } @@ -1981,448 +2037,6 @@ SECTION_RODATA static f32 const lit_5948 = -7.0f; COMPILER_STRIP_GATE(0x8066EF70, &lit_5948); #pragma pop -/* 8066CEC4-8066DD48 005264 0E84+00 2/1 0/0 0/0 .text action__FP8do_class */ -#ifdef NONMATCHING -extern "C" u8 scc[12]; -static void action(do_class* i_dogP) { - fopAc_ac_c* player = dComIfGp_getPlayer(0); - - i_dogP->mGravity = -7.0f; - i_dogP->mDistFromPlayer = fopAcM_searchPlayerDistance(i_dogP); - - if (daPy_getLinkPlayerActorClass()->checkHorseRide()) { - i_dogP->mDistFromPlayer -= 100.0f; - } - - i_dogP->mAngleYFromPlayer = fopAcM_searchPlayerAngleY(i_dogP); - i_dogP->mEyePosYDistFromPlayer = fabsf(i_dogP->mEyePos.y - player->current.pos.y); - - if (mDoCPd_c::getHoldR(PAD_1) || 50.0f < fabsf(i_dogP->current.pos.y - player->current.pos.y)) { - i_dogP->mEyePosYDistFromPlayer = 300.0f; - } - - i_dogP->mEyePosYDistFromPlayer *= 0.6f; - - u8 tmp1 = 1; - bool tmp2 = true; - bool tmp3 = true; - - i_dogP->mCcD_GObjInf1.OnCoSetBit(); - - if (i_dogP->field_0x608 < 1.0f) { - i_dogP->field_0xc05 = 0; - - switch(i_dogP->mActionStatus) { - case do_class::ACTION_STATUS_STAY: { - do_stay(i_dogP); - food_check(i_dogP); - i_dogP->field_0xc05 = 1; - break; - } - case do_class::ACTION_STATUS_WALK: { - do_walk(i_dogP); - food_check(i_dogP); - i_dogP->field_0xc05 = 1; - break; - } - case do_class::ACTION_STATUS_WALK_RUN: { - do_walk_run(i_dogP); - food_check(i_dogP); - i_dogP->field_0xc05 = 1; - break; - } - case do_class::ACTION_STATUS_RUN: { - do_run(i_dogP); - food_check(i_dogP); - i_dogP->field_0xc05 = 1; - break; - } - case do_class::ACTION_STATUS_RUN_WALK: { - do_run_walk(i_dogP); - food_check(i_dogP); - i_dogP->field_0xc05 = 1; - break; - } - case do_class::ACTION_STATUS_FOOD: { - do_food(i_dogP); - i_dogP->field_0xc05 = 1; - break; - } - case do_class::ACTION_STATUS_WAIT_1: { - do_wait_1(i_dogP); - food_check(i_dogP); - i_dogP->field_0xc05 = 1; - break; - } - case do_class::ACTION_STATUS_WAIT_2: { - do_wait_2(i_dogP); - food_check(i_dogP); - i_dogP->field_0xc05 = 1; - break; - } - case do_class::ACTION_STATUS_SIT: { - do_sit(i_dogP); - food_check(i_dogP); - i_dogP->field_0xc05 = 1; - break; - } - case do_class::ACTION_STATUS_A_SWIM: { - do_a_swim(i_dogP); - break; - } - case do_class::ACTION_STATUS_SWIM: { - do_swim(i_dogP); - tmp3 = false; - fopAcM_riverStream(0,0,0,0); - break; - } - case do_class::ACTION_STATUS_HELP: { - do_help(i_dogP); - break; - } - case do_class::ACTION_STATUS_BOAT: { - tmp1 = do_boat(i_dogP); - break; - } - case do_class::ACTION_STATUS_HANG: { - do_hang(i_dogP); - break; - } - case do_class::ACTION_STATUS_CARRY: { - do_carry(i_dogP); - i_dogP->mCcD_GObjInf1.OffCoSetBit(); - tmp2 = false; - break; - } - case do_class::ACTION_STATUS_MESSAGE: { - do_message(i_dogP); - i_dogP->field_0xc05 = 2; - } - } - } - - if (i_dogP->field_0x680 != -1 && i_dogP->mDistFromPlayer < i_dogP->field_0x67c * 160.0) { - daItem_c* item = (daItem_c*)fopAcM_SearchByID(i_dogP->field_0x680); - - if (item) { - item->endControl(); - } - - i_dogP->field_0x6b8 = 0; - i_dogP->field_0x680 = -1; - } - - if (i_dogP->field_0x6ae != 0) { - i_dogP->field_0x6ae--; - if (i_dogP->field_0x6ae == 0) { - i_dogP->mSound.startSound(JAISoundID(Z2SE_M007_DOG_COME_RUNNING),0,-1); - } - } - - if (i_dogP->field_0xc05 == 1 && daPy_py_c::i_checkNowWolf() && i_dogP->mDistFromPlayer < 300.0f) { - i_dogP->mActionStatus = do_class::ACTION_STATUS_MESSAGE; - i_dogP->mStayStatus = 0; - } - - if (tmp2 || 2.0 <= player->mSpeedF) {i_dogP->field_0x610 = cM_ssin(i_dogP->field_0x634 * 3000.0f); - cLib_offBit(i_dogP->mAttentionInfo.mFlags,0x80); - } else { - cLib_onBit(i_dogP->mAttentionInfo.mFlags,0x80); - - if (do_carry_check(i_dogP)) { - return; - } - } - - cLib_addCalcAngleS2(&i_dogP->current.angle.x,0,1,0x400); - - if (i_dogP->mActionStatus == do_class::ACTION_STATUS_HANG) { - if (i_dogP->field_0x608 < 1.0f) { - cXyz pos = i_dogP->current.pos; - int check = dansa_check(i_dogP,pos,pos.x); - - if ((-check & ~check) < 0) { - i_dogP->field_0x660 = hang_set(i_dogP); - - if (i_dogP->field_0x660 == 0xdcf) { - i_dogP->mActionStatus = do_class::ACTION_STATUS_HANG; - i_dogP->mStayStatus = 0; - i_dogP->field_0x63c = 0; - } - } - } - } else { - mDoMtx_YrotS((MtxP)calc_mtx,i_dogP->current.angle.y); - - cXyz pos1; - cXyz pos2; - cXyz pos3; - - pos1.x = 0.0f; - pos1.z = 0.0f; - pos1.y = l_HIO.field_0x10 * i_dogP->mSpeedF * 0.8f * i_dogP->field_0x67c; - - MtxPosition(&pos1,&pos2); - i_dogP->current.pos += pos2; - - if (i_dogP->mSpeed.y < -80.0f) { - i_dogP->mSpeed.y = -80.0f; - } - - if (fopAcM_checkCarryNow(i_dogP) && i_dogP->field_0x8d4 != 0.0f) { - i_dogP->current.pos.x += i_dogP->field_0x8d4 * 0.3f; - i_dogP->current.pos.z += i_dogP->field_0x8dc * 0.3f; - } - - if (1.0 < i_dogP->field_0x608) { - pos1.x = 0.0f; - pos1.y = 0.0f; - pos1.z = i_dogP->field_0x608; - - mDoMtx_YrotS((MtxP)calc_mtx,i_dogP->field_0x60c); - MtxPosition(&pos1,&pos2); - - i_dogP->current.pos += pos2; - cLib_addCalc0(&i_dogP->field_0x608,1.0,6.0); - - i_dogP->mSpeedF = 0.0; - tmp1 = 1; - } - if (tmp1 == 0) { - i_dogP->mBgS_AcchCir.SetWall(30.0f,fabsf(i_dogP->mSpeedF) + fabsf(i_dogP->field_0x608) + 30.0f); - i_dogP->mBgS_Acch.CrrPos(dComIfG_Bgsp()); - - if (i_dogP->mBgS_Acch.ChkGroundHit() && l_HIO.field_0x10 == 0 && fopAcM_checkCarryNow(i_dogP)) { - dBgS_GndChk gnd_chk; - - mDoMtx_YrotS((MtxP)calc_mtx,i_dogP->shape_angle.y); - - pos1.x = 0.0; - pos1.y = 0.0; - pos1.z = i_dogP->field_0x67c * -25.0; - - MtxPosition(&pos1,&pos2); - i_dogP->current.pos += pos2; - - pos3.x = pos2.x; - pos3.y = pos2.y + 100.0f; - pos3.z = pos2.z; - - gnd_chk.SetPos(&pos3); - pos2.y = dComIfG_Bgsp().GroundCross(&gnd_chk); - - pos1 = pos2 - i_dogP->current.pos; - - if (fabsf(pos1.y) < 50.0f) { - i_dogP->current.angle.x = cM_atan2s(pos1.y, JMAFastSqrt(pos1.x * pos1.x + pos1.z * pos1.z)); - } - } - } - } - - water_check(i_dogP); - - if (tmp3) { - if (i_dogP->mActionStatus == do_class::ACTION_STATUS_CARRY) { - if (i_dogP->field_0x63c != 0 && i_dogP->field_0x63c--, i_dogP->field_0x63c == 0) { - i_dogP->mActionStatus = do_class::ACTION_STATUS_A_SWIM; - i_dogP->mStayStatus = 0; - } - - if (45.0f < i_dogP->field_0x65c - i_dogP->current.pos.y) { - i_dogP->mActionStatus = do_class::ACTION_STATUS_SWIM; - i_dogP->mStayStatus = 0; - i_dogP->field_0x608 = 0.0f; - - if (i_dogP->field_0x606 == 0) { - - i_dogP->field_0x606 = 0x14; - cXyz pos = i_dogP->current.pos; - pos.y = i_dogP->field_0x65c; - - if (l_HIO.field_0x10 == 0) { - scc[0] = 0; // fix later - l_HIO.field_0x0c = 0.0f; - l_HIO.field_0x10 = 0.0f; - l_HIO.field_0x1c = 1; - } - - for (int i = 0; i < 4; i++) { - // wrong - i_dogP->mMsg.setMsg(dComIfGp_particle_set((u32)0,(u16)l_HIO.field_0x1c,&pos,&i_dogP->mTevStr,(csXyz*)0,(cXyz*)&scc,(u8)0xFF,(dPa_levelEcallBack *)0,(s8)-1,(GXColor*)0,(GXColor*)0,(cXyz*)0)); - } - - i_dogP->mSound.startSound(JAISoundID(Z2SE_CM_BODYFALL_WATER_S),0,-1); - } - } - } - } else { - i_dogP->field_0x63c = cM_rndF(25.0f) + 30.0f; - - if (i_dogP->field_0x65c - i_dogP->current.pos.y < 35.0f) { - i_dogP->mActionStatus = do_class::ACTION_STATUS_WAIT_1; - i_dogP->mStayStatus = 0; - } - } - - cLib_addCalcAngleS2(&i_dogP->shape_angle.y,i_dogP->current.angle.y,2,0x2000); - cLib_addCalcAngleS2(&i_dogP->shape_angle.x,i_dogP->current.angle.x,4,0x1000); - i_dogP->shape_angle.z = i_dogP->current.angle.z; - - int tmp4 = 0; - int tmp5 = 0; - - if (i_dogP->field_0x616 != 0 || i_dogP->field_0x624 != 0) { - if (i_dogP->field_0x616 == 2) { - i_dogP->field_0x5f0 & 8U ? tmp4 = -10000 : tmp4 = 10000; - } else { - cXyz eyePosDiff; - - if (i_dogP->field_0x624 == 0) { - eyePosDiff = player->mEyePos - i_dogP->mEyePos; - - } else { - i_dogP->field_0x624++; - eyePosDiff = i_dogP->mUnkPos - i_dogP->mEyePos; - } - - eyePosDiff.y += i_dogP->field_0x67c * -16.0f; - - s16 some_angle = cM_atan2s(eyePosDiff.x,eyePosDiff.z) - i_dogP->shape_angle.y; - s16 some_angle2 = cM_atan2s(eyePosDiff.y,JMAFastSqrt(eyePosDiff.x * eyePosDiff.x + eyePosDiff.z * eyePosDiff.z)); - tmp5 = i_dogP->shape_angle.x + some_angle2; - - if (i_dogP->field_0x624 == 0 && some_angle > 24000 || some_angle < -24000) { - some_angle = 0; - } - - if (some_angle < 12001) { - if (some_angle < -12000) { - some_angle = -12000; - } - } else { - some_angle = 12000; - } - - if (tmp5 < 12001) { - if (tmp5 < -12000) { - tmp5 = -12000; - } - } else { - tmp5 = 12000; - } - - tmp4 = some_angle + i_dogP->field_0x614; - } - - i_dogP->field_0x616 = 0; - } - - cLib_addCalcAngleS2(&i_dogP->field_0x610,tmp4 / 2,4,0x2000); - cLib_addCalcAngleS2(&i_dogP->field_0x60e,tmp5 / 2,4,0x2000); - cLib_addCalcAngleS2(&i_dogP->field_0x614,0,2,0x300); - cLib_addCalcAngleS2(&i_dogP->field_0x628,i_dogP->field_0x62e,4,0x400); - cLib_addCalcAngleS2(&i_dogP->field_0x62a,i_dogP->field_0x630,4,0x400); - - if (2.0f <= fabsf(player->mSpeedF) || 2.0f <= fabsf(i_dogP->mSpeedF)) { - i_dogP->field_0x630 = 0; - i_dogP->field_0x62e = 0; - i_dogP->field_0x632 = cM_rndF(100.0) + 80.0f; - } else if (i_dogP->field_0x632 != 0 && i_dogP->field_0x632--, i_dogP->field_0x632 == 0) { - i_dogP->field_0x632 = cM_rndF(100.0) + 20.0f; - - if (cM_rndF(1.0) < 0.5) { - i_dogP->field_0x62e = cM_rndFX(2000.0); - } - - if (cM_rndF(1.0) < 0.5) { - i_dogP->field_0x630 = cM_rndFX(2000.0); - } - } - - if (0.025 <= i_dogP->field_0x634) { - if (l_HIO.field_0x1c == 0) { - i_dogP->field_0x612 = 0; - i_dogP->field_0x610 = 0; - } else { - i_dogP->field_0x610 = cM_ssin(i_dogP->field_0x634 * 3000.0f); - i_dogP->field_0x612 = cM_ssin(i_dogP->field_0x634 * 3000.0f); - } - } - - cLib_addCalc2(&i_dogP->field_0x634,i_dogP->field_0x638,1.0,0.15); - cLib_addCalc0(&i_dogP->field_0x638,1.0,0.04); - - i_dogP->field_0x640 = cM_ssin(i_dogP->field_0x648 * i_dogP->field_0x64c); - i_dogP->field_0x63e = cM_ssin(i_dogP->field_0x648 * i_dogP->field_0x650); - i_dogP->field_0x64c += i_dogP->field_0x648 * 2.0f; - - if (65536.0 < i_dogP->field_0x64c) { - i_dogP->field_0x64c -= 65536.0f; - } - - i_dogP->field_0x650 += i_dogP->field_0x648 * 1.5f; - - if (65536.0 < i_dogP->field_0x650) { - i_dogP->field_0x650 -= 65536.0f; - } - - cLib_addCalc2(&i_dogP->field_0x648,i_dogP->field_0x648,1.0,100.0); - i_dogP->field_0x648 = 0.0; - - if (i_dogP->field_0x5e2 == 0) { - if (i_dogP->field_0x5e0 == 0) { - i_dogP->field_0x5e0 = cM_rndF(100.0) + 30.0f; - } else { - i_dogP->field_0x5e0--; - i_dogP->field_0x5e0 < 6 ? i_dogP->field_0x5de = 5 - i_dogP->field_0x5e0 : i_dogP->field_0x5e0 = 0; - } - } else { - cLib_addCalcAngleS2(&i_dogP->field_0x5de,3,1,1); - i_dogP->field_0x5e2 = 0; - i_dogP->field_0x5e0 = 0x3c; - } -} -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void action(do_class* i_dogP) { - nofralloc -#include "asm/rel/d/a/d_a_do/d_a_do/action__FP8do_class.s" -} -#pragma pop -#endif - -/* 8066DD48-8066DE64 0060E8 011C+00 1/1 0/0 0/0 .text message__FP8do_class */ -static void message(do_class* i_dogP) { - if (i_dogP->field_0xc06 != 0) { - i_dogP->field_0x604 = 10; - - if (i_dogP->mMsg.doFlow(i_dogP,0,0)) { - i_dComIfGp_event_reset(); - i_dogP->field_0xc06 = 0; - } - - } else { - if (i_dComIfGp_event_runCheck() && i_dogP->mEvtInfo.checkCommandTalk()) { - i_dogP->mMsg.init(i_dogP,i_dogP->field_0xc08,0,0); - i_dogP->field_0xc06 = 1; - } - - if (i_dogP->field_0xc05 == 2 && i_dogP->field_0xc08 != -1 && daPy_py_c::i_checkNowWolf()) { - fopAcM_OnStatus(i_dogP,0); - cLib_onBit(i_dogP->mAttentionInfo.mFlags,10); - i_dogP->mEvtInfo.i_onCondition(1); - } else { - fopAcM_OffStatus(i_dogP,0); - cLib_offBit(i_dogP->mAttentionInfo.mFlags,10); - } - - } -} - -/* ############################################################################################## */ /* 8066EF74-8066EF78 00018C 0004+00 0/0 0/0 0/0 .rodata @5949 */ #pragma push #pragma force_active on @@ -2500,7 +2114,466 @@ SECTION_RODATA static f32 const lit_6214 = -24.0f; COMPILER_STRIP_GATE(0x8066EF9C, &lit_6214); #pragma pop +/* 8066CEC4-8066DD48 005264 0E84+00 2/1 0/0 0/0 .text action__FP8do_class */ +#ifdef NONMATCHING +extern "C" u8 scc[12]; +static void action(do_class* i_dogP) { + cXyz pos1; + cXyz pos2; + cXyz pos3; + u8* tmp_lit = lit_1109; + + fopAc_ac_c* player = dComIfGp_getPlayer(0); + + i_dogP->mGravity = FLOAT_LABEL(lit_5948); + i_dogP->mDistFromPlayer = fopAcM_searchPlayerDistance(i_dogP); + + daPy_py_c* player2 = daPy_getPlayerActorClass(); + + if (player2->checkHorseRide()) { + i_dogP->mDistFromPlayer -= FLOAT_LABEL(lit_3772); + } + + i_dogP->mAngleYFromPlayer = fopAcM_searchPlayerAngleY(i_dogP); + i_dogP->mEyePosYDistFromPlayer = fabsf(i_dogP->mEyePos.y - player->current.pos.y); + + if (!mDoCPd_c::getHoldR(PAD_1) || fabsf(i_dogP->current.pos.y - player->current.pos.y) > FLOAT_LABEL(lit_3816)) { + i_dogP->mEyePosYDistFromPlayer = FLOAT_LABEL(lit_4339); + } + + i_dogP->mEyePosYDistFromPlayer *= FLOAT_LABEL(lit_4341); + + u8 tmp1 = 1; + s8 tmp2 = 1; + bool tmp3 = true; + + i_dogP->mCcD_GObjInf1.OnCoSetBit(); + + if (i_dogP->field_0x608 < FLOAT_LABEL(lit_3662)) { + i_dogP->field_0xc05 = 0; + + switch(i_dogP->mAction) { + case ACT_STAY: { + do_stay(i_dogP); + food_check(i_dogP); + i_dogP->field_0xc05 = 1; + break; + } + case ACT_WALK: { + do_walk(i_dogP); + food_check(i_dogP); + i_dogP->field_0xc05 = 1; + break; + } + case ACT_WALK_RUN: { + do_walk_run(i_dogP); + food_check(i_dogP); + i_dogP->field_0xc05 = 1; + break; + } + case ACT_RUN: { + do_run(i_dogP); + food_check(i_dogP); + i_dogP->field_0xc05 = 1; + break; + } + case ACT_RUN_WALK: { + do_run_walk(i_dogP); + food_check(i_dogP); + i_dogP->field_0xc05 = 1; + break; + } + case ACT_FOOD: { + do_food(i_dogP); + i_dogP->field_0xc05 = 1; + break; + } + case ACT_WAIT_1: { + do_wait_1(i_dogP); + food_check(i_dogP); + i_dogP->field_0xc05 = 1; + break; + } + case ACT_WAIT_2: { + do_wait_2(i_dogP); + food_check(i_dogP); + i_dogP->field_0xc05 = 1; + break; + } + case ACT_SIT: { + do_sit(i_dogP); + food_check(i_dogP); + i_dogP->field_0xc05 = 1; + break; + } + case ACT_A_SWIM: { + do_a_swim(i_dogP); + break; + } + case ACT_SWIM: { + do_swim(i_dogP); + tmp3 = false; + fopAcM_riverStream(&i_dogP->current.pos,&i_dogP->field_0x6b0,&i_dogP->field_0x6b4,FLOAT_LABEL(lit_4588)); + break; + } + case ACT_HELP: { + do_help(i_dogP); + break; + } + case ACT_BOAT: { + tmp1 = do_boat(i_dogP); + break; + } + case ACT_HANG: { + do_hang(i_dogP); + break; + } + case ACT_CARRY: { + tmp1 = do_carry(i_dogP); + i_dogP->mCcD_GObjInf1.OffCoSetBit(); + tmp2 = 0; + break; + } + case ACT_MESSAGE: { + do_message(i_dogP); + i_dogP->field_0xc05 = 2; + } + } + } + + if (i_dogP->mItemPcId != -1 && i_dogP->mDistFromPlayer < FLOAT_LABEL(lit_4378) * i_dogP->field_0x674.z) { + daItem_c* item = (daItem_c*)fopAcM_SearchByID(i_dogP->mItemPcId); + + if (item) { + item->endControl(); + } + + i_dogP->field_0x6b8 = 0; + i_dogP->mItemPcId = -1; + } + + if (i_dogP->field_0x6ae != 0) { + i_dogP->field_0x6ae--; + if (i_dogP->field_0x6ae == 0) { + i_dogP->mSound.startSound(JAISoundID(Z2SE_M007_DOG_COME_RUNNING),0,-1); + } + } + + if (i_dogP->field_0xc05 == 1 && daPy_py_c::i_checkNowWolf() && i_dogP->mDistFromPlayer < FLOAT_LABEL(lit_4339)) { + i_dogP->mAction = ACT_MESSAGE; + i_dogP->mStayStatus = 0; + } + + if (tmp2 != 0 && player->mSpeedF < FLOAT_LABEL(lit_3665)) { + cLib_onBit(i_dogP->mAttentionInfo.mFlags,0x10); + + if (do_carry_check(i_dogP)) { + return; + } + } else { + cLib_offBit(i_dogP->mAttentionInfo.mFlags,0x10); + } + + cLib_addCalcAngleS2(&i_dogP->current.angle.x,0,1,0x400); + + if (i_dogP->mAction != ACT_HANG) { + mDoMtx_YrotS((MtxP)calc_mtx,i_dogP->current.angle.y); + + pos1.x = FLOAT_LABEL(lit_3682); + pos1.y = FLOAT_LABEL(lit_3682); + pos1.z = FLOAT_LABEL(lit_3981) * i_dogP->mSpeedF; + pos1.z *= i_dogP->field_0x674.z; + + MtxPosition(&pos1,&pos2); + + i_dogP->mSpeed.x = pos2.x; + i_dogP->mSpeed.z = pos2.z; + i_dogP->mSpeed.y += i_dogP->mGravity;; + + i_dogP->current.pos += i_dogP->mSpeed; + + if (i_dogP->mSpeed.y < FLOAT_LABEL(lit_5345)) { + i_dogP->mSpeed.y = FLOAT_LABEL(lit_5345); + } + + cXyz* posP; + + if (!fopAcM_checkCarryNow(i_dogP) && (posP = i_dogP->mCcD_Stts.GetCCMoveP(), posP)) { + i_dogP->current.pos.x = i_dogP->current.pos.x + FLOAT_LABEL(lit_4967) * posP->x; + i_dogP->current.pos.z = i_dogP->current.pos.z + FLOAT_LABEL(lit_4967) * posP->z; + } + + if (i_dogP->field_0x608 > FLOAT_LABEL(lit_3662)) { + pos1.x = FLOAT_LABEL(lit_3682); + pos1.y = FLOAT_LABEL(lit_3682); + pos1.z = -i_dogP->field_0x608; + + mDoMtx_YrotS((MtxP)calc_mtx,i_dogP->field_0x60c); + MtxPosition(&pos1,&pos2); + + i_dogP->current.pos += pos2; + cLib_addCalc0(&i_dogP->field_0x608,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_5949)); + + i_dogP->mSpeedF = FLOAT_LABEL(lit_3682); + tmp1 = 1; + } + if ((s8)tmp1 != 0) { + i_dogP->mBgS_AcchCir.SetWall(FLOAT_LABEL(lit_3846), (fabsf(i_dogP->field_0x608) + fabsf(i_dogP->mSpeedF)) + FLOAT_LABEL(lit_3846)); + i_dogP->mBgS_Acch.CrrPos(dComIfG_Bgsp()); + + if (i_dogP->mBgS_Acch.ChkGroundHit() && tmp_lit[0x3d] == 0 && !fopAcM_checkCarryNow(i_dogP)) { + dBgS_GndChk gnd_chk; + + mDoMtx_YrotS((MtxP)calc_mtx,i_dogP->shape_angle.y); + + pos1.x = FLOAT_LABEL(lit_3682); + pos1.y = FLOAT_LABEL(lit_3682); + pos1.z = FLOAT_LABEL(lit_5950) * i_dogP->field_0x674.z; + + MtxPosition(&pos1,&pos2); + pos2 += i_dogP->current.pos; + + pos3.x = pos2.x; + pos3.y = pos2.y + FLOAT_LABEL(lit_3772); + pos3.z = pos2.z; + + gnd_chk.SetPos(&pos3); + pos2.y = dComIfG_Bgsp().GroundCross(&gnd_chk); + + pos1 = pos2 - i_dogP->current.pos; + + if (fabsf(pos1.y) < FLOAT_LABEL(lit_3816)) { + i_dogP->current.angle.x = cM_atan2s(pos1.y, JMAFastSqrt(pos1.x * pos1.x + pos1.z * pos1.z)); + } + } + } + } else { + if (i_dogP->field_0x608 < FLOAT_LABEL(lit_3662)) { + cXyz pos = i_dogP->current.pos; + int check = dansa_check(i_dogP,pos,pos.x); + + if ((-check & ~check) < 0) { + i_dogP->field_0x660 = hang_set(i_dogP); + + if (i_dogP->field_0x660 == 0xdcf) { + i_dogP->mAction = ACT_HANG; + i_dogP->mStayStatus = 0; + i_dogP->field_0x63c = 0; + } + } + } + } + + water_check(i_dogP); + + if (tmp3) { + if (i_dogP->mAction == ACT_CARRY) { + if (i_dogP->field_0x63c != 0 && i_dogP->field_0x63c--, i_dogP->field_0x63c == 0) { + i_dogP->mAction = ACT_A_SWIM; + i_dogP->mStayStatus = 0; + } + + if (45.0f < i_dogP->field_0x65c - i_dogP->current.pos.y) { + i_dogP->mAction = ACT_SWIM; + i_dogP->mStayStatus = 0; + i_dogP->field_0x608 = FLOAT_LABEL(lit_3682); + + if (i_dogP->field_0x606 == 0) { + + i_dogP->field_0x606 = 0x14; + cXyz pos = i_dogP->current.pos; + pos.y = i_dogP->field_0x65c; + + if (l_HIO.mRunSpeed == 0) { + scc[0] = 0; // fix later + l_HIO.mWalkSpeed = FLOAT_LABEL(lit_3682); + l_HIO.mRunSpeed = FLOAT_LABEL(lit_3682); + l_HIO.field_0x1c = 1; + } + + for (int i = 0; i < 4; i++) { + // wrong + i_dogP->mMsg.setMsg(dComIfGp_particle_set((u32)0,(u16)l_HIO.field_0x1c,&pos,&i_dogP->mTevStr,(csXyz*)0,(cXyz*)&scc,(u8)0xFF,(dPa_levelEcallBack *)0,(s8)-1,(GXColor*)0,(GXColor*)0,(cXyz*)0)); + } + + i_dogP->mSound.startSound(JAISoundID(Z2SE_CM_BODYFALL_WATER_S),0,-1); + } + } + } + } else { + i_dogP->field_0x63c = cM_rndF(FLOAT_LABEL(lit_4025)) + FLOAT_LABEL(lit_3846); + + if (i_dogP->field_0x65c - i_dogP->current.pos.y < FLOAT_LABEL(lit_5951)) { + i_dogP->mAction = ACT_WAIT_1; + i_dogP->mStayStatus = 0; + } + } + + cLib_addCalcAngleS2(&i_dogP->shape_angle.y,i_dogP->current.angle.y,2,0x2000); + cLib_addCalcAngleS2(&i_dogP->shape_angle.x,i_dogP->current.angle.x,4,0x1000); + i_dogP->shape_angle.z = i_dogP->current.angle.z; + + int tmp4 = 0; + int tmp5 = 0; + + if (i_dogP->field_0x616 != 0 || i_dogP->field_0x624 != 0) { + if (i_dogP->field_0x616 == 2) { + i_dogP->field_0x5f0 & 8U ? tmp4 = -10000 : tmp4 = 10000; + } else { + cXyz eyePosDiff; + + if (i_dogP->field_0x624 == 0) { + eyePosDiff = player->mEyePos - i_dogP->mEyePos; + + } else { + i_dogP->field_0x624++; + eyePosDiff = i_dogP->mUnkPos - i_dogP->mEyePos; + } + + eyePosDiff.y += i_dogP->field_0x674.z * FLOAT_LABEL(lit_5952); + + s16 some_angle = cM_atan2s(eyePosDiff.x,eyePosDiff.z) - i_dogP->shape_angle.y; + s16 some_angle2 = cM_atan2s(eyePosDiff.y,JMAFastSqrt(eyePosDiff.x * eyePosDiff.x + eyePosDiff.z * eyePosDiff.z)); + tmp5 = i_dogP->shape_angle.x + some_angle2; + + if (i_dogP->field_0x624 == 0 && some_angle > 24000 || some_angle < -24000) { + some_angle = 0; + } + + if (some_angle < 12001) { + if (some_angle < -12000) { + some_angle = -12000; + } + } else { + some_angle = 12000; + } + + if (tmp5 < 12001) { + if (tmp5 < -12000) { + tmp5 = -12000; + } + } else { + tmp5 = 12000; + } + + tmp4 = some_angle + i_dogP->field_0x614; + } + + i_dogP->field_0x616 = 0; + } + + cLib_addCalcAngleS2(&i_dogP->field_0x610,tmp4 / 2,4,0x2000); + cLib_addCalcAngleS2(&i_dogP->field_0x60e,tmp5 / 2,4,0x2000); + cLib_addCalcAngleS2(&i_dogP->field_0x614,0,2,0x300); + cLib_addCalcAngleS2(&i_dogP->field_0x628,i_dogP->field_0x62e,4,0x400); + cLib_addCalcAngleS2(&i_dogP->field_0x62a,i_dogP->field_0x630,4,0x400); + + if (FLOAT_LABEL(lit_3682) <= fabsf(player->mSpeedF) || FLOAT_LABEL(lit_3682) <= fabsf(i_dogP->mSpeedF)) { + i_dogP->field_0x630 = 0; + i_dogP->field_0x62e = 0; + i_dogP->field_0x632 = cM_rndF(FLOAT_LABEL(lit_3772)) + FLOAT_LABEL(lit_5953); + } else if (i_dogP->field_0x632 != 0 && i_dogP->field_0x632--, i_dogP->field_0x632 == 0) { + i_dogP->field_0x632 = cM_rndF(FLOAT_LABEL(lit_3772)) + FLOAT_LABEL(lit_4189); + + if (cM_rndF(1.0) < 0.5) { + i_dogP->field_0x62e = cM_rndFX(FLOAT_LABEL(lit_4191)); + } + + if (cM_rndF(1.0) < 0.5) { + i_dogP->field_0x630 = cM_rndFX(FLOAT_LABEL(lit_4191)); + } + } + + if (0.025 <= i_dogP->field_0x634) { + if (l_HIO.field_0x1c == 0) { + i_dogP->field_0x612 = 0; + i_dogP->field_0x610 = 0; + } else { + i_dogP->field_0x610 = cM_ssin(i_dogP->field_0x634 * FLOAT_LABEL(lit_4344)); + i_dogP->field_0x612 = cM_ssin(i_dogP->field_0x634 * FLOAT_LABEL(lit_4344)); + } + } + + cLib_addCalc2(&i_dogP->field_0x634,i_dogP->field_0x638,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_5407)); + cLib_addCalc0(&i_dogP->field_0x638,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_5954)); + + i_dogP->field_0x640 = cM_ssin(i_dogP->field_0x648 * i_dogP->field_0x64c); + i_dogP->field_0x63e = cM_ssin(i_dogP->field_0x648 * i_dogP->field_0x650); + i_dogP->field_0x64c += i_dogP->field_0x648 * FLOAT_LABEL(lit_3682); + + if (65536.0 < i_dogP->field_0x64c) { + i_dogP->field_0x64c -= FLOAT_LABEL(lit_4338); + } + + i_dogP->field_0x650 += i_dogP->field_0x648 * FLOAT_LABEL(lit_4401); + + if (65536.0 < i_dogP->field_0x650) { + i_dogP->field_0x650 -= FLOAT_LABEL(lit_4338); + } + + cLib_addCalc2(&i_dogP->field_0x648,i_dogP->field_0x648,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_3772)); + i_dogP->field_0x648 = FLOAT_LABEL(lit_3682); + + if (i_dogP->field_0x5e2 == 0) { + if (i_dogP->field_0x5e0 == 0) { + i_dogP->field_0x5e0 = cM_rndF(FLOAT_LABEL(lit_3772)) + FLOAT_LABEL(lit_3846); + } else { + i_dogP->field_0x5e0--; + i_dogP->field_0x5e0 < 6 ? i_dogP->field_0x5de = 5 - i_dogP->field_0x5e0 : i_dogP->field_0x5e0 = 0; + } + } else { + cLib_addCalcAngleS2(&i_dogP->field_0x5de,3,1,1); + i_dogP->field_0x5e2 = 0; + i_dogP->field_0x5e0 = 0x3c; + } +} +#else +#pragma push +#pragma optimization_level 0 +#pragma optimizewithasm off +static asm void action(do_class* i_dogP) { + nofralloc +#include "asm/rel/d/a/d_a_do/d_a_do/action__FP8do_class.s" +} +#pragma pop +#endif + +/* 8066DD48-8066DE64 0060E8 011C+00 1/1 0/0 0/0 .text message__FP8do_class */ +static void message(do_class* i_dogP) { + if (i_dogP->field_0xc06 != 0) { + i_dogP->field_0x604 = 10; + + if (i_dogP->mMsg.doFlow(i_dogP,0,0)) { + i_dComIfGp_event_reset(); + i_dogP->field_0xc06 = 0; + } + + } else { + if (i_dComIfGp_event_runCheck() && i_dogP->mEvtInfo.checkCommandTalk()) { + i_dogP->mMsg.init(i_dogP,i_dogP->field_0xc08,0,0); + i_dogP->field_0xc06 = 1; + } + + if (i_dogP->field_0xc05 == 2 && i_dogP->field_0xc08 != -1 && daPy_py_c::i_checkNowWolf()) { + fopAcM_OnStatus(i_dogP,0); + cLib_onBit(i_dogP->mAttentionInfo.mFlags,10); + i_dogP->mEvtInfo.i_onCondition(1); + } else { + fopAcM_OffStatus(i_dogP,0); + cLib_offBit(i_dogP->mAttentionInfo.mFlags,10); + } + + } +} + +/* ############################################################################################## */ + /* 8066DE64-8066E494 006204 0630+00 2/1 0/0 0/0 .text daDo_Execute__FP8do_class */ +#ifdef NONMATCHING +static void daDo_Execute(do_class* i_dogP) { + +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -2509,6 +2582,7 @@ static asm void daDo_Execute(do_class* i_dogP) { #include "asm/rel/d/a/d_a_do/d_a_do/daDo_Execute__FP8do_class.s" } #pragma pop +#endif /* 8066E494-8066E49C 006834 0008+00 1/0 0/0 0/0 .text daDo_IsDelete__FP8do_class */ static bool daDo_IsDelete(do_class* i_dogP) { @@ -2517,8 +2591,7 @@ static bool daDo_IsDelete(do_class* i_dogP) { /* 8066E49C-8066E504 00683C 0068+00 1/0 0/0 0/0 .text daDo_Delete__FP8do_class */ #ifdef NONMATCHING -no clue how to generate the struct assignment... int -dComIfG_resDelete(request_of_phase_process_class* i_phase, char const* resName); +int dComIfG_resDelete(request_of_phase_process_class* i_phase, char const* resName); static int daDo_Delete(do_class* i_dogP) { u32 actor_id = fopAcM_GetID(i_dogP); dComIfG_resDelete(&i_dogP->mPhase, "Do"); @@ -2543,6 +2616,11 @@ static asm void daDo_Delete(do_class* param_0) { #endif /* 8066E504-8066E7D4 0068A4 02D0+00 1/1 0/0 0/0 .text useHeapInit__FP10fopAc_ac_c */ +#ifdef NONMATCHING +static void useHeapInit(fopAc_ac_c* param_0) { + +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -2552,6 +2630,7 @@ static asm void useHeapInit(fopAc_ac_c* param_0) { } #pragma pop +#endif /* 8066E7D4-8066E81C 006B74 0048+00 1/0 0/0 0/0 .text __dt__12J3DFrameCtrlFv */ #pragma push #pragma optimization_level 0 @@ -2593,6 +2672,11 @@ COMPILER_STRIP_GATE(0x8066EFAC, &lit_6424); #pragma pop /* 8066E81C-8066EAE4 006BBC 02C8+00 1/0 0/0 0/0 .text daDo_Create__FP10fopAc_ac_c */ +#ifdef NONMATCHING +static void daDo_Create(fopAc_ac_c* param_0) { + +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -2601,8 +2685,14 @@ static asm void daDo_Create(fopAc_ac_c* param_0) { #include "asm/rel/d/a/d_a_do/d_a_do/daDo_Create__FP10fopAc_ac_c.s" } #pragma pop +#endif /* 8066EAE4-8066EC40 006E84 015C+00 1/1 0/0 0/0 .text __ct__8do_classFv */ +#ifdef NONMATCHING +do_class::do_class() { + +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -2611,6 +2701,7 @@ asm do_class::do_class() { #include "asm/rel/d/a/d_a_do/d_a_do/__ct__8do_classFv.s" } #pragma pop +#endif /* 8066EC40-8066EC88 006FE0 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGSphFv */ #pragma push @@ -2660,7 +2751,8 @@ extern "C" asm void __dt__10daDo_HIO_cFv() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void __sinit_d_a_do_cpp(){nofralloc +asm void __sinit_d_a_do_cpp(){ + nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/__sinit_d_a_do_cpp.s" } #pragma pop From f0109a791d6a2e27edec789ac110055d9b039214 Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Sun, 22 Jan 2023 10:43:21 -0700 Subject: [PATCH 26/34] nodeCallBack --- rel/d/a/d_a_do/d_a_do.cpp | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 5692631b24d..22d181076b2 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -387,7 +387,6 @@ SECTION_DATA extern void* __vt__10daDo_HIO_c[3] = { }; /* 80667D4C-80667DA8 0000EC 005C+00 1/1 0/0 0/0 .text __ct__10daDo_HIO_cFv */ -#ifndef NONMATCHING daDo_HIO_c::daDo_HIO_c() { field_0x04 = -1; mBaseSize = FLOAT_LABEL(lit_3662); @@ -399,16 +398,6 @@ daDo_HIO_c::daDo_HIO_c() { mSwimming = 1; mWaterHuntAnimType = 0; } -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm daDo_HIO_c::daDo_HIO_c() { - nofralloc -#include "asm/rel/d/a/d_a_do/d_a_do/__ct__10daDo_HIO_cFv.s" -} -#pragma pop -#endif /* ############################################################################################## */ /* 8066EDFC-8066EE00 000014 0004+00 0/16 0/0 0/0 .rodata @3682 */ @@ -441,18 +430,16 @@ static void anm_init(do_class* i_dogP, int i_resIdx, f32 param_2, u8 param_3, f3 if (!(i_dogP->field_0x608 > FLOAT_LABEL(lit_3662))) { i_dogP->mpMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Do", i_resIdx), param_3, param_2, param_4, FLOAT_LABEL(lit_3682), FLOAT_LABEL(lit_3683), 0); - i_dogP->mAnmID = (daDo_Anm)i_resIdx; + i_dogP->mAnmID = i_resIdx; } } /* 80667E68-80667FE4 000208 017C+00 1/1 0/0 0/0 .text nodeCallBack__FP8J3DJointi */ -#ifdef NONMATCHING -// regalloc on user_area static int nodeCallBack(J3DJoint* i_jntP, int param_1) { if (param_1 == 0) { int joint_num = i_jntP->getJntNo(); J3DModel* model = j3dSys.getModel(); - UserArea* user_area = model->getUserArea(); + UserArea* user_area = (UserArea*)model->getUserArea(); if (user_area) { PSMTXCopy(model->i_getAnmMtx(joint_num), *calc_mtx); @@ -475,16 +462,6 @@ static int nodeCallBack(J3DJoint* i_jntP, int param_1) { } return 1; } -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void nodeCallBack(J3DJoint* param_0, int param_1) { - nofralloc -#include "asm/rel/d/a/d_a_do/d_a_do/nodeCallBack__FP8J3DJointi.s" -} -#pragma pop -#endif /* ############################################################################################## */ /* 8066EE04-8066EE08 00001C 0004+00 0/8 0/0 0/0 .rodata @3772 */ From 65715b82611a67d24d6289e5343ffaec575154ff Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Sun, 22 Jan 2023 10:47:45 -0700 Subject: [PATCH 27/34] water_check --- rel/d/a/d_a_do/d_a_do.cpp | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 22d181076b2..5caaa8ac620 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -480,7 +480,9 @@ COMPILER_STRIP_GATE(0x8066EE08, &lit_3773); /* 80667FE4-80668134 000384 0150+00 1/0 0/0 0/0 .text daDo_Draw__FP8do_class */ #ifdef NONMATCHING -static void daDo_Draw(do_class* i_dogP) {} +static void daDo_Draw(do_class* i_dogP) { + +} #else #pragma push #pragma optimization_level 0 @@ -833,16 +835,12 @@ SECTION_RODATA static f32 const lit_3994 = 8.0f; COMPILER_STRIP_GATE(0x8066EE20, &lit_3994); /* 80668754-8066886C 000AF4 0118+00 1/1 0/0 0/0 .text water_check__FP8do_class */ -#ifdef NONMATCHING -// regalloc static bool water_check(do_class* i_dogP) { dBgS_GndChk gnd_chk; Vec pos; - pos.x = i_dogP->current.pos.x; - pos.y = i_dogP->current.pos.y; - pos.z = i_dogP->current.pos.z; - pos.y = i_dogP->current.pos.x+FLOAT_LABEL(lit_3922); + pos = i_dogP->current.pos; + pos.y += FLOAT_LABEL(lit_3922); gnd_chk.SetPos(&pos); f32 f_gnd_chk = dComIfG_Bgsp().GroundCross(&gnd_chk); @@ -859,16 +857,6 @@ static bool water_check(do_class* i_dogP) { return 0; } } -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void water_check(do_class* i_dogP) { - nofralloc -#include "asm/rel/d/a/d_a_do/d_a_do/water_check__FP8do_class.s" -} -#pragma pop -#endif /* ############################################################################################## */ /* 8066EE24-8066EE28 00003C 0004+00 0/2 0/0 0/0 .rodata @4025 */ From d84cf3367b06fc704c396e9a5ca880dd02b910e9 Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Sun, 22 Jan 2023 17:36:03 -0700 Subject: [PATCH 28/34] do_wait_1 checkpoint --- include/rel/d/a/d_a_do/d_a_do.h | 4 +- rel/d/a/d_a_do/d_a_do.cpp | 523 +++++++++++++++++++++++++------- 2 files changed, 417 insertions(+), 110 deletions(-) diff --git a/include/rel/d/a/d_a_do/d_a_do.h b/include/rel/d/a/d_a_do/d_a_do.h index 7b4a76eafab..79e3bee5894 100644 --- a/include/rel/d/a/d_a_do/d_a_do.h +++ b/include/rel/d/a/d_a_do/d_a_do.h @@ -98,7 +98,7 @@ public: /* 0x5B5 */ u8 field_0x5b5; /* 0x5B6 */ u8 field_0x5b6; /* 0x5B7 */ u8 field_0x5b7; - /* 0x5B8 */ cXyz field_0x588; + /* 0x5B8 */ cXyz field_0x5b8; /* 0x5C4 */ u8 field_0x5c4[4]; /* 0x5C8 */ f32 mDistFromPlayer; /* 0x5CC */ s16 mAngleYFromPlayer; @@ -117,7 +117,7 @@ public: /* 0x5EC */ f32 field_0x5ec; /* 0x5F0 */ s16 field_0x5f0; /* 0x5F2 */ s16 mAction; - /* 0x5F4 */ u16 field_0x5f4; + /* 0x5F4 */ s16 field_0x5f4; /* 0x5F6 */ s16 mStayStatus; // probably a better name for this /* 0x5F8 */ u32 mShadowKey; /* 0x5FC */ s16 field_0x5fc[4]; diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 5caaa8ac620..2a17ad78897 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -884,7 +884,7 @@ COMPILER_STRIP_GATE(0x8066EE2C, &lit_4027); #ifdef NONMATCHING // regalloc static int dansa_check(do_class* i_dogP, cXyz i_pos, f32 param_2) { - i_pos.y += FLOAT_LABEL(lit_4025); + i_pos.y = i_pos.y + FLOAT_LABEL(lit_4025); dBgS_GndChk gnd_chk; Vec pos; @@ -911,7 +911,7 @@ static int dansa_check(do_class* i_dogP, cXyz i_pos, f32 param_2) { if (dComIfG_Bgsp().LineCross(&lin_chk) != 0) { return -1; } else { - if (depth_check(i_dogP,i_pos,FLOAT_LABEL(lit_4027)) && l_HIO[29] == 0) { + if (depth_check(i_dogP,i_pos,FLOAT_LABEL(lit_4027)) && l_HIO.mSwimming == 0) { return 0xffffff9c; } else { @@ -1050,10 +1050,10 @@ static void area_check(do_class* i_dogP) { cXyz pos_delta = i_dogP->orig.pos - i_dogP->current.pos; if (i_dogP->field_0x5b6 != 255) { - if ((i_dogP->field_0x5b6 * 100.f * 2.0f) > pos_delta.abs()) { + if ((i_dogP->field_0x5b6 * FLOAT_LABEL(lit_3772) * FLOAT_LABEL(lit_3665)) > pos_delta.abs()) { i_dogP->mAction = ACT_WALK; i_dogP->mStayStatus = -1; - i_dogP->field_0x600 = cM_rndF(100.0f) + 100.0f; // random value between 100 and 200 + i_dogP->field_0x5fc[2] = cM_rndF(FLOAT_LABEL(lit_3772)) + FLOAT_LABEL(lit_3772); // random value between 100 and 200 } } } @@ -1076,109 +1076,6 @@ SECTION_RODATA static f32 const lit_4189 = 20.0f; COMPILER_STRIP_GATE(0x8066EE60, &lit_4189); #pragma pop -/* 80668D5C-80669050 0010FC 02F4+00 2/1 0/0 0/0 .text do_stay__FP8do_class */ -#ifdef NONMATCHING -// regalloc and float literals -static void do_stay(do_class* i_dogP) { - switch (i_dogP->mStayStatus) { - case 0: { - if (i_dogP->field_0x5b4 == 0) { - anm_init(i_dogP,12,0.0f,2,FLOAT_LABEL(lit_3662)); // fix float literals - i_dogP->mStayStatus++; - i_dogP->field_0x5fc = 10; - } else { - i_dogP->mAction = ACT_WALK; - i_dogP->mStayStatus = 0; - return; - } - } - case 1: { - if (i_dogP->field_0x5fc == 0 && i_dogP->mDistFromPlayer < l_HIO.mRunSpeed) { - i_dogP->mStayStatus++; - i_dogP->field_0x5fc = cM_rndF(50.0) + 20.f; // fix float literals // random number between 20 and 70 - } - break; - } - case 2: { - i_dogP->field_0x616 = 1; - i_dogP->field_0x614 = 0xe764; - i_dogP->field_0x648 = 1000.0f; // fix float literals - if (i_dogP->field_0x5fc == 0) { - anm_init(i_dogP,11,0.0f,0,2.0f); // fix float literals - i_dogP->mStayStatus++; - } - break; - } - case 3: { - i_dogP->field_0x616 = 1; - i_dogP->field_0x648 = 2000.0f; // fix float literals - - if (i_dogP->mpMorf->isStop()) { - i_dogP->mAction = ACT_WALK_RUN; - i_dogP->mStayStatus = 0; - } - break; - } - case 10: { - anm_init(i_dogP,12,0.0f,2,2.0f); // fix float literals - i_dogP->mStayStatus++; - } - case 11: { - i_dogP->field_0x616 = 1; - i_dogP->field_0x614 = 0xe764; - i_dogP->field_0x648 = 1000.0f; // fix float literals - - if (i_dogP->mEyePosYDistFromPlayer > 30.0f) { - i_dogP->mStayStatus++; - i_dogP->field_0x5fc = cM_rndF(10.0) + 10.f; // fix float literals // random number between 10 and 20 - } - - if (i_dogP->mDistFromPlayer > l_HIO.mRunSpeed + 100.0f) { // fix float literals - i_dogP->field_0x5f4 = 0; - i_dogP->mStayStatus = 0; - } - break; - } - case 12: { - i_dogP->field_0x616 = 1; - i_dogP->field_0x614 = 0xe764; - i_dogP->field_0x648 = 1500.0f; - - if (i_dogP->mEyePosYDistFromPlayer > 30.0f) { - if (i_dogP->field_0x5fc == 0) { - anm_init(i_dogP,11,0.0f,0,2.0f); // fix float literals - i_dogP->mStayStatus = 13; - } - } else { - i_dogP->mStayStatus = 11; - } - break; - } - case 13: { - i_dogP->field_0x616 = 1; - i_dogP->field_0x648 = 1500.0f; // fix float literals - - if (i_dogP->mpMorf->isStop()) { - i_dogP->mAction = ACT_WAIT_1; - i_dogP->mStayStatus = 0; - } - } - } - - cLib_addCalc0(&i_dogP->mSpeedF,1.0f,1.0f); -} -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void do_stay(do_class* i_dogP) { - nofralloc -#include "asm/rel/d/a/d_a_do/d_a_do/do_stay__FP8do_class.s" -} -#pragma pop -#endif - -/* ############################################################################################## */ /* 8066EE64-8066EE68 00007C 0004+00 0/4 0/0 0/0 .rodata @4190 */ #pragma push #pragma force_active on @@ -1242,6 +1139,111 @@ SECTION_RODATA static f32 const lit_4339 = 300.0f; COMPILER_STRIP_GATE(0x8066EE84, &lit_4339); #pragma pop +/* 80668D5C-80669050 0010FC 02F4+00 2/1 0/0 0/0 .text do_stay__FP8do_class */ +#ifdef NONMATCHING +// regalloc and float literals +static void do_stay(do_class* i_dogP) { + switch (i_dogP->mStayStatus) { + case 0: { + if (i_dogP->field_0x5b4 == 0) { + anm_init(i_dogP,ANM_DOWN_WT,FLOAT_LABEL(lit_4069),2,FLOAT_LABEL(lit_3662)); + i_dogP->mStayStatus++; + i_dogP->field_0x5fc[0] = 10; + } else { + i_dogP->mAction = ACT_WALK; + i_dogP->mStayStatus = 0; + return; + } + } + case 1: { + if (i_dogP->field_0x5fc[0] == 0 && i_dogP->mDistFromPlayer < l_HIO.mRunSpeed) { + i_dogP->mStayStatus++; + i_dogP->field_0x5fc[0] = cM_rndF(FLOAT_LABEL(lit_3816)) + FLOAT_LABEL(lit_4189); // random number between 20 and 70 + } + break; + } + case 2: { + i_dogP->field_0x616 = 1; + i_dogP->field_0x614 = 0xe764; + i_dogP->field_0x648 = FLOAT_LABEL(lit_4190); + if (i_dogP->field_0x5fc[0] == 0) { + anm_init(i_dogP,ANM_DOWN,FLOAT_LABEL(lit_4027),0,FLOAT_LABEL(lit_3662)); + i_dogP->mStayStatus++; + } + break; + } + case 3: { + i_dogP->field_0x616 = 1; + i_dogP->field_0x648 = FLOAT_LABEL(lit_4191); + + if (i_dogP->mpMorf->isStop()) { + i_dogP->mAction = ACT_WALK_RUN; + i_dogP->mStayStatus = 0; + } + break; + } + case 10: { + anm_init(i_dogP,ANM_DOWN_WT,FLOAT_LABEL(lit_4069),2,FLOAT_LABEL(lit_3662)); + i_dogP->mStayStatus++; + } + case 11: { + i_dogP->field_0x616 = 1; + i_dogP->field_0x614 = 0xe764; + i_dogP->field_0x648 = FLOAT_LABEL(lit_4190); + + if (i_dogP->mEyePosYDistFromPlayer > FLOAT_LABEL(lit_3846)) { + i_dogP->mStayStatus++; + i_dogP->field_0x5fc[0] = cM_rndF(FLOAT_LABEL(lit_4192)) + FLOAT_LABEL(lit_4192); // random number between 10 and 20 + } + + if (i_dogP->mDistFromPlayer > FLOAT_LABEL(lit_3772) + l_HIO.mPlayerRecogniztionDist) { + i_dogP->field_0x5f4 = 0; + i_dogP->mStayStatus = 0; + } + break; + } + case 12: { + i_dogP->field_0x616 = 1; + i_dogP->field_0x614 = 0xe764; + i_dogP->field_0x648 = FLOAT_LABEL(lit_4193); + + if (i_dogP->mEyePosYDistFromPlayer > FLOAT_LABEL(lit_3846)) { + if (i_dogP->field_0x5fc[0] == 0) { + anm_init(i_dogP,ANM_DOWN,FLOAT_LABEL(lit_4194),0,FLOAT_LABEL(lit_3662)); + i_dogP->mStayStatus = 13; + } + } else { + i_dogP->mStayStatus = 11; + } + break; + } + case 13: { + i_dogP->field_0x616 = 1; + i_dogP->field_0x648 = FLOAT_LABEL(lit_4193); + + if (i_dogP->mpMorf->isStop()) { + i_dogP->mAction = ACT_WAIT_1; + i_dogP->mStayStatus = 0; + } + } + } + + f32* speedF = (f32*)&i_dogP->mSpeedF; + + cLib_addCalc0(speedF,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_3662)); +} +#else +#pragma push +#pragma optimization_level 0 +#pragma optimizewithasm off +static asm void do_stay(do_class* i_dogP) { + nofralloc +#include "asm/rel/d/a/d_a_do/d_a_do/do_stay__FP8do_class.s" +} +#pragma pop +#endif + +/* ############################################################################################## */ /* 8066EE88-8066EE8C 0000A0 0004+00 0/1 0/0 0/0 .rodata @4340 */ #pragma push #pragma force_active on @@ -1286,8 +1288,144 @@ COMPILER_STRIP_GATE(0x8066EE9C, &lit_4345); /* 80669050-8066973C 0013F0 06EC+00 2/1 0/0 0/0 .text do_walk__FP8do_class */ #ifdef NONMATCHING +// float literals + regalloc static void do_walk(do_class* i_dogP) { + cXyz local_5c; + i_dogP->field_0x648 = 1000.0; + + switch(i_dogP->mStayStatus+1) { + case 12: { + i_dogP->field_0x5b8 = i_dogP->orig.pos; + i_dogP->mSpeedF >= l_HIO.mRunSpeed ? i_dogP->field_0x5e8 = 1.7 : i_dogP->field_0x5e8 = 4.0; + + i_dogP->field_0x5ec = 1.7; + anm_init(i_dogP,ANM_WALK,0.0,2,i_dogP->field_0x5e8); + i_dogP->mStayStatus = 3; + break; + } + case 0: { + if (i_dogP->field_0x5f4 == 8) { + anm_init(i_dogP,ANM_SIT,0.0,0,1.0); + } + else { + anm_init(i_dogP,ANM_DOWN,0.0,0,1.0); + } + + i_dogP->mStayStatus++; + break; + } + + case 1: { + if (i_dogP->mpMorf->isStop()) { + i_dogP->mStayStatus++;; + } + break; + } + + case 2: { + local_5c.x = 0.0; + local_5c.y = 20.0; + + for (int i = 0; i < 100; i++) { + mDoMtx_YrotS((MtxP)calc_mtx,cM_rndF(65536.0)); + + local_5c.z = cM_rndF(100.0f * i_dogP->field_0x5b6); + MtxPosition(&local_5c,&i_dogP->field_0x5b8); + + i_dogP->field_0x5b8 += i_dogP->orig.pos; + + if (dansa_check(i_dogP,i_dogP->field_0x5b8,0.0) == 0) { + local_5c = i_dogP->field_0x5b8 - i_dogP->current.pos; + + if (local_5c.abs() > 300.0f) break; + } + } + + f32 rnd_number = cM_rndF(0.6); + i_dogP->field_0x5ec = rnd_number + 1.3; + i_dogP->field_0x5e8 = rnd_number + 1.3; + + anm_init(i_dogP,ANM_WALK,0.0,2,i_dogP->field_0x5e8); + + i_dogP->mStayStatus++; + } + + case 3: { + local_5c = i_dogP->field_0x5b8 - i_dogP->current.pos; + + cLib_addCalcAngleS2(&i_dogP->current.angle.y,(s16)cM_atan2s(local_5c.x,local_5c.z),0x10,0x100); + cLib_addCalc2(&i_dogP->mSpeedF,i_dogP->field_0x5e8 * l_HIO.mWalkSpeed,1.0,l_HIO.mWalkSpeed * 0.2); + + if (local_5c.abs() < 150.0) { + if (i_dogP->field_0x5b4 == 0) { + i_dogP->mAction = ACT_STAY; + i_dogP->mStayStatus = 0; + } else { + anm_init(i_dogP,ANM_WAIT,0.0,2,1.0); + i_dogP->field_0x5fc[0] = cM_rndF(50.0) + 20.0; + i_dogP->field_0x5ec = 1.0; + i_dogP->mStayStatus++; + } + } + + break; + } + + case 4: { + cLib_addCalc0(&i_dogP->mSpeedF,1.0,1.0); + + if (i_dogP->field_0x5fc[0] == 0) { + i_dogP->mStayStatus = 2; + } + + break; + } + + case 10: { + cLib_addCalc0(&i_dogP->mSpeedF,1.0,1.0); + cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->mAngleYFromPlayer,4,0x400); + + i_dogP->field_0x616 = 1; + i_dogP->field_0x648 = 2000.0; + + s16 angle_diff = i_dogP->current.angle.y - i_dogP->mAngleYFromPlayer; + + if (angle_diff < 0) { + angle_diff *= -1; + } + + if (angle_diff < 0x800) { + i_dogP->mStayStatus++; + anm_init(i_dogP,ANM_WAIT,0.0,2,1.0); + i_dogP->field_0x5ec = 1.0; + i_dogP->field_0x5fc[0] = cM_rndF(10.0) + 10.0; + } + + break; + } + + case 11: { + i_dogP->field_0x616 = 1; + i_dogP->field_0x648 = 3000.0; + if (i_dogP->field_0x5fc[0] == 0) { + i_dogP->mAction = ACT_WALK_RUN; + i_dogP->mStayStatus = 0; + return; + } + break; + } + + } + cLib_addCalc2(&i_dogP->field_0x5e8,i_dogP->field_0x5ec,1.0,0.05); + i_dogP->mpMorf->setPlaySpeed(i_dogP->field_0x5e8); + + if (i_dogP->field_0x5fc[2] == 0 && i_dogP->mStayStatus < 10 && i_dogP->mDistFromPlayer < l_HIO.mPlayerRecogniztionDist) { + anm_init(i_dogP,ANM_STEP_2,0.0,2,1.0); + i_dogP->mStayStatus = 10; + } + + move_dansa_check(i_dogP,i_dogP->mSpeedF); } #else #pragma push @@ -1477,7 +1615,176 @@ static void do_run_walk(do_class* i_dogP) { /* 80669B80-8066A1C4 001F20 0644+00 2/1 0/0 0/0 .text do_wait_1__FP8do_class */ #ifdef NONMATCHING static void do_wait_1(do_class* i_dogP) { - + fopAc_ac_c* player = dComIfGp_getPlayer(0); + i_dogP->field_0x616 = 1; + i_dogP->field_0x648 = 2000.0; + + s16 player_angle = i_dogP->mAngleYFromPlayer; + s16 angle_diff = i_dogP->current.angle.y - player_angle; + + if (angle_diff < 0) { + angle_diff *= -1; + } + + s16 some_val = 0x3000; + + if ((i_dogP->field_0x5f0 & 0x7fU) == 0) { + some_val = 0x1000; + } + + switch(i_dogP->mStayStatus) { + case 0: { + if (i_dogP->mDistFromPlayer <= i_dogP->field_0x674.z * 320.0) { + anm_init(i_dogP,ANM_WAIT,0.0,2,0.0); + i_dogP->mStayStatus++; + } else { + anm_init(i_dogP,ANM_JOYFUL,0.0,2,cM_rndFX(0.1) + 0.6); + i_dogP->mStayStatus = -1; + } + // goto default; + } + case 2: { + cLib_addCalcAngleS2(&i_dogP->current.angle.y,player_angle,4,0x400); + + if (angle_diff < 0x800) { + i_dogP->mStayStatus = 0; + } + + break; + } + case 3: { + if (75.0 <= i_dogP->mEyePosYDistFromPlayer) { + i_dogP->mStayStatus = 1; + } else if (i_dogP->field_0x5fc[0] == 0) { + if (30.0 <= i_dogP->mEyePosYDistFromPlayer) { + i_dogP->mAction = ACT_SIT; + i_dogP->mStayStatus = 0; + } else { + i_dogP->mAction = ACT_STAY; + i_dogP->mStayStatus = 10; + } + } + break; + } + case 5: { + cLib_addCalcAngleS2(&i_dogP->current.angle.y,player_angle + i_dogP->field_0x654,4,0x800); + cLib_addCalcAngleS2(&i_dogP->field_0x654,i_dogP->field_0x656,4,0x1000); + cLib_addCalc2(&i_dogP->current.pos.x,i_dogP->field_0x5b8.x,0.2,3.5); + cLib_addCalc2(&i_dogP->current.pos.z,i_dogP->field_0x5b8.z,0.2,3.5); + + if (i_dogP->field_0x5fc[0] == 0) { + i_dogP->mStayStatus = 0; + } + break; + } + case 6: { + i_dogP->field_0x648 = 4000.0; + + if (i_dogP->field_0x674.z * 176.0 < i_dogP->mDistFromPlayer) { + i_dogP->mStayStatus = 0; + } + } + default: { + if (some_val < angle_diff) { + anm_init(i_dogP,ANM_STEP_2,0.0,2,0.0); + i_dogP->mStayStatus = 2; + } else if (75.0 <= i_dogP->mEyePosYDistFromPlayer) { + + // i_dogP->field_0x674.z might be a store in a variable + if (i_dogP->field_0x674.z * 96.0 <= i_dogP->mDistFromPlayer) { + if ((i_dogP->mStayStatus != 6) && (i_dogP->mDistFromPlayer < i_dogP->field_0x674.z * 120.0)) { + anm_init(i_dogP,ANM_JOYFUL,0.0,2,cM_rndFX(0.1) + 1.0); + i_dogP->mStayStatus = 6; + } + } else { + cXyz local_68; + local_68.x = 0.0; + f32 dVar10 = 20.0; + local_68.y = 20.0; + + f32 dVar11 = -176.0; + f32 dVar12 = 0.2000000029802322; + + for (int i = 0; i < 20; i++) { + if (i < 10) { + mDoMtx_YrotS((MtxP)calc_mtx,i_dogP->mAngleYFromPlayer + cM_rndFX(5000.0)); + } else { + mDoMtx_YrotS((MtxP)calc_mtx,cM_rndF(65536.0)); + } + + local_68.z = dVar11 * i_dogP->field_0x674.z; + + MtxPosition(&local_68,&i_dogP->field_0x5b8); + i_dogP->field_0x5b8 += player->current.pos; + + if (cM_rndF(1.0) < dVar12) break; + + // local_74 = i_dogP->field6_0x5b8; + if (dansa_check(i_dogP,i_dogP->field_0x5b8,0.0) == 0) break; + + i_dogP->mUnkPos = i_dogP->field_0x5b8; + i_dogP->field_0x624 = dVar10 + cM_rndF(10.0); + } + + i_dogP->mStayStatus = 5; + i_dogP->field_0x656 = cM_rndFX(10000.0); + + anm_init(i_dogP,ANM_WALK,0.0,2,0.0); + i_dogP->field_0x5fc[0] = cM_rndF(10.0) + 15.0; + } + } + else { + i_dogP->mStayStatus = 3; + i_dogP->field_0x5fc[0] = cM_rndF(10.0) + 10.0; + } + break; + } + case 10: { + i_dogP->field_0x5e8 = 5.0; + anm_init(i_dogP,ANM_WALK,0.0,2,i_dogP->field_0x5e8); + + i_dogP->mStayStatus++; + } + case 11: { + cLib_addCalc2(&i_dogP->field_0x5e8,2.0,1.0,0.2); + i_dogP->mpMorf->setPlaySpeed(i_dogP->field_0x5e8); + + if (i_dogP->field_0x5e8 <= 2.2) { + i_dogP->mStayStatus = 0; + } + + break; + } + case -1: {} + case 1: { + // goto default; + } + } + + cLib_addCalc0(&i_dogP->mSpeedF,1.0,1.0); + + if (i_dogP->field_0x674.z * 240.0 < i_dogP->mDistFromPlayer && !dansa_check2(i_dogP,0.0) && i_dogP->mStayStatus < 10) { + i_dogP->mAction = ACT_WALK_RUN; + i_dogP->field_0x5e8 = 1.5; + anm_init(i_dogP,ANM_WALK,0.0,2,i_dogP->field_0x5e8); + i_dogP->mStayStatus = 1; + } + + // might be a seperate variable for link + if (daPy_getLinkPlayerActorClass()->checkCanoeRide() && i_dogP->mDistFromPlayer < 1000.0) { + i_dogP->mAction = ACT_HELP; + i_dogP->mStayStatus = 0; + } + + if (i_dogP->field_0x5b4 == 2) { + f32 distance = i_dogP->mDistFromPlayer * 0.0215; + + if (127.0 < distance) { + distance = 127.0; + } + + i_dogP->mSound.startLevelSound(JAISoundID(Z2SE_DOG_V_CALL_HELP),distance,-1); + } } #else #pragma push From ed8acec2e8b3d0f97b18dec0887f24fd8b0ff9fc Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Sun, 22 Jan 2023 20:33:18 -0700 Subject: [PATCH 29/34] do_wait_2 --- rel/d/a/d_a_do/d_a_do.cpp | 61 ++++++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 11 deletions(-) diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 2a17ad78897..6728e1679d5 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -1897,20 +1897,53 @@ COMPILER_STRIP_GATE(0x8066EEFC, &lit_4588); #pragma pop /* 8066A1C4-8066A3D0 002564 020C+00 1/1 0/0 0/0 .text do_wait_2__FP8do_class */ -#ifdef NONMATCHING static void do_wait_2(do_class* i_dogP) { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + + i_dogP->field_0x616 = 1; + i_dogP->field_0x648 = FLOAT_LABEL(lit_4400); + + switch(i_dogP->mStayStatus) { + case 0: { + i_dogP->mStayStatus++; + } + case 1: { + if (i_dogP->field_0x5fc[0] == 0) { + i_dogP->field_0x5fc[0] = cM_rndF(FLOAT_LABEL(lit_4189)) + FLOAT_LABEL(lit_4192); + i_dogP->field_0x656 = cM_rndFX(FLOAT_LABEL(lit_4587)); + + cM_rndF(FLOAT_LABEL(lit_3662)) < FLOAT_LABEL(lit_4588) ? i_dogP->field_0x5e8 = cM_rndF(FLOAT_LABEL(lit_4342)) + FLOAT_LABEL(lit_3665) : i_dogP->field_0x5e8 = -(cM_rndF(FLOAT_LABEL(lit_4342)) + FLOAT_LABEL(lit_3665)); + + anm_init(i_dogP,ANM_STEP,FLOAT_LABEL(lit_4194),2,i_dogP->field_0x5e8); + mDoMtx_YrotS((MtxP)calc_mtx,player->shape_angle.y); + + Vec local_38; + + local_38.x = cM_rndFX(FLOAT_LABEL(lit_3772)); + local_38.y = FLOAT_LABEL(lit_3682); + local_38.z = cM_rndF(FLOAT_LABEL(lit_3816)) + FLOAT_LABEL(lit_4551); + + MtxPosition((cXyz*)&local_38,&i_dogP->field_0x5b8); + i_dogP->field_0x5b8 += player->current.pos; + } + + break; + } + } + cLib_addCalc2(&i_dogP->current.pos.x,i_dogP->field_0x5b8.x,FLOAT_LABEL(lit_4342),FLOAT_LABEL(lit_3665)); + cLib_addCalc2(&i_dogP->current.pos.z,i_dogP->field_0x5b8.z,FLOAT_LABEL(lit_4342),FLOAT_LABEL(lit_3665)); + cLib_addCalc0(&i_dogP->mSpeedF,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_3665)); + cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->mAngleYFromPlayer + i_dogP->field_0x654,4,0x800); + cLib_addCalcAngleS2(&i_dogP->field_0x654,i_dogP->field_0x656,4,0x1000); + + if (i_dogP->mDistFromPlayer > FLOAT_LABEL(lit_3923) * i_dogP->field_0x674.z) { + i_dogP->mAction = ACT_RUN; + i_dogP->mStayStatus = 0; + } + + area_check(i_dogP); } -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void do_wait_2(do_class* i_dogP) { - nofralloc -#include "asm/rel/d/a/d_a_do/d_a_do/do_wait_2__FP8do_class.s" -} -#pragma pop -#endif /* 8066A3D0-8066A5DC 002770 020C+00 1/1 0/0 0/0 .text do_sit__FP8do_class */ #ifdef NONMATCHING @@ -2266,6 +2299,11 @@ COMPILER_STRIP_GATE(0x8066EF68, &lit_5480); #pragma pop /* 8066CAA8-8066CDEC 004E48 0344+00 1/1 0/0 0/0 .text do_carry__FP8do_class */ +#ifdef NONMATCHING +static asm u8 do_carry(do_class* i_dogP) { + +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -2274,6 +2312,7 @@ static asm u8 do_carry(do_class* i_dogP) { #include "asm/rel/d/a/d_a_do/d_a_do/do_carry__FP8do_class.s" } #pragma pop +#endif /* 8066CDEC-8066CEC4 00518C 00D8+00 1/1 0/0 0/0 .text do_message__FP8do_class */ static void do_message(do_class* i_dogP) { From f47e53b8a22f9835b07eb2f10db8cd3295c17db4 Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Sun, 22 Jan 2023 21:42:01 -0700 Subject: [PATCH 30/34] do_sit --- include/m_Do/m_Do_ext.h | 1 + rel/d/a/d_a_do/d_a_do.cpp | 70 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/include/m_Do/m_Do_ext.h b/include/m_Do/m_Do_ext.h index 3f9d17c7565..faa63921f4e 100644 --- a/include/m_Do/m_Do_ext.h +++ b/include/m_Do/m_Do_ext.h @@ -20,6 +20,7 @@ public: f32 getFrame() { return mFrameCtrl.getFrame(); } f32 getEndFrame() { return mFrameCtrl.getEnd(); } void setFrame(f32 frame) { mFrameCtrl.setFrame(frame); } + bool isStop() { bool stopped = true; if (!mFrameCtrl.checkState(1) && mFrameCtrl.getRate() != 0.0f) { diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 6728e1679d5..db04f79c4c9 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -1947,8 +1947,78 @@ static void do_wait_2(do_class* i_dogP) { /* 8066A3D0-8066A5DC 002770 020C+00 1/1 0/0 0/0 .text do_sit__FP8do_class */ #ifdef NONMATCHING +// matches except float literal in inline static void do_sit(do_class* i_dogP) { + i_dogP->field_0x616 = 1; + i_dogP->field_0x648 = FLOAT_LABEL(lit_4190); + + switch (i_dogP->mStayStatus) { + + + case 0: { + anm_init(i_dogP,ANM_SIT_WAIT,FLOAT_LABEL(lit_4192),2,FLOAT_LABEL(lit_3662)); + i_dogP->mStayStatus++; + } + + case 1: { + if (i_dogP->mEyePosYDistFromPlayer > FLOAT_LABEL(lit_4545)) { + i_dogP->mStayStatus = 3; + i_dogP->field_0x5fc[0] = cM_rndF(FLOAT_LABEL(lit_4192)) + FLOAT_LABEL(lit_4192); + } else { + if (i_dogP->mEyePosYDistFromPlayer < FLOAT_LABEL(lit_3846)) { + i_dogP->mStayStatus = 2; + i_dogP->field_0x5fc[0] = cM_rndF(FLOAT_LABEL(lit_4192)) + FLOAT_LABEL(lit_4192); + } + } + break; + } + + case 2: { + if (i_dogP->mEyePosYDistFromPlayer < FLOAT_LABEL(lit_3846) ) { + if (i_dogP->field_0x5fc[0] == 0) { + i_dogP->mAction = ACT_STAY; + i_dogP->mStayStatus = 10; + } + } else { + i_dogP->mStayStatus = 1; + } + break; + } + + case 3: { + if (i_dogP->mEyePosYDistFromPlayer > FLOAT_LABEL(lit_4545)) { + if (i_dogP->field_0x5fc[0] == 0) { + anm_init(i_dogP,ANM_SIT,FLOAT_LABEL(lit_4194),0,FLOAT_LABEL(lit_3662)); + i_dogP->mStayStatus++; + } + } else { + i_dogP->mStayStatus = 1; + } + + break; + } + + case 4: { + if (i_dogP->mpMorf->isStop()) { + i_dogP->mAction = ACT_WAIT_1; + i_dogP->mStayStatus = 0; + } + break; + } + + + } + + cLib_addCalc0(&i_dogP->mSpeedF,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_3665)); + + if (i_dogP->mDistFromPlayer > FLOAT_LABEL(lit_3773) * i_dogP->field_0x674.z) { + i_dogP->mAction = ACT_STAY; + i_dogP->field_0x5f4 = 8; + i_dogP->mStayStatus = 0; + } + + area_check(i_dogP); } #else #pragma push From 737da6afea6054035a030cf2ea923d5937bb5c28 Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Thu, 26 Jan 2023 10:49:49 -0700 Subject: [PATCH 31/34] checkpoint --- include/JSystem/JParticle/JPAParticle.h | 4 ++ rel/d/a/d_a_do/d_a_do.cpp | 49 ++++++++++++++++++++----- 2 files changed, 43 insertions(+), 10 deletions(-) diff --git a/include/JSystem/JParticle/JPAParticle.h b/include/JSystem/JParticle/JPAParticle.h index dc4f2127ed3..958f6ed63c1 100644 --- a/include/JSystem/JParticle/JPAParticle.h +++ b/include/JSystem/JParticle/JPAParticle.h @@ -237,6 +237,10 @@ public: void setRate(f32 rate) { mRate = rate; } void setEmitterCallBackPtr(JPAEmitterCallBack* ptr) { mpEmtrCallBack = ptr; } void setGlobalRTMatrix(const Mtx m) { JPASetRMtxTVecfromMtx(m, mGlobalRot, &mGlobalTrs); } + void setGlobalScale(const JGeometry::TVec3& scale) { + mGlobalScl = scale; + mGlobalPScl = scale; + } f32 get_r_f() { return mRndm.get_rndm_f(); } f32 get_r_zp() { return mRndm.get_rndm_zp(); } diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index db04f79c4c9..6eddc7fd1f9 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -948,7 +948,7 @@ COMPILER_STRIP_GATE(0x8066EE34, &lit_4058); /* 80668A30-80668B18 000DD0 00E8+00 3/3 0/0 0/0 .text dansa_check2__FP8do_classf */ #ifdef NONMATCHING -// floats in wrong order +// float regalloc static bool dansa_check2(do_class* i_dogP, f32 param_1) { cXyz pos; cXyz pos2; @@ -956,14 +956,8 @@ static bool dansa_check2(do_class* i_dogP, f32 param_1) { mDoMtx_YrotS((MtxP)calc_mtx,i_dogP->current.angle.y); pos.x = FLOAT_LABEL(lit_3682); pos.y = FLOAT_LABEL(lit_4057); - f32 tmp = i_dogP->field_0x674.z; - - f32 tmp1 = FLOAT_LABEL(lit_3981) * param_1; - f32 tmp3 = tmp1 * tmp; - f32 tmp2 = FLOAT_LABEL(lit_4058) * i_dogP->mSpeedF * i_dogP->field_0x674.z * FLOAT_LABEL(lit_3981); - - pos.z = tmp3 + tmp2; + pos.z = tmp * (FLOAT_LABEL(lit_3981) * param_1) + tmp * (FLOAT_LABEL(lit_3981) * i_dogP->mSpeedF) * FLOAT_LABEL(lit_4058); MtxPosition(&pos,&pos2); pos2 += i_dogP->current.pos; @@ -2332,9 +2326,44 @@ COMPILER_STRIP_GATE(0x8066EF5C, &lit_5407); #pragma pop /* 8066C894-8066CAA8 004C34 0214+00 1/1 0/0 0/0 .text do_a_swim__FP8do_class */ -#ifdef NONMATCHING +#ifndef NONMATCHING static void do_a_swim(do_class* i_dogP) { - + i_dogP->field_0x648 = 2000.0; + cLib_addCalc0(&i_dogP->mSpeedF,1.0,1.0); + + switch (i_dogP->mStayStatus) { + case 2: { + l_HIO.mWaterHuntAnimType == 1 ? i_dogP->mpMorf->setPlaySpeed(i_dogP->field46_0x634 * 5.0) : i_dogP->mpMorf->setPlaySpeed(i_dogP->field46_0x634 * 5.0); + + if (0.025 < i_dogP->field_0x634) { + break; + } + + i_dogP->field_0x634 = 0.0; + i_dogP->mAction = ACT_WAIT_1; + i_dogP->mStayStatus = 0; + break; + } + case 0: { + l_HIO.mWaterHuntAnimType == 1 ? anm_init(param_1,ANM_JOYFUL,0.0,2,0.0) : anm_init(param_1,ANM_BULBUL,0.0,2,0.0); + i_dogP->mStayStatus = 1; + i_dogP->field32_0x5fc[0] = 0x14; + + JPABaseEmitter* emitter = dComIfGp_particle_set(0x2a3,&i_dogP->.current.pos,0,0); + + if (emitter) { + emitter->setGlobalRTMatrix(i_dogP->mpMorf->getModel()->getAnmMtx(2)); + cXyz pos = cXyz(0.6,0.6,0.6); + emitter->setGlobalScale(pTVar3); + } + } + } + + if (i_dogP->field_0x5fc[0] == 0) { + i_dogP->mStayStatus = 2; + i_dogP->field_0x634 = 0.1; + i_dogP->field_0x638 = 1.0; + } } #else #pragma push From 9456881d2e93fb90683ba00bebaabfd03c26713a Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Sat, 4 Feb 2023 16:08:25 -0700 Subject: [PATCH 32/34] comment out d_a_swim --- include/JSystem/JParticle/JPAParticle.h | 8 ++++---- rel/d/a/d_a_do/d_a_do.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/JSystem/JParticle/JPAParticle.h b/include/JSystem/JParticle/JPAParticle.h index 958f6ed63c1..31590055f20 100644 --- a/include/JSystem/JParticle/JPAParticle.h +++ b/include/JSystem/JParticle/JPAParticle.h @@ -237,10 +237,10 @@ public: void setRate(f32 rate) { mRate = rate; } void setEmitterCallBackPtr(JPAEmitterCallBack* ptr) { mpEmtrCallBack = ptr; } void setGlobalRTMatrix(const Mtx m) { JPASetRMtxTVecfromMtx(m, mGlobalRot, &mGlobalTrs); } - void setGlobalScale(const JGeometry::TVec3& scale) { - mGlobalScl = scale; - mGlobalPScl = scale; - } + // void setGlobalScale(const JGeometry::TVec3& scale) { + // mGlobalScl = scale; + // mGlobalPScl = scale; + // } f32 get_r_f() { return mRndm.get_rndm_f(); } f32 get_r_zp() { return mRndm.get_rndm_zp(); } diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 6eddc7fd1f9..a00002bb626 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -2326,7 +2326,7 @@ COMPILER_STRIP_GATE(0x8066EF5C, &lit_5407); #pragma pop /* 8066C894-8066CAA8 004C34 0214+00 1/1 0/0 0/0 .text do_a_swim__FP8do_class */ -#ifndef NONMATCHING +#ifdef NONMATCHING static void do_a_swim(do_class* i_dogP) { i_dogP->field_0x648 = 2000.0; cLib_addCalc0(&i_dogP->mSpeedF,1.0,1.0); From 9eb63d9f68127210092008a49ce229bdbb8b7c65 Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Sat, 4 Feb 2023 16:17:00 -0700 Subject: [PATCH 33/34] fixes from actor class member name changes --- rel/d/a/d_a_do/d_a_do.cpp | 1203 ++++++++++++++++++------------------- 1 file changed, 601 insertions(+), 602 deletions(-) diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index a00002bb626..377d8177761 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -175,7 +175,6 @@ 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* __vt__8dCcD_Sph[36]; extern "C" extern void* __vt__9dCcD_Stts[11]; extern "C" extern void* __vt__12cCcD_SphAttr[25]; @@ -426,11 +425,11 @@ SECTION_DEAD static char const* const stringBase_8066EFB0 = "Do"; #pragma pop /* 80667DA8-80667E68 000148 00C0+00 16/16 0/0 0/0 .text anm_init__FP8do_classifUcf */ -static void anm_init(do_class* i_dogP, int i_resIdx, f32 param_2, u8 param_3, f32 param_4) { - if (!(i_dogP->field_0x608 > FLOAT_LABEL(lit_3662))) { - i_dogP->mpMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Do", i_resIdx), param_3, +static void anm_init(do_class* i_this, int i_resIdx, f32 param_2, u8 param_3, f32 param_4) { + if (!(i_this->field_0x608 > FLOAT_LABEL(lit_3662))) { + i_this->mpMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Do", i_resIdx), param_3, param_2, param_4, FLOAT_LABEL(lit_3682), FLOAT_LABEL(lit_3683), 0); - i_dogP->mAnmID = i_resIdx; + i_this->mAnmID = i_resIdx; } } @@ -480,14 +479,14 @@ COMPILER_STRIP_GATE(0x8066EE08, &lit_3773); /* 80667FE4-80668134 000384 0150+00 1/0 0/0 0/0 .text daDo_Draw__FP8do_class */ #ifdef NONMATCHING -static void daDo_Draw(do_class* i_dogP) { +static void daDo_Draw(do_class* i_this) { } #else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void daDo_Draw(do_class* i_dogP) { +static asm void daDo_Draw(do_class* i_this) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/daDo_Draw__FP8do_class.s" } @@ -512,12 +511,12 @@ COMPILER_STRIP_GATE(0x8066EE0C, &lit_3816); /* 80668170-80668264 000510 00F4+00 1/1 0/0 0/0 .text * daDo_other_bg_check__FP8do_classP10fopAc_ac_c */ -static int daDo_other_bg_check(do_class* i_dogP, fopAc_ac_c* i_actorP) { +static int daDo_other_bg_check(do_class* i_this, fopAc_ac_c* i_actorP) { Vec dog_pos; // defining as cXyz moves the destructor above this function, breaking the TU Vec actor_pos; // defining as cXyz moves the destructor above this function, breaking the TU fopAc_ac_c* actor = (fopAc_ac_c*)i_actorP; // required for match, maybe fake match? - do_class* dog = (do_class*)i_dogP; // required for match, maybe fake match? + do_class* dog = (do_class*)i_this; // required for match, maybe fake match? dBgS_LinChk lin_chk; @@ -546,16 +545,16 @@ SECTION_RODATA static f32 const lit_3846 = 30.0f; COMPILER_STRIP_GATE(0x8066EE10, &lit_3846); /* 80668264-8066833C 000604 00D8+00 1/1 0/0 0/0 .text daDo_other_bg_check2__FP8do_classP4cXyz */ -static int daDo_other_bg_check2(do_class* i_dogP, cXyz* i_posP) { +static int daDo_other_bg_check2(do_class* i_this, cXyz* i_posP) { Vec dog_pos; // defining as cXyz moves the destructor above this function, breaking the TU Vec i_pos; // defining as cXyz moves the destructor above this function, breaking the TU cXyz* pos = (cXyz*)i_posP; // required for match, maybe fake match? - do_class* dog = (do_class*)i_dogP; // required for match, maybe fake match? + do_class* dog = (do_class*)i_this; // required for match, maybe fake match? dBgS_LinChk lin_chk; - // do_class* dog = (do_class*)i_dogP; // required for match, maybe fake match? + // do_class* dog = (do_class*)i_this; // required for match, maybe fake match? i_pos = *pos; i_pos.y += FLOAT_LABEL(lit_3846); @@ -706,7 +705,7 @@ static int target_bgc[5]; /* 806683C0-8066858C 000760 01CC+00 1/1 0/0 0/0 .text search_food__FP8do_class */ #ifdef NONMATCHING // gave up. ghidra is not even close -static u32 search_food(do_class* i_dogP) { +static u32 search_food(do_class* i_this) { int ret; target_info_count = 0; @@ -715,7 +714,7 @@ static u32 search_food(do_class* i_dogP) { target_bgc[i] = 0; } - i_fpcM_Search((fpcLyIt_JudgeFunc)s_w_sub, i_dogP); + i_fpcM_Search((fpcLyIt_JudgeFunc)s_w_sub, i_this); f32 tmp = FLOAT_LABEL(lit_3662); if (target_info_count != 0) { @@ -725,13 +724,13 @@ static u32 search_food(do_class* i_dogP) { do { // for (int j = 0; j != target_info_count; j++) { fopAc_ac_c* actorP = target_info[i]; - f32 x_pos = actorP->current.pos.x - i_dogP->mEyePos.x; - f32 z_pos = actorP->current.pos.z - i_dogP->mEyePos.z; + f32 x_pos = actorP->current.pos.x - i_this->mEyePos.x; + f32 z_pos = actorP->current.pos.z - i_this->mEyePos.z; f32 f_pos = JMAFastSqrt(x_pos * x_pos + z_pos * z_pos); if (f_pos < tmp) { if (target_bgc[i] == 0) { - if (daDo_other_bg_check(i_dogP, actorP) == 0) { + if (daDo_other_bg_check(i_this, actorP) == 0) { target_bgc[i] = 1; if (!actorP) { @@ -750,7 +749,7 @@ static u32 search_food(do_class* i_dogP) { i++; pos_check += 100.0f; - } while (pos_check <= i_dogP->field_0x674.z * 240.0f); + } while (pos_check <= i_this->field_0x674.z * 240.0f); } else { ret = -1; } @@ -761,7 +760,7 @@ static u32 search_food(do_class* i_dogP) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm u32 search_food(do_class* i_dogP) { +static asm u32 search_food(do_class* i_this) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/search_food__FP8do_class.s" } @@ -769,20 +768,20 @@ static asm u32 search_food(do_class* i_dogP) { #endif /* 8066858C-806685EC 00092C 0060+00 1/1 0/0 0/0 .text food_check__FP8do_class */ -static void food_check(do_class* i_dogP) { - i_dogP->mFoodActorID = search_food(i_dogP); +static void food_check(do_class* i_this) { + i_this->mFoodActorID = search_food(i_this); - if (fopAcM_SearchByID(i_dogP->mFoodActorID)) { - i_dogP->mAction = ACT_FOOD; - i_dogP->mStayStatus = 0; + if (fopAcM_SearchByID(i_this->mFoodActorID)) { + i_this->mAction = ACT_FOOD; + i_this->mStayStatus = 0; } } /* 806685EC-80668624 00098C 0038+00 1/1 0/0 0/0 .text do_carry_check__FP8do_class */ -static int do_carry_check(do_class* i_dogP) { - if (i_dogP->mAction != ACT_CARRY && fopAcM_checkCarryNow(i_dogP)) { - i_dogP->mAction = ACT_CARRY; - i_dogP->mStayStatus = 0; +static int do_carry_check(do_class* i_this) { + if (i_this->mAction != ACT_CARRY && fopAcM_checkCarryNow(i_this)) { + i_this->mAction = ACT_CARRY; + i_this->mStayStatus = 0; return 1; } @@ -798,7 +797,7 @@ COMPILER_STRIP_GATE(0x8066EE1C, &lit_3981); #pragma pop /* 80668624-80668754 0009C4 0130+00 1/1 0/0 0/0 .text depth_check__FP8do_class4cXyzf */ -static BOOL depth_check(do_class* i_dogP, cXyz i_pos, f32 param_2) { +static BOOL depth_check(do_class* i_this, cXyz i_pos, f32 param_2) { dBgS_GndChk gnd_chk; Vec pos; f32 f_gnd_chk; @@ -820,7 +819,7 @@ static BOOL depth_check(do_class* i_dogP, cXyz i_pos, f32 param_2) { sub_res = f_gnd_chk_spl - f_gnd_chk; mul_res = FLOAT_LABEL(lit_3665) * param_2 * FLOAT_LABEL(lit_3981); - f_res = mul_res * i_dogP->field_0x674.z; + f_res = mul_res * i_this->field_0x674.z; if (sub_res > f_res) { return 1; @@ -835,11 +834,11 @@ SECTION_RODATA static f32 const lit_3994 = 8.0f; COMPILER_STRIP_GATE(0x8066EE20, &lit_3994); /* 80668754-8066886C 000AF4 0118+00 1/1 0/0 0/0 .text water_check__FP8do_class */ -static bool water_check(do_class* i_dogP) { +static bool water_check(do_class* i_this) { dBgS_GndChk gnd_chk; Vec pos; - pos = i_dogP->current.pos; + pos = i_this->current.pos; pos.y += FLOAT_LABEL(lit_3922); gnd_chk.SetPos(&pos); @@ -847,9 +846,9 @@ static bool water_check(do_class* i_dogP) { dBgS_ObjGndChk_Spl gnd_chk_spl; gnd_chk_spl.SetPos(&pos); - i_dogP->field_0x65c = dComIfG_Bgsp().GroundCross(&gnd_chk_spl); - f32 sub_res = i_dogP->field_0x65c - f_gnd_chk; - f32 mul_res = FLOAT_LABEL(lit_3994) * i_dogP->field_0x674.z; + i_this->field_0x65c = dComIfG_Bgsp().GroundCross(&gnd_chk_spl); + f32 sub_res = i_this->field_0x65c - f_gnd_chk; + f32 mul_res = FLOAT_LABEL(lit_3994) * i_this->field_0x674.z; if (sub_res > mul_res) { return 1; @@ -883,7 +882,7 @@ COMPILER_STRIP_GATE(0x8066EE2C, &lit_4027); /* 8066886C-80668A30 000C0C 01C4+00 4/4 0/0 0/0 .text dansa_check__FP8do_class4cXyzf */ #ifdef NONMATCHING // regalloc -static int dansa_check(do_class* i_dogP, cXyz i_pos, f32 param_2) { +static int dansa_check(do_class* i_this, cXyz i_pos, f32 param_2) { i_pos.y = i_pos.y + FLOAT_LABEL(lit_4025); dBgS_GndChk gnd_chk; @@ -895,23 +894,23 @@ static int dansa_check(do_class* i_dogP, cXyz i_pos, f32 param_2) { gnd_chk.SetPos(&pos); f32 f_gnd_chk = dComIfG_Bgsp().GroundCross(&gnd_chk); - if (i_dogP->current.pos.y - f_gnd_chk > param_2) { + if (i_this->current.pos.y - f_gnd_chk > param_2) { return 1; } else { dBgS_LinChk lin_chk; cXyz pos2; - pos2.x = i_dogP->current.pos.x; - pos2.y = i_dogP->current.pos.y; - pos2.z = i_dogP->current.pos.z; - pos2.y = i_dogP->current.pos.y + FLOAT_LABEL(lit_4026); + pos2.x = i_this->current.pos.x; + pos2.y = i_this->current.pos.y; + pos2.z = i_this->current.pos.z; + pos2.y = i_this->current.pos.y + FLOAT_LABEL(lit_4026); - lin_chk.Set(&pos2,&i_pos,i_dogP); + lin_chk.Set(&pos2,&i_pos,i_this); if (dComIfG_Bgsp().LineCross(&lin_chk) != 0) { return -1; } else { - if (depth_check(i_dogP,i_pos,FLOAT_LABEL(lit_4027)) && l_HIO.mSwimming == 0) { + if (depth_check(i_this,i_pos,FLOAT_LABEL(lit_4027)) && l_HIO.mSwimming == 0) { return 0xffffff9c; } else { @@ -924,7 +923,7 @@ static int dansa_check(do_class* i_dogP, cXyz i_pos, f32 param_2) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm int dansa_check(do_class* i_dogP, cXyz param_1, f32 param_2) { +static asm int dansa_check(do_class* i_this, cXyz param_1, f32 param_2) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/dansa_check__FP8do_class4cXyzf.s" } @@ -949,25 +948,25 @@ COMPILER_STRIP_GATE(0x8066EE34, &lit_4058); /* 80668A30-80668B18 000DD0 00E8+00 3/3 0/0 0/0 .text dansa_check2__FP8do_classf */ #ifdef NONMATCHING // float regalloc -static bool dansa_check2(do_class* i_dogP, f32 param_1) { +static bool dansa_check2(do_class* i_this, f32 param_1) { cXyz pos; cXyz pos2; - mDoMtx_YrotS((MtxP)calc_mtx,i_dogP->current.angle.y); + mDoMtx_YrotS((MtxP)calc_mtx,i_this->current.angle.y); pos.x = FLOAT_LABEL(lit_3682); pos.y = FLOAT_LABEL(lit_4057); - f32 tmp = i_dogP->field_0x674.z; - pos.z = tmp * (FLOAT_LABEL(lit_3981) * param_1) + tmp * (FLOAT_LABEL(lit_3981) * i_dogP->mSpeedF) * FLOAT_LABEL(lit_4058); + f32 tmp = i_this->field_0x674.z; + pos.z = tmp * (FLOAT_LABEL(lit_3981) * param_1) + tmp * (FLOAT_LABEL(lit_3981) * i_this->speedF) * FLOAT_LABEL(lit_4058); MtxPosition(&pos,&pos2); - pos2 += i_dogP->current.pos; - return dansa_check(i_dogP,pos2,FLOAT_LABEL(lit_3772)) != 0; + pos2 += i_this->current.pos; + return dansa_check(i_this,pos2,FLOAT_LABEL(lit_3772)) != 0; } #else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm int dansa_check2(do_class* i_dogP, f32 param_1) { +static asm int dansa_check2(do_class* i_this, f32 param_1) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/dansa_check2__FP8do_classf.s" } @@ -984,14 +983,14 @@ SECTION_RODATA static f32 const lit_4069 = 15.0f; COMPILER_STRIP_GATE(0x8066EE3C, &lit_4069); /* 80668B18-80668BA0 000EB8 0088+00 4/4 0/0 0/0 .text move_dansa_check__FP8do_classf */ -static int move_dansa_check(do_class* i_dogP, f32 i_speed) { - if (dansa_check2(i_dogP,FLOAT_LABEL(lit_4068)) != 0) { - i_dogP->mAction = ACT_WAIT_1; +static int move_dansa_check(do_class* i_this, f32 i_speed) { + if (dansa_check2(i_this,FLOAT_LABEL(lit_4068)) != 0) { + i_this->mAction = ACT_WAIT_1; if (i_speed > FLOAT_LABEL(lit_4069)) { - i_dogP->mStayStatus = 10; + i_this->mStayStatus = 10; } else { - i_dogP->mStayStatus = 0; + i_this->mStayStatus = 0; } return 1; @@ -1040,14 +1039,14 @@ COMPILER_STRIP_GATE(0x8066EE58, &lit_4138); /* 80668BA0-80668D5C 000F40 01BC+00 5/5 0/0 0/0 .text area_check__FP8do_class */ #ifdef NONMATCHING // matches with literals -static void area_check(do_class* i_dogP) { - cXyz pos_delta = i_dogP->orig.pos - i_dogP->current.pos; +static void area_check(do_class* i_this) { + cXyz pos_delta = i_this->orig.pos - i_this->current.pos; - if (i_dogP->field_0x5b6 != 255) { - if ((i_dogP->field_0x5b6 * FLOAT_LABEL(lit_3772) * FLOAT_LABEL(lit_3665)) > pos_delta.abs()) { - i_dogP->mAction = ACT_WALK; - i_dogP->mStayStatus = -1; - i_dogP->field_0x5fc[2] = cM_rndF(FLOAT_LABEL(lit_3772)) + FLOAT_LABEL(lit_3772); // random value between 100 and 200 + if (i_this->field_0x5b6 != 255) { + if ((i_this->field_0x5b6 * FLOAT_LABEL(lit_3772) * FLOAT_LABEL(lit_3665)) > pos_delta.abs()) { + i_this->mAction = ACT_WALK; + i_this->mStayStatus = -1; + i_this->field_0x5fc[2] = cM_rndF(FLOAT_LABEL(lit_3772)) + FLOAT_LABEL(lit_3772); // random value between 100 and 200 } } } @@ -1055,7 +1054,7 @@ static void area_check(do_class* i_dogP) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void area_check(do_class* i_dogP) { +static asm void area_check(do_class* i_this) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/area_check__FP8do_class.s" } @@ -1136,93 +1135,93 @@ COMPILER_STRIP_GATE(0x8066EE84, &lit_4339); /* 80668D5C-80669050 0010FC 02F4+00 2/1 0/0 0/0 .text do_stay__FP8do_class */ #ifdef NONMATCHING // regalloc and float literals -static void do_stay(do_class* i_dogP) { - switch (i_dogP->mStayStatus) { +static void do_stay(do_class* i_this) { + switch (i_this->mStayStatus) { case 0: { - if (i_dogP->field_0x5b4 == 0) { - anm_init(i_dogP,ANM_DOWN_WT,FLOAT_LABEL(lit_4069),2,FLOAT_LABEL(lit_3662)); - i_dogP->mStayStatus++; - i_dogP->field_0x5fc[0] = 10; + if (i_this->field_0x5b4 == 0) { + anm_init(i_this,ANM_DOWN_WT,FLOAT_LABEL(lit_4069),2,FLOAT_LABEL(lit_3662)); + i_this->mStayStatus++; + i_this->field_0x5fc[0] = 10; } else { - i_dogP->mAction = ACT_WALK; - i_dogP->mStayStatus = 0; + i_this->mAction = ACT_WALK; + i_this->mStayStatus = 0; return; } } case 1: { - if (i_dogP->field_0x5fc[0] == 0 && i_dogP->mDistFromPlayer < l_HIO.mRunSpeed) { - i_dogP->mStayStatus++; - i_dogP->field_0x5fc[0] = cM_rndF(FLOAT_LABEL(lit_3816)) + FLOAT_LABEL(lit_4189); // random number between 20 and 70 + if (i_this->field_0x5fc[0] == 0 && i_this->mDistFromPlayer < l_HIO.mRunSpeed) { + i_this->mStayStatus++; + i_this->field_0x5fc[0] = cM_rndF(FLOAT_LABEL(lit_3816)) + FLOAT_LABEL(lit_4189); // random number between 20 and 70 } break; } case 2: { - i_dogP->field_0x616 = 1; - i_dogP->field_0x614 = 0xe764; - i_dogP->field_0x648 = FLOAT_LABEL(lit_4190); - if (i_dogP->field_0x5fc[0] == 0) { - anm_init(i_dogP,ANM_DOWN,FLOAT_LABEL(lit_4027),0,FLOAT_LABEL(lit_3662)); - i_dogP->mStayStatus++; + i_this->field_0x616 = 1; + i_this->field_0x614 = 0xe764; + i_this->field_0x648 = FLOAT_LABEL(lit_4190); + if (i_this->field_0x5fc[0] == 0) { + anm_init(i_this,ANM_DOWN,FLOAT_LABEL(lit_4027),0,FLOAT_LABEL(lit_3662)); + i_this->mStayStatus++; } break; } case 3: { - i_dogP->field_0x616 = 1; - i_dogP->field_0x648 = FLOAT_LABEL(lit_4191); + i_this->field_0x616 = 1; + i_this->field_0x648 = FLOAT_LABEL(lit_4191); - if (i_dogP->mpMorf->isStop()) { - i_dogP->mAction = ACT_WALK_RUN; - i_dogP->mStayStatus = 0; + if (i_this->mpMorf->isStop()) { + i_this->mAction = ACT_WALK_RUN; + i_this->mStayStatus = 0; } break; } case 10: { - anm_init(i_dogP,ANM_DOWN_WT,FLOAT_LABEL(lit_4069),2,FLOAT_LABEL(lit_3662)); - i_dogP->mStayStatus++; + anm_init(i_this,ANM_DOWN_WT,FLOAT_LABEL(lit_4069),2,FLOAT_LABEL(lit_3662)); + i_this->mStayStatus++; } case 11: { - i_dogP->field_0x616 = 1; - i_dogP->field_0x614 = 0xe764; - i_dogP->field_0x648 = FLOAT_LABEL(lit_4190); + i_this->field_0x616 = 1; + i_this->field_0x614 = 0xe764; + i_this->field_0x648 = FLOAT_LABEL(lit_4190); - if (i_dogP->mEyePosYDistFromPlayer > FLOAT_LABEL(lit_3846)) { - i_dogP->mStayStatus++; - i_dogP->field_0x5fc[0] = cM_rndF(FLOAT_LABEL(lit_4192)) + FLOAT_LABEL(lit_4192); // random number between 10 and 20 + if (i_this->mEyePosYDistFromPlayer > FLOAT_LABEL(lit_3846)) { + i_this->mStayStatus++; + i_this->field_0x5fc[0] = cM_rndF(FLOAT_LABEL(lit_4192)) + FLOAT_LABEL(lit_4192); // random number between 10 and 20 } - if (i_dogP->mDistFromPlayer > FLOAT_LABEL(lit_3772) + l_HIO.mPlayerRecogniztionDist) { - i_dogP->field_0x5f4 = 0; - i_dogP->mStayStatus = 0; + if (i_this->mDistFromPlayer > FLOAT_LABEL(lit_3772) + l_HIO.mPlayerRecogniztionDist) { + i_this->field_0x5f4 = 0; + i_this->mStayStatus = 0; } break; } case 12: { - i_dogP->field_0x616 = 1; - i_dogP->field_0x614 = 0xe764; - i_dogP->field_0x648 = FLOAT_LABEL(lit_4193); + i_this->field_0x616 = 1; + i_this->field_0x614 = 0xe764; + i_this->field_0x648 = FLOAT_LABEL(lit_4193); - if (i_dogP->mEyePosYDistFromPlayer > FLOAT_LABEL(lit_3846)) { - if (i_dogP->field_0x5fc[0] == 0) { - anm_init(i_dogP,ANM_DOWN,FLOAT_LABEL(lit_4194),0,FLOAT_LABEL(lit_3662)); - i_dogP->mStayStatus = 13; + if (i_this->mEyePosYDistFromPlayer > FLOAT_LABEL(lit_3846)) { + if (i_this->field_0x5fc[0] == 0) { + anm_init(i_this,ANM_DOWN,FLOAT_LABEL(lit_4194),0,FLOAT_LABEL(lit_3662)); + i_this->mStayStatus = 13; } } else { - i_dogP->mStayStatus = 11; + i_this->mStayStatus = 11; } break; } case 13: { - i_dogP->field_0x616 = 1; - i_dogP->field_0x648 = FLOAT_LABEL(lit_4193); + i_this->field_0x616 = 1; + i_this->field_0x648 = FLOAT_LABEL(lit_4193); - if (i_dogP->mpMorf->isStop()) { - i_dogP->mAction = ACT_WAIT_1; - i_dogP->mStayStatus = 0; + if (i_this->mpMorf->isStop()) { + i_this->mAction = ACT_WAIT_1; + i_this->mStayStatus = 0; } } } - f32* speedF = (f32*)&i_dogP->mSpeedF; + f32* speedF = (f32*)&i_this->speedF; cLib_addCalc0(speedF,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_3662)); } @@ -1230,7 +1229,7 @@ static void do_stay(do_class* i_dogP) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_stay(do_class* i_dogP) { +static asm void do_stay(do_class* i_this) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_stay__FP8do_class.s" } @@ -1283,35 +1282,35 @@ COMPILER_STRIP_GATE(0x8066EE9C, &lit_4345); /* 80669050-8066973C 0013F0 06EC+00 2/1 0/0 0/0 .text do_walk__FP8do_class */ #ifdef NONMATCHING // float literals + regalloc -static void do_walk(do_class* i_dogP) { +static void do_walk(do_class* i_this) { cXyz local_5c; - i_dogP->field_0x648 = 1000.0; + i_this->field_0x648 = 1000.0; - switch(i_dogP->mStayStatus+1) { + switch(i_this->mStayStatus+1) { case 12: { - i_dogP->field_0x5b8 = i_dogP->orig.pos; - i_dogP->mSpeedF >= l_HIO.mRunSpeed ? i_dogP->field_0x5e8 = 1.7 : i_dogP->field_0x5e8 = 4.0; + i_this->field_0x5b8 = i_this->orig.pos; + i_this->speedF >= l_HIO.mRunSpeed ? i_this->field_0x5e8 = 1.7 : i_this->field_0x5e8 = 4.0; - i_dogP->field_0x5ec = 1.7; - anm_init(i_dogP,ANM_WALK,0.0,2,i_dogP->field_0x5e8); - i_dogP->mStayStatus = 3; + i_this->field_0x5ec = 1.7; + anm_init(i_this,ANM_WALK,0.0,2,i_this->field_0x5e8); + i_this->mStayStatus = 3; break; } case 0: { - if (i_dogP->field_0x5f4 == 8) { - anm_init(i_dogP,ANM_SIT,0.0,0,1.0); + if (i_this->field_0x5f4 == 8) { + anm_init(i_this,ANM_SIT,0.0,0,1.0); } else { - anm_init(i_dogP,ANM_DOWN,0.0,0,1.0); + anm_init(i_this,ANM_DOWN,0.0,0,1.0); } - i_dogP->mStayStatus++; + i_this->mStayStatus++; break; } case 1: { - if (i_dogP->mpMorf->isStop()) { - i_dogP->mStayStatus++;; + if (i_this->mpMorf->isStop()) { + i_this->mStayStatus++;; } break; } @@ -1323,42 +1322,42 @@ static void do_walk(do_class* i_dogP) { for (int i = 0; i < 100; i++) { mDoMtx_YrotS((MtxP)calc_mtx,cM_rndF(65536.0)); - local_5c.z = cM_rndF(100.0f * i_dogP->field_0x5b6); - MtxPosition(&local_5c,&i_dogP->field_0x5b8); + local_5c.z = cM_rndF(100.0f * i_this->field_0x5b6); + MtxPosition(&local_5c,&i_this->field_0x5b8); - i_dogP->field_0x5b8 += i_dogP->orig.pos; + i_this->field_0x5b8 += i_this->orig.pos; - if (dansa_check(i_dogP,i_dogP->field_0x5b8,0.0) == 0) { - local_5c = i_dogP->field_0x5b8 - i_dogP->current.pos; + if (dansa_check(i_this,i_this->field_0x5b8,0.0) == 0) { + local_5c = i_this->field_0x5b8 - i_this->current.pos; if (local_5c.abs() > 300.0f) break; } } f32 rnd_number = cM_rndF(0.6); - i_dogP->field_0x5ec = rnd_number + 1.3; - i_dogP->field_0x5e8 = rnd_number + 1.3; + i_this->field_0x5ec = rnd_number + 1.3; + i_this->field_0x5e8 = rnd_number + 1.3; - anm_init(i_dogP,ANM_WALK,0.0,2,i_dogP->field_0x5e8); + anm_init(i_this,ANM_WALK,0.0,2,i_this->field_0x5e8); - i_dogP->mStayStatus++; + i_this->mStayStatus++; } case 3: { - local_5c = i_dogP->field_0x5b8 - i_dogP->current.pos; + local_5c = i_this->field_0x5b8 - i_this->current.pos; - cLib_addCalcAngleS2(&i_dogP->current.angle.y,(s16)cM_atan2s(local_5c.x,local_5c.z),0x10,0x100); - cLib_addCalc2(&i_dogP->mSpeedF,i_dogP->field_0x5e8 * l_HIO.mWalkSpeed,1.0,l_HIO.mWalkSpeed * 0.2); + cLib_addCalcAngleS2(&i_this->current.angle.y,(s16)cM_atan2s(local_5c.x,local_5c.z),0x10,0x100); + cLib_addCalc2(&i_this->speedF,i_this->field_0x5e8 * l_HIO.mWalkSpeed,1.0,l_HIO.mWalkSpeed * 0.2); if (local_5c.abs() < 150.0) { - if (i_dogP->field_0x5b4 == 0) { - i_dogP->mAction = ACT_STAY; - i_dogP->mStayStatus = 0; + if (i_this->field_0x5b4 == 0) { + i_this->mAction = ACT_STAY; + i_this->mStayStatus = 0; } else { - anm_init(i_dogP,ANM_WAIT,0.0,2,1.0); - i_dogP->field_0x5fc[0] = cM_rndF(50.0) + 20.0; - i_dogP->field_0x5ec = 1.0; - i_dogP->mStayStatus++; + anm_init(i_this,ANM_WAIT,0.0,2,1.0); + i_this->field_0x5fc[0] = cM_rndF(50.0) + 20.0; + i_this->field_0x5ec = 1.0; + i_this->mStayStatus++; } } @@ -1366,44 +1365,44 @@ static void do_walk(do_class* i_dogP) { } case 4: { - cLib_addCalc0(&i_dogP->mSpeedF,1.0,1.0); + cLib_addCalc0(&i_this->speedF,1.0,1.0); - if (i_dogP->field_0x5fc[0] == 0) { - i_dogP->mStayStatus = 2; + if (i_this->field_0x5fc[0] == 0) { + i_this->mStayStatus = 2; } break; } case 10: { - cLib_addCalc0(&i_dogP->mSpeedF,1.0,1.0); - cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->mAngleYFromPlayer,4,0x400); + cLib_addCalc0(&i_this->speedF,1.0,1.0); + cLib_addCalcAngleS2(&i_this->current.angle.y,i_this->mAngleYFromPlayer,4,0x400); - i_dogP->field_0x616 = 1; - i_dogP->field_0x648 = 2000.0; + i_this->field_0x616 = 1; + i_this->field_0x648 = 2000.0; - s16 angle_diff = i_dogP->current.angle.y - i_dogP->mAngleYFromPlayer; + s16 angle_diff = i_this->current.angle.y - i_this->mAngleYFromPlayer; if (angle_diff < 0) { angle_diff *= -1; } if (angle_diff < 0x800) { - i_dogP->mStayStatus++; - anm_init(i_dogP,ANM_WAIT,0.0,2,1.0); - i_dogP->field_0x5ec = 1.0; - i_dogP->field_0x5fc[0] = cM_rndF(10.0) + 10.0; + i_this->mStayStatus++; + anm_init(i_this,ANM_WAIT,0.0,2,1.0); + i_this->field_0x5ec = 1.0; + i_this->field_0x5fc[0] = cM_rndF(10.0) + 10.0; } break; } case 11: { - i_dogP->field_0x616 = 1; - i_dogP->field_0x648 = 3000.0; - if (i_dogP->field_0x5fc[0] == 0) { - i_dogP->mAction = ACT_WALK_RUN; - i_dogP->mStayStatus = 0; + i_this->field_0x616 = 1; + i_this->field_0x648 = 3000.0; + if (i_this->field_0x5fc[0] == 0) { + i_this->mAction = ACT_WALK_RUN; + i_this->mStayStatus = 0; return; } break; @@ -1411,21 +1410,21 @@ static void do_walk(do_class* i_dogP) { } - cLib_addCalc2(&i_dogP->field_0x5e8,i_dogP->field_0x5ec,1.0,0.05); - i_dogP->mpMorf->setPlaySpeed(i_dogP->field_0x5e8); + cLib_addCalc2(&i_this->field_0x5e8,i_this->field_0x5ec,1.0,0.05); + i_this->mpMorf->setPlaySpeed(i_this->field_0x5e8); - if (i_dogP->field_0x5fc[2] == 0 && i_dogP->mStayStatus < 10 && i_dogP->mDistFromPlayer < l_HIO.mPlayerRecogniztionDist) { - anm_init(i_dogP,ANM_STEP_2,0.0,2,1.0); - i_dogP->mStayStatus = 10; + if (i_this->field_0x5fc[2] == 0 && i_this->mStayStatus < 10 && i_this->mDistFromPlayer < l_HIO.mPlayerRecogniztionDist) { + anm_init(i_this,ANM_STEP_2,0.0,2,1.0); + i_this->mStayStatus = 10; } - move_dansa_check(i_dogP,i_dogP->mSpeedF); + move_dansa_check(i_this,i_this->speedF); } #else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_walk(do_class* i_dogP) { +static asm void do_walk(do_class* i_this) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_walk__FP8do_class.s" } @@ -1448,37 +1447,37 @@ COMPILER_STRIP_GATE(0x8066EEA4, &lit_4378); #pragma pop /* 8066973C-806698D0 001ADC 0194+00 1/1 0/0 0/0 .text do_walk_run__FP8do_class */ -static void do_walk_run(do_class* i_dogP) { - i_dogP->field_0x616 = 1; - i_dogP->field_0x648 = FLOAT_LABEL(lit_4344); +static void do_walk_run(do_class* i_this) { + i_this->field_0x616 = 1; + i_this->field_0x648 = FLOAT_LABEL(lit_4344); - switch (i_dogP->mStayStatus) { + switch (i_this->mStayStatus) { case 0: { - i_dogP->field_0x5e8 = FLOAT_LABEL(lit_4377); - anm_init(i_dogP,22,FLOAT_LABEL(lit_4192),2,i_dogP->field_0x5e8); - i_dogP->mStayStatus++; + i_this->field_0x5e8 = FLOAT_LABEL(lit_4377); + anm_init(i_this,22,FLOAT_LABEL(lit_4192),2,i_this->field_0x5e8); + i_this->mStayStatus++; } case 1: { - cLib_addCalc2(&i_dogP->field_0x5e8,FLOAT_LABEL(lit_3665),FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4345)); - i_dogP->mpMorf->setPlaySpeed(i_dogP->field_0x5e8); + cLib_addCalc2(&i_this->field_0x5e8,FLOAT_LABEL(lit_3665),FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4345)); + i_this->mpMorf->setPlaySpeed(i_this->field_0x5e8); - if (i_dogP->field_0x5e8 >= FLOAT_LABEL(lit_3665) ) { - i_dogP->mAction = ACT_RUN; - i_dogP->mStayStatus = 0; - i_dogP->mSound.startSound(JAISoundID(Z2SE_DOG_BARK),0,-1); + if (i_this->field_0x5e8 >= FLOAT_LABEL(lit_3665) ) { + i_this->mAction = ACT_RUN; + i_this->mStayStatus = 0; + i_this->mSound.startSound(JAISoundID(Z2SE_DOG_BARK),0,-1); } } default: { - cLib_addCalc2(&i_dogP->mSpeedF, i_dogP->field_0x5e8 * l_HIO.mWalkSpeed, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4342) * l_HIO.mWalkSpeed); - cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->mAngleYFromPlayer,8,0x400); + cLib_addCalc2(&i_this->speedF, i_this->field_0x5e8 * l_HIO.mWalkSpeed, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4342) * l_HIO.mWalkSpeed); + cLib_addCalcAngleS2(&i_this->current.angle.y,i_this->mAngleYFromPlayer,8,0x400); - if (i_dogP->mDistFromPlayer < FLOAT_LABEL(lit_4378) * i_dogP->field_0x674.z) { - l_HIO.field_0x1c != 0 ? i_dogP->mAction = ACT_WAIT_2 : i_dogP->mAction = ACT_WAIT_1; - i_dogP->mStayStatus = 0; + if (i_this->mDistFromPlayer < FLOAT_LABEL(lit_4378) * i_this->field_0x674.z) { + l_HIO.field_0x1c != 0 ? i_this->mAction = ACT_WAIT_2 : i_this->mAction = ACT_WAIT_1; + i_this->mStayStatus = 0; } - area_check(i_dogP); - move_dansa_check(i_dogP,i_dogP->mSpeedF); + area_check(i_this); + move_dansa_check(i_this,i_this->speedF); } } } @@ -1534,31 +1533,31 @@ COMPILER_STRIP_GATE(0x8066EEC0, &lit_4406); #pragma pop /* 806698D0-80669A1C 001C70 014C+00 1/1 0/0 0/0 .text do_run__FP8do_class */ -static void do_run(do_class* i_dogP) { - i_dogP->field_0x616 = 1; - i_dogP->field_0x648 = FLOAT_LABEL(lit_4400); +static void do_run(do_class* i_this) { + i_this->field_0x616 = 1; + i_this->field_0x648 = FLOAT_LABEL(lit_4400); - switch (i_dogP->mStayStatus) { + switch (i_this->mStayStatus) { case 0: { - i_dogP->field_0x5e8 = FLOAT_LABEL(lit_3662); - i_dogP->field_0x5ec = cM_rndF(FLOAT_LABEL(lit_4402))+FLOAT_LABEL(lit_4401); - anm_init(i_dogP,14,FLOAT_LABEL(lit_3665),2,FLOAT_LABEL(lit_4403)*i_dogP->field_0x5e8); - i_dogP->mStayStatus++; + i_this->field_0x5e8 = FLOAT_LABEL(lit_3662); + i_this->field_0x5ec = cM_rndF(FLOAT_LABEL(lit_4402))+FLOAT_LABEL(lit_4401); + anm_init(i_this,14,FLOAT_LABEL(lit_3665),2,FLOAT_LABEL(lit_4403)*i_this->field_0x5e8); + i_this->mStayStatus++; } case 1: { - cLib_addCalc2(&i_dogP->field_0x5e8,i_dogP->field_0x5ec,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4404)); - i_dogP->mpMorf->setPlaySpeed(i_dogP->field_0x5e8); + cLib_addCalc2(&i_this->field_0x5e8,i_this->field_0x5ec,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4404)); + i_this->mpMorf->setPlaySpeed(i_this->field_0x5e8); - if (i_dogP->mDistFromPlayer < FLOAT_LABEL(lit_4405)*i_dogP->field_0x674.z) { - i_dogP->mAction = ACT_RUN_WALK; - i_dogP->mStayStatus = 0; + if (i_this->mDistFromPlayer < FLOAT_LABEL(lit_4405)*i_this->field_0x674.z) { + i_this->mAction = ACT_RUN_WALK; + i_this->mStayStatus = 0; } } default: { - cLib_addCalc2(&i_dogP->mSpeedF, i_dogP->field_0x5e8 * l_HIO.mRunSpeed * FLOAT_LABEL(lit_4406), FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4342) * l_HIO.mRunSpeed); - cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->mAngleYFromPlayer,8,0x800); - area_check(i_dogP); - move_dansa_check(i_dogP,i_dogP->mSpeedF); + cLib_addCalc2(&i_this->speedF, i_this->field_0x5e8 * l_HIO.mRunSpeed * FLOAT_LABEL(lit_4406), FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4342) * l_HIO.mRunSpeed); + cLib_addCalcAngleS2(&i_this->current.angle.y,i_this->mAngleYFromPlayer,8,0x800); + area_check(i_this); + move_dansa_check(i_this,i_this->speedF); } } } @@ -1572,49 +1571,49 @@ COMPILER_STRIP_GATE(0x8066EEC4, &lit_4435); #pragma pop /* 80669A1C-80669B80 001DBC 0164+00 1/1 0/0 0/0 .text do_run_walk__FP8do_class */ -static void do_run_walk(do_class* i_dogP) { - i_dogP->field_0x616 = 1; - i_dogP->field_0x648 = FLOAT_LABEL(lit_4344); +static void do_run_walk(do_class* i_this) { + i_this->field_0x616 = 1; + i_this->field_0x648 = FLOAT_LABEL(lit_4344); - switch (i_dogP->mStayStatus) { + switch (i_this->mStayStatus) { case 0: { - i_dogP->field_0x5e8 = FLOAT_LABEL(lit_4336); - anm_init(i_dogP,22,FLOAT_LABEL(lit_4194),2,i_dogP->field_0x5e8); - i_dogP->mStayStatus++; + i_this->field_0x5e8 = FLOAT_LABEL(lit_4336); + anm_init(i_this,22,FLOAT_LABEL(lit_4194),2,i_this->field_0x5e8); + i_this->mStayStatus++; } case 1: { - cLib_addCalc2(&i_dogP->field_0x5e8,FLOAT_LABEL(lit_4401),FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4345)); - i_dogP->mpMorf->setPlaySpeed(i_dogP->field_0x5e8); + cLib_addCalc2(&i_this->field_0x5e8,FLOAT_LABEL(lit_4401),FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4345)); + i_this->mpMorf->setPlaySpeed(i_this->field_0x5e8); } default: { - cLib_addCalc2(&i_dogP->mSpeedF, i_dogP->field_0x5e8 * l_HIO.mWalkSpeed, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4027)); - cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->mAngleYFromPlayer,8,0x400); + cLib_addCalc2(&i_this->speedF, i_this->field_0x5e8 * l_HIO.mWalkSpeed, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4027)); + cLib_addCalcAngleS2(&i_this->current.angle.y,i_this->mAngleYFromPlayer,8,0x400); - if (i_dogP->mDistFromPlayer < FLOAT_LABEL(lit_4378) * i_dogP->field_0x674.z) { - l_HIO.field_0x1c != 0 ? i_dogP->mAction = ACT_WAIT_2 : i_dogP->mAction = ACT_WAIT_1; - i_dogP->mStayStatus = 0; + if (i_this->mDistFromPlayer < FLOAT_LABEL(lit_4378) * i_this->field_0x674.z) { + l_HIO.field_0x1c != 0 ? i_this->mAction = ACT_WAIT_2 : i_this->mAction = ACT_WAIT_1; + i_this->mStayStatus = 0; } else { - if (i_dogP->mDistFromPlayer > FLOAT_LABEL(lit_4435) * i_dogP->field_0x674.z) { - i_dogP->mAction = ACT_RUN; - i_dogP->mStayStatus = 0; + if (i_this->mDistFromPlayer > FLOAT_LABEL(lit_4435) * i_this->field_0x674.z) { + i_this->mAction = ACT_RUN; + i_this->mStayStatus = 0; } } - area_check(i_dogP); - move_dansa_check(i_dogP,i_dogP->mSpeedF); + area_check(i_this); + move_dansa_check(i_this,i_this->speedF); } } } /* 80669B80-8066A1C4 001F20 0644+00 2/1 0/0 0/0 .text do_wait_1__FP8do_class */ #ifdef NONMATCHING -static void do_wait_1(do_class* i_dogP) { +static void do_wait_1(do_class* i_this) { fopAc_ac_c* player = dComIfGp_getPlayer(0); - i_dogP->field_0x616 = 1; - i_dogP->field_0x648 = 2000.0; + i_this->field_0x616 = 1; + i_this->field_0x648 = 2000.0; - s16 player_angle = i_dogP->mAngleYFromPlayer; - s16 angle_diff = i_dogP->current.angle.y - player_angle; + s16 player_angle = i_this->mAngleYFromPlayer; + s16 angle_diff = i_this->current.angle.y - player_angle; if (angle_diff < 0) { angle_diff *= -1; @@ -1622,73 +1621,73 @@ static void do_wait_1(do_class* i_dogP) { s16 some_val = 0x3000; - if ((i_dogP->field_0x5f0 & 0x7fU) == 0) { + if ((i_this->field_0x5f0 & 0x7fU) == 0) { some_val = 0x1000; } - switch(i_dogP->mStayStatus) { + switch(i_this->mStayStatus) { case 0: { - if (i_dogP->mDistFromPlayer <= i_dogP->field_0x674.z * 320.0) { - anm_init(i_dogP,ANM_WAIT,0.0,2,0.0); - i_dogP->mStayStatus++; + if (i_this->mDistFromPlayer <= i_this->field_0x674.z * 320.0) { + anm_init(i_this,ANM_WAIT,0.0,2,0.0); + i_this->mStayStatus++; } else { - anm_init(i_dogP,ANM_JOYFUL,0.0,2,cM_rndFX(0.1) + 0.6); - i_dogP->mStayStatus = -1; + anm_init(i_this,ANM_JOYFUL,0.0,2,cM_rndFX(0.1) + 0.6); + i_this->mStayStatus = -1; } // goto default; } case 2: { - cLib_addCalcAngleS2(&i_dogP->current.angle.y,player_angle,4,0x400); + cLib_addCalcAngleS2(&i_this->current.angle.y,player_angle,4,0x400); if (angle_diff < 0x800) { - i_dogP->mStayStatus = 0; + i_this->mStayStatus = 0; } break; } case 3: { - if (75.0 <= i_dogP->mEyePosYDistFromPlayer) { - i_dogP->mStayStatus = 1; - } else if (i_dogP->field_0x5fc[0] == 0) { - if (30.0 <= i_dogP->mEyePosYDistFromPlayer) { - i_dogP->mAction = ACT_SIT; - i_dogP->mStayStatus = 0; + if (75.0 <= i_this->mEyePosYDistFromPlayer) { + i_this->mStayStatus = 1; + } else if (i_this->field_0x5fc[0] == 0) { + if (30.0 <= i_this->mEyePosYDistFromPlayer) { + i_this->mAction = ACT_SIT; + i_this->mStayStatus = 0; } else { - i_dogP->mAction = ACT_STAY; - i_dogP->mStayStatus = 10; + i_this->mAction = ACT_STAY; + i_this->mStayStatus = 10; } } break; } case 5: { - cLib_addCalcAngleS2(&i_dogP->current.angle.y,player_angle + i_dogP->field_0x654,4,0x800); - cLib_addCalcAngleS2(&i_dogP->field_0x654,i_dogP->field_0x656,4,0x1000); - cLib_addCalc2(&i_dogP->current.pos.x,i_dogP->field_0x5b8.x,0.2,3.5); - cLib_addCalc2(&i_dogP->current.pos.z,i_dogP->field_0x5b8.z,0.2,3.5); + cLib_addCalcAngleS2(&i_this->current.angle.y,player_angle + i_this->field_0x654,4,0x800); + cLib_addCalcAngleS2(&i_this->field_0x654,i_this->field_0x656,4,0x1000); + cLib_addCalc2(&i_this->current.pos.x,i_this->field_0x5b8.x,0.2,3.5); + cLib_addCalc2(&i_this->current.pos.z,i_this->field_0x5b8.z,0.2,3.5); - if (i_dogP->field_0x5fc[0] == 0) { - i_dogP->mStayStatus = 0; + if (i_this->field_0x5fc[0] == 0) { + i_this->mStayStatus = 0; } break; } case 6: { - i_dogP->field_0x648 = 4000.0; + i_this->field_0x648 = 4000.0; - if (i_dogP->field_0x674.z * 176.0 < i_dogP->mDistFromPlayer) { - i_dogP->mStayStatus = 0; + if (i_this->field_0x674.z * 176.0 < i_this->mDistFromPlayer) { + i_this->mStayStatus = 0; } } default: { if (some_val < angle_diff) { - anm_init(i_dogP,ANM_STEP_2,0.0,2,0.0); - i_dogP->mStayStatus = 2; - } else if (75.0 <= i_dogP->mEyePosYDistFromPlayer) { + anm_init(i_this,ANM_STEP_2,0.0,2,0.0); + i_this->mStayStatus = 2; + } else if (75.0 <= i_this->mEyePosYDistFromPlayer) { - // i_dogP->field_0x674.z might be a store in a variable - if (i_dogP->field_0x674.z * 96.0 <= i_dogP->mDistFromPlayer) { - if ((i_dogP->mStayStatus != 6) && (i_dogP->mDistFromPlayer < i_dogP->field_0x674.z * 120.0)) { - anm_init(i_dogP,ANM_JOYFUL,0.0,2,cM_rndFX(0.1) + 1.0); - i_dogP->mStayStatus = 6; + // i_this->field_0x674.z might be a store in a variable + if (i_this->field_0x674.z * 96.0 <= i_this->mDistFromPlayer) { + if ((i_this->mStayStatus != 6) && (i_this->mDistFromPlayer < i_this->field_0x674.z * 120.0)) { + anm_init(i_this,ANM_JOYFUL,0.0,2,cM_rndFX(0.1) + 1.0); + i_this->mStayStatus = 6; } } else { cXyz local_68; @@ -1701,50 +1700,50 @@ static void do_wait_1(do_class* i_dogP) { for (int i = 0; i < 20; i++) { if (i < 10) { - mDoMtx_YrotS((MtxP)calc_mtx,i_dogP->mAngleYFromPlayer + cM_rndFX(5000.0)); + mDoMtx_YrotS((MtxP)calc_mtx,i_this->mAngleYFromPlayer + cM_rndFX(5000.0)); } else { mDoMtx_YrotS((MtxP)calc_mtx,cM_rndF(65536.0)); } - local_68.z = dVar11 * i_dogP->field_0x674.z; + local_68.z = dVar11 * i_this->field_0x674.z; - MtxPosition(&local_68,&i_dogP->field_0x5b8); - i_dogP->field_0x5b8 += player->current.pos; + MtxPosition(&local_68,&i_this->field_0x5b8); + i_this->field_0x5b8 += player->current.pos; if (cM_rndF(1.0) < dVar12) break; - // local_74 = i_dogP->field6_0x5b8; - if (dansa_check(i_dogP,i_dogP->field_0x5b8,0.0) == 0) break; + // local_74 = i_this->field6_0x5b8; + if (dansa_check(i_this,i_this->field_0x5b8,0.0) == 0) break; - i_dogP->mUnkPos = i_dogP->field_0x5b8; - i_dogP->field_0x624 = dVar10 + cM_rndF(10.0); + i_this->mUnkPos = i_this->field_0x5b8; + i_this->field_0x624 = dVar10 + cM_rndF(10.0); } - i_dogP->mStayStatus = 5; - i_dogP->field_0x656 = cM_rndFX(10000.0); + i_this->mStayStatus = 5; + i_this->field_0x656 = cM_rndFX(10000.0); - anm_init(i_dogP,ANM_WALK,0.0,2,0.0); - i_dogP->field_0x5fc[0] = cM_rndF(10.0) + 15.0; + anm_init(i_this,ANM_WALK,0.0,2,0.0); + i_this->field_0x5fc[0] = cM_rndF(10.0) + 15.0; } } else { - i_dogP->mStayStatus = 3; - i_dogP->field_0x5fc[0] = cM_rndF(10.0) + 10.0; + i_this->mStayStatus = 3; + i_this->field_0x5fc[0] = cM_rndF(10.0) + 10.0; } break; } case 10: { - i_dogP->field_0x5e8 = 5.0; - anm_init(i_dogP,ANM_WALK,0.0,2,i_dogP->field_0x5e8); + i_this->field_0x5e8 = 5.0; + anm_init(i_this,ANM_WALK,0.0,2,i_this->field_0x5e8); - i_dogP->mStayStatus++; + i_this->mStayStatus++; } case 11: { - cLib_addCalc2(&i_dogP->field_0x5e8,2.0,1.0,0.2); - i_dogP->mpMorf->setPlaySpeed(i_dogP->field_0x5e8); + cLib_addCalc2(&i_this->field_0x5e8,2.0,1.0,0.2); + i_this->mpMorf->setPlaySpeed(i_this->field_0x5e8); - if (i_dogP->field_0x5e8 <= 2.2) { - i_dogP->mStayStatus = 0; + if (i_this->field_0x5e8 <= 2.2) { + i_this->mStayStatus = 0; } break; @@ -1755,36 +1754,36 @@ static void do_wait_1(do_class* i_dogP) { } } - cLib_addCalc0(&i_dogP->mSpeedF,1.0,1.0); + cLib_addCalc0(&i_this->speedF,1.0,1.0); - if (i_dogP->field_0x674.z * 240.0 < i_dogP->mDistFromPlayer && !dansa_check2(i_dogP,0.0) && i_dogP->mStayStatus < 10) { - i_dogP->mAction = ACT_WALK_RUN; - i_dogP->field_0x5e8 = 1.5; - anm_init(i_dogP,ANM_WALK,0.0,2,i_dogP->field_0x5e8); - i_dogP->mStayStatus = 1; + if (i_this->field_0x674.z * 240.0 < i_this->mDistFromPlayer && !dansa_check2(i_this,0.0) && i_this->mStayStatus < 10) { + i_this->mAction = ACT_WALK_RUN; + i_this->field_0x5e8 = 1.5; + anm_init(i_this,ANM_WALK,0.0,2,i_this->field_0x5e8); + i_this->mStayStatus = 1; } // might be a seperate variable for link - if (daPy_getLinkPlayerActorClass()->checkCanoeRide() && i_dogP->mDistFromPlayer < 1000.0) { - i_dogP->mAction = ACT_HELP; - i_dogP->mStayStatus = 0; + if (daPy_getLinkPlayerActorClass()->checkCanoeRide() && i_this->mDistFromPlayer < 1000.0) { + i_this->mAction = ACT_HELP; + i_this->mStayStatus = 0; } - if (i_dogP->field_0x5b4 == 2) { - f32 distance = i_dogP->mDistFromPlayer * 0.0215; + if (i_this->field_0x5b4 == 2) { + f32 distance = i_this->mDistFromPlayer * 0.0215; if (127.0 < distance) { distance = 127.0; } - i_dogP->mSound.startLevelSound(JAISoundID(Z2SE_DOG_V_CALL_HELP),distance,-1); + i_this->mSound.startLevelSound(JAISoundID(Z2SE_DOG_V_CALL_HELP),distance,-1); } } #else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_wait_1(do_class* i_dogP) { +static asm void do_wait_1(do_class* i_this) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_wait_1__FP8do_class.s" } @@ -1891,24 +1890,24 @@ COMPILER_STRIP_GATE(0x8066EEFC, &lit_4588); #pragma pop /* 8066A1C4-8066A3D0 002564 020C+00 1/1 0/0 0/0 .text do_wait_2__FP8do_class */ -static void do_wait_2(do_class* i_dogP) { +static void do_wait_2(do_class* i_this) { fopAc_ac_c* player = dComIfGp_getPlayer(0); - i_dogP->field_0x616 = 1; - i_dogP->field_0x648 = FLOAT_LABEL(lit_4400); + i_this->field_0x616 = 1; + i_this->field_0x648 = FLOAT_LABEL(lit_4400); - switch(i_dogP->mStayStatus) { + switch(i_this->mStayStatus) { case 0: { - i_dogP->mStayStatus++; + i_this->mStayStatus++; } case 1: { - if (i_dogP->field_0x5fc[0] == 0) { - i_dogP->field_0x5fc[0] = cM_rndF(FLOAT_LABEL(lit_4189)) + FLOAT_LABEL(lit_4192); - i_dogP->field_0x656 = cM_rndFX(FLOAT_LABEL(lit_4587)); + if (i_this->field_0x5fc[0] == 0) { + i_this->field_0x5fc[0] = cM_rndF(FLOAT_LABEL(lit_4189)) + FLOAT_LABEL(lit_4192); + i_this->field_0x656 = cM_rndFX(FLOAT_LABEL(lit_4587)); - cM_rndF(FLOAT_LABEL(lit_3662)) < FLOAT_LABEL(lit_4588) ? i_dogP->field_0x5e8 = cM_rndF(FLOAT_LABEL(lit_4342)) + FLOAT_LABEL(lit_3665) : i_dogP->field_0x5e8 = -(cM_rndF(FLOAT_LABEL(lit_4342)) + FLOAT_LABEL(lit_3665)); + cM_rndF(FLOAT_LABEL(lit_3662)) < FLOAT_LABEL(lit_4588) ? i_this->field_0x5e8 = cM_rndF(FLOAT_LABEL(lit_4342)) + FLOAT_LABEL(lit_3665) : i_this->field_0x5e8 = -(cM_rndF(FLOAT_LABEL(lit_4342)) + FLOAT_LABEL(lit_3665)); - anm_init(i_dogP,ANM_STEP,FLOAT_LABEL(lit_4194),2,i_dogP->field_0x5e8); + anm_init(i_this,ANM_STEP,FLOAT_LABEL(lit_4194),2,i_this->field_0x5e8); mDoMtx_YrotS((MtxP)calc_mtx,player->shape_angle.y); Vec local_38; @@ -1917,85 +1916,85 @@ static void do_wait_2(do_class* i_dogP) { local_38.y = FLOAT_LABEL(lit_3682); local_38.z = cM_rndF(FLOAT_LABEL(lit_3816)) + FLOAT_LABEL(lit_4551); - MtxPosition((cXyz*)&local_38,&i_dogP->field_0x5b8); - i_dogP->field_0x5b8 += player->current.pos; + MtxPosition((cXyz*)&local_38,&i_this->field_0x5b8); + i_this->field_0x5b8 += player->current.pos; } break; } } - cLib_addCalc2(&i_dogP->current.pos.x,i_dogP->field_0x5b8.x,FLOAT_LABEL(lit_4342),FLOAT_LABEL(lit_3665)); - cLib_addCalc2(&i_dogP->current.pos.z,i_dogP->field_0x5b8.z,FLOAT_LABEL(lit_4342),FLOAT_LABEL(lit_3665)); - cLib_addCalc0(&i_dogP->mSpeedF,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_3665)); - cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->mAngleYFromPlayer + i_dogP->field_0x654,4,0x800); - cLib_addCalcAngleS2(&i_dogP->field_0x654,i_dogP->field_0x656,4,0x1000); + cLib_addCalc2(&i_this->current.pos.x,i_this->field_0x5b8.x,FLOAT_LABEL(lit_4342),FLOAT_LABEL(lit_3665)); + cLib_addCalc2(&i_this->current.pos.z,i_this->field_0x5b8.z,FLOAT_LABEL(lit_4342),FLOAT_LABEL(lit_3665)); + cLib_addCalc0(&i_this->speedF,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_3665)); + cLib_addCalcAngleS2(&i_this->current.angle.y,i_this->mAngleYFromPlayer + i_this->field_0x654,4,0x800); + cLib_addCalcAngleS2(&i_this->field_0x654,i_this->field_0x656,4,0x1000); - if (i_dogP->mDistFromPlayer > FLOAT_LABEL(lit_3923) * i_dogP->field_0x674.z) { - i_dogP->mAction = ACT_RUN; - i_dogP->mStayStatus = 0; + if (i_this->mDistFromPlayer > FLOAT_LABEL(lit_3923) * i_this->field_0x674.z) { + i_this->mAction = ACT_RUN; + i_this->mStayStatus = 0; } - area_check(i_dogP); + area_check(i_this); } /* 8066A3D0-8066A5DC 002770 020C+00 1/1 0/0 0/0 .text do_sit__FP8do_class */ #ifdef NONMATCHING // matches except float literal in inline -static void do_sit(do_class* i_dogP) { - i_dogP->field_0x616 = 1; - i_dogP->field_0x648 = FLOAT_LABEL(lit_4190); +static void do_sit(do_class* i_this) { + i_this->field_0x616 = 1; + i_this->field_0x648 = FLOAT_LABEL(lit_4190); - switch (i_dogP->mStayStatus) { + switch (i_this->mStayStatus) { case 0: { - anm_init(i_dogP,ANM_SIT_WAIT,FLOAT_LABEL(lit_4192),2,FLOAT_LABEL(lit_3662)); - i_dogP->mStayStatus++; + anm_init(i_this,ANM_SIT_WAIT,FLOAT_LABEL(lit_4192),2,FLOAT_LABEL(lit_3662)); + i_this->mStayStatus++; } case 1: { - if (i_dogP->mEyePosYDistFromPlayer > FLOAT_LABEL(lit_4545)) { - i_dogP->mStayStatus = 3; - i_dogP->field_0x5fc[0] = cM_rndF(FLOAT_LABEL(lit_4192)) + FLOAT_LABEL(lit_4192); + if (i_this->mEyePosYDistFromPlayer > FLOAT_LABEL(lit_4545)) { + i_this->mStayStatus = 3; + i_this->field_0x5fc[0] = cM_rndF(FLOAT_LABEL(lit_4192)) + FLOAT_LABEL(lit_4192); } else { - if (i_dogP->mEyePosYDistFromPlayer < FLOAT_LABEL(lit_3846)) { - i_dogP->mStayStatus = 2; - i_dogP->field_0x5fc[0] = cM_rndF(FLOAT_LABEL(lit_4192)) + FLOAT_LABEL(lit_4192); + if (i_this->mEyePosYDistFromPlayer < FLOAT_LABEL(lit_3846)) { + i_this->mStayStatus = 2; + i_this->field_0x5fc[0] = cM_rndF(FLOAT_LABEL(lit_4192)) + FLOAT_LABEL(lit_4192); } } break; } case 2: { - if (i_dogP->mEyePosYDistFromPlayer < FLOAT_LABEL(lit_3846) ) { - if (i_dogP->field_0x5fc[0] == 0) { - i_dogP->mAction = ACT_STAY; - i_dogP->mStayStatus = 10; + if (i_this->mEyePosYDistFromPlayer < FLOAT_LABEL(lit_3846) ) { + if (i_this->field_0x5fc[0] == 0) { + i_this->mAction = ACT_STAY; + i_this->mStayStatus = 10; } } else { - i_dogP->mStayStatus = 1; + i_this->mStayStatus = 1; } break; } case 3: { - if (i_dogP->mEyePosYDistFromPlayer > FLOAT_LABEL(lit_4545)) { - if (i_dogP->field_0x5fc[0] == 0) { - anm_init(i_dogP,ANM_SIT,FLOAT_LABEL(lit_4194),0,FLOAT_LABEL(lit_3662)); - i_dogP->mStayStatus++; + if (i_this->mEyePosYDistFromPlayer > FLOAT_LABEL(lit_4545)) { + if (i_this->field_0x5fc[0] == 0) { + anm_init(i_this,ANM_SIT,FLOAT_LABEL(lit_4194),0,FLOAT_LABEL(lit_3662)); + i_this->mStayStatus++; } } else { - i_dogP->mStayStatus = 1; + i_this->mStayStatus = 1; } break; } case 4: { - if (i_dogP->mpMorf->isStop()) { - i_dogP->mAction = ACT_WAIT_1; - i_dogP->mStayStatus = 0; + if (i_this->mpMorf->isStop()) { + i_this->mAction = ACT_WAIT_1; + i_this->mStayStatus = 0; } break; } @@ -2004,21 +2003,21 @@ static void do_sit(do_class* i_dogP) { } - cLib_addCalc0(&i_dogP->mSpeedF,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_3665)); + cLib_addCalc0(&i_this->speedF,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_3665)); - if (i_dogP->mDistFromPlayer > FLOAT_LABEL(lit_3773) * i_dogP->field_0x674.z) { - i_dogP->mAction = ACT_STAY; - i_dogP->field_0x5f4 = 8; - i_dogP->mStayStatus = 0; + if (i_this->mDistFromPlayer > FLOAT_LABEL(lit_3773) * i_this->field_0x674.z) { + i_this->mAction = ACT_STAY; + i_this->field_0x5f4 = 8; + i_this->mStayStatus = 0; } - area_check(i_dogP); + area_check(i_this); } #else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_sit(do_class* i_dogP) { +static asm void do_sit(do_class* i_this) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_sit__FP8do_class.s" } @@ -2042,14 +2041,14 @@ COMPILER_STRIP_GATE(0x8066EF04, &lit_4710); /* 8066A5DC-8066A80C 00297C 0230+00 1/1 0/0 0/0 .text hang_set__FP8do_class */ #ifdef NONMATCHING -static u16 hang_set(do_class* i_dogP) { +static u16 hang_set(do_class* i_this) { } #else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm u16 hang_set(do_class* i_dogP) { +static asm u16 hang_set(do_class* i_this) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/hang_set__FP8do_class.s" } @@ -2073,14 +2072,14 @@ COMPILER_STRIP_GATE(0x8066EF0C, &lit_4764); /* 8066A80C-8066AB78 002BAC 036C+00 1/1 0/0 0/0 .text do_hang__FP8do_class */ #ifdef NONMATCHING -static void do_hang(do_class* i_dogP) { +static void do_hang(do_class* i_this) { } #else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_hang(do_class* i_dogP) { +static asm void do_hang(do_class* i_this) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_hang__FP8do_class.s" } @@ -2096,14 +2095,14 @@ SECTION_DEAD static char const* const stringBase_8066EFB3 = "F_SP116"; /* 8066AB78-8066B650 002F18 0AD8+00 2/1 0/0 0/0 .text do_food__FP8do_class */ #ifdef NONMATCHING -static void do_food(do_class* i_dogP) { +static void do_food(do_class* i_this) { } #else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_food(do_class* i_dogP) { +static asm void do_food(do_class* i_this) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_food__FP8do_class.s" } @@ -2182,34 +2181,34 @@ COMPILER_STRIP_GATE(0x8066EF34, &lit_4993); #pragma pop /* 8066B650-8066B774 0039F0 0124+00 1/1 0/0 0/0 .text do_swim__FP8do_class */ -static void do_swim(do_class* i_dogP) { +static void do_swim(do_class* i_this) { Vec pos; // this is probably cXyz but defining it as such moves ~cXyz to right after this function, breaking the TU match - i_dogP->field_0x616 = 1; - i_dogP->field_0x648 = FLOAT_LABEL(lit_4191); + i_this->field_0x616 = 1; + i_this->field_0x648 = FLOAT_LABEL(lit_4191); - switch(i_dogP->mStayStatus) { + switch(i_this->mStayStatus) { case 1: { break; } case 0: { - anm_init(i_dogP,19,FLOAT_LABEL(lit_4027),2,cM_rndF(FLOAT_LABEL(lit_4991))+FLOAT_LABEL(lit_4340)); - i_dogP->mStayStatus++; + anm_init(i_this,19,FLOAT_LABEL(lit_4027),2,cM_rndF(FLOAT_LABEL(lit_4991))+FLOAT_LABEL(lit_4340)); + i_this->mStayStatus++; break; } } - cLib_addCalc2(&i_dogP->mSpeedF,l_HIO.mSwimSpeed,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4588)*l_HIO.mSwimSpeed); - cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->mAngleYFromPlayer,16,0x100); + cLib_addCalc2(&i_this->speedF,l_HIO.mSwimSpeed,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4588)*l_HIO.mSwimSpeed); + cLib_addCalcAngleS2(&i_this->current.angle.y,i_this->mAngleYFromPlayer,16,0x100); - i_dogP->mSpeed.y = FLOAT_LABEL(lit_3682); - i_dogP->mGravity = FLOAT_LABEL(lit_3682); + i_this->speed.y = FLOAT_LABEL(lit_3682); + i_this->mGravity = FLOAT_LABEL(lit_3682); - cLib_addCalc2(&i_dogP->current.pos.y,i_dogP->field_0x65c - FLOAT_LABEL(lit_4992),FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4027)); + cLib_addCalc2(&i_this->current.pos.y,i_this->field_0x65c - FLOAT_LABEL(lit_4992),FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_4027)); - pos = i_dogP->mEyePos; - pos.y = i_dogP->field_0x65c; + pos = i_this->mEyePos; + pos.y = i_this->field_0x65c; - fopAcM_effHamonSet(&i_dogP->field_0xbcc,(cXyz*)&pos,FLOAT_LABEL(lit_4993),FLOAT_LABEL(lit_4402)); + fopAcM_effHamonSet(&i_this->field_0xbcc,(cXyz*)&pos,FLOAT_LABEL(lit_4993),FLOAT_LABEL(lit_4402)); } /* 8066B774-8066B7C0 003B14 004C+00 2/2 0/0 0/0 .text s_c_sub__FPvPv */ @@ -2258,14 +2257,14 @@ COMPILER_STRIP_GATE(0x8066EF48, &lit_5114); /* 8066B7C0-8066BD3C 003B60 057C+00 1/1 0/0 0/0 .text do_help__FP8do_class */ #ifdef NONMATCHING -static void do_help(do_class* i_dogP) { +static void do_help(do_class* i_this) { } #else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_help(do_class* i_dogP) { +static asm void do_help(do_class* i_this) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_help__FP8do_class.s" } @@ -2289,14 +2288,14 @@ COMPILER_STRIP_GATE(0x8066EF50, &lit_5345); /* 8066BD3C-8066C894 0040DC 0B58+00 2/1 0/0 0/0 .text do_boat__FP8do_class */ #ifdef NONMATCHING -static u8 do_boat(do_class* i_dogP) { +static u8 do_boat(do_class* i_this) { } #else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm u8 do_boat(do_class* i_dogP) { +static asm u8 do_boat(do_class* i_this) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_boat__FP8do_class.s" } @@ -2327,49 +2326,49 @@ COMPILER_STRIP_GATE(0x8066EF5C, &lit_5407); /* 8066C894-8066CAA8 004C34 0214+00 1/1 0/0 0/0 .text do_a_swim__FP8do_class */ #ifdef NONMATCHING -static void do_a_swim(do_class* i_dogP) { - i_dogP->field_0x648 = 2000.0; - cLib_addCalc0(&i_dogP->mSpeedF,1.0,1.0); +static void do_a_swim(do_class* i_this) { + i_this->field_0x648 = 2000.0; + cLib_addCalc0(&i_this->speedF,1.0,1.0); - switch (i_dogP->mStayStatus) { + switch (i_this->mStayStatus) { case 2: { - l_HIO.mWaterHuntAnimType == 1 ? i_dogP->mpMorf->setPlaySpeed(i_dogP->field46_0x634 * 5.0) : i_dogP->mpMorf->setPlaySpeed(i_dogP->field46_0x634 * 5.0); + l_HIO.mWaterHuntAnimType == 1 ? i_this->mpMorf->setPlaySpeed(i_this->field46_0x634 * 5.0) : i_this->mpMorf->setPlaySpeed(i_this->field46_0x634 * 5.0); - if (0.025 < i_dogP->field_0x634) { + if (0.025 < i_this->field_0x634) { break; } - i_dogP->field_0x634 = 0.0; - i_dogP->mAction = ACT_WAIT_1; - i_dogP->mStayStatus = 0; + i_this->field_0x634 = 0.0; + i_this->mAction = ACT_WAIT_1; + i_this->mStayStatus = 0; break; } case 0: { l_HIO.mWaterHuntAnimType == 1 ? anm_init(param_1,ANM_JOYFUL,0.0,2,0.0) : anm_init(param_1,ANM_BULBUL,0.0,2,0.0); - i_dogP->mStayStatus = 1; - i_dogP->field32_0x5fc[0] = 0x14; + i_this->mStayStatus = 1; + i_this->field32_0x5fc[0] = 0x14; - JPABaseEmitter* emitter = dComIfGp_particle_set(0x2a3,&i_dogP->.current.pos,0,0); + JPABaseEmitter* emitter = dComIfGp_particle_set(0x2a3,&i_this->.current.pos,0,0); if (emitter) { - emitter->setGlobalRTMatrix(i_dogP->mpMorf->getModel()->getAnmMtx(2)); + emitter->setGlobalRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(2)); cXyz pos = cXyz(0.6,0.6,0.6); emitter->setGlobalScale(pTVar3); } } } - if (i_dogP->field_0x5fc[0] == 0) { - i_dogP->mStayStatus = 2; - i_dogP->field_0x634 = 0.1; - i_dogP->field_0x638 = 1.0; + if (i_this->field_0x5fc[0] == 0) { + i_this->mStayStatus = 2; + i_this->field_0x634 = 0.1; + i_this->field_0x638 = 1.0; } } #else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void do_a_swim(do_class* i_dogP) { +static asm void do_a_swim(do_class* i_this) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_a_swim__FP8do_class.s" } @@ -2399,14 +2398,14 @@ COMPILER_STRIP_GATE(0x8066EF68, &lit_5480); /* 8066CAA8-8066CDEC 004E48 0344+00 1/1 0/0 0/0 .text do_carry__FP8do_class */ #ifdef NONMATCHING -static asm u8 do_carry(do_class* i_dogP) { +static asm u8 do_carry(do_class* i_this) { } #else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm u8 do_carry(do_class* i_dogP) { +static asm u8 do_carry(do_class* i_this) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/do_carry__FP8do_class.s" } @@ -2414,27 +2413,27 @@ static asm u8 do_carry(do_class* i_dogP) { #endif /* 8066CDEC-8066CEC4 00518C 00D8+00 1/1 0/0 0/0 .text do_message__FP8do_class */ -static void do_message(do_class* i_dogP) { - i_dogP->field_0x648 = FLOAT_LABEL(lit_4191); +static void do_message(do_class* i_this) { + i_this->field_0x648 = FLOAT_LABEL(lit_4191); - switch(i_dogP->mStayStatus) { + switch(i_this->mStayStatus) { case 1: { break; } case 0: { - anm_init(i_dogP,21,FLOAT_LABEL(lit_4027),2,FLOAT_LABEL(lit_3662)); - i_dogP->mStayStatus++; + anm_init(i_this,21,FLOAT_LABEL(lit_4027),2,FLOAT_LABEL(lit_3662)); + i_this->mStayStatus++; break; } } - cLib_addCalc0(&i_dogP->mSpeedF,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_3665)); - i_dogP->field_0x616 = 1; - cLib_addCalcAngleS2(&i_dogP->current.angle.y,i_dogP->mAngleYFromPlayer,2,0x1000); + cLib_addCalc0(&i_this->speedF,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_3665)); + i_this->field_0x616 = 1; + cLib_addCalcAngleS2(&i_this->current.angle.y,i_this->mAngleYFromPlayer,2,0x1000); - if (i_dComIfGp_event_runCheck() == 0 && i_dogP->mDistFromPlayer > FLOAT_LABEL(lit_3773)) { - i_dogP->mAction = ACT_STAY; - i_dogP->mStayStatus = 0; + if (i_dComIfGp_event_runCheck() == 0 && i_this->mDistFromPlayer > FLOAT_LABEL(lit_3773)) { + i_this->mAction = ACT_STAY; + i_this->mStayStatus = 0; } } @@ -2527,7 +2526,7 @@ COMPILER_STRIP_GATE(0x8066EF9C, &lit_6214); /* 8066CEC4-8066DD48 005264 0E84+00 2/1 0/0 0/0 .text action__FP8do_class */ #ifdef NONMATCHING extern "C" u8 scc[12]; -static void action(do_class* i_dogP) { +static void action(do_class* i_this) { cXyz pos1; cXyz pos2; cXyz pos3; @@ -2535,213 +2534,213 @@ static void action(do_class* i_dogP) { fopAc_ac_c* player = dComIfGp_getPlayer(0); - i_dogP->mGravity = FLOAT_LABEL(lit_5948); - i_dogP->mDistFromPlayer = fopAcM_searchPlayerDistance(i_dogP); + i_this->mGravity = FLOAT_LABEL(lit_5948); + i_this->mDistFromPlayer = fopAcM_searchPlayerDistance(i_this); daPy_py_c* player2 = daPy_getPlayerActorClass(); if (player2->checkHorseRide()) { - i_dogP->mDistFromPlayer -= FLOAT_LABEL(lit_3772); + i_this->mDistFromPlayer -= FLOAT_LABEL(lit_3772); } - i_dogP->mAngleYFromPlayer = fopAcM_searchPlayerAngleY(i_dogP); - i_dogP->mEyePosYDistFromPlayer = fabsf(i_dogP->mEyePos.y - player->current.pos.y); + i_this->mAngleYFromPlayer = fopAcM_searchPlayerAngleY(i_this); + i_this->mEyePosYDistFromPlayer = fabsf(i_this->mEyePos.y - player->current.pos.y); - if (!mDoCPd_c::getHoldR(PAD_1) || fabsf(i_dogP->current.pos.y - player->current.pos.y) > FLOAT_LABEL(lit_3816)) { - i_dogP->mEyePosYDistFromPlayer = FLOAT_LABEL(lit_4339); + if (!mDoCPd_c::getHoldR(PAD_1) || fabsf(i_this->current.pos.y - player->current.pos.y) > FLOAT_LABEL(lit_3816)) { + i_this->mEyePosYDistFromPlayer = FLOAT_LABEL(lit_4339); } - i_dogP->mEyePosYDistFromPlayer *= FLOAT_LABEL(lit_4341); + i_this->mEyePosYDistFromPlayer *= FLOAT_LABEL(lit_4341); u8 tmp1 = 1; s8 tmp2 = 1; bool tmp3 = true; - i_dogP->mCcD_GObjInf1.OnCoSetBit(); + i_this->mCcD_GObjInf1.OnCoSetBit(); - if (i_dogP->field_0x608 < FLOAT_LABEL(lit_3662)) { - i_dogP->field_0xc05 = 0; + if (i_this->field_0x608 < FLOAT_LABEL(lit_3662)) { + i_this->field_0xc05 = 0; - switch(i_dogP->mAction) { + switch(i_this->mAction) { case ACT_STAY: { - do_stay(i_dogP); - food_check(i_dogP); - i_dogP->field_0xc05 = 1; + do_stay(i_this); + food_check(i_this); + i_this->field_0xc05 = 1; break; } case ACT_WALK: { - do_walk(i_dogP); - food_check(i_dogP); - i_dogP->field_0xc05 = 1; + do_walk(i_this); + food_check(i_this); + i_this->field_0xc05 = 1; break; } case ACT_WALK_RUN: { - do_walk_run(i_dogP); - food_check(i_dogP); - i_dogP->field_0xc05 = 1; + do_walk_run(i_this); + food_check(i_this); + i_this->field_0xc05 = 1; break; } case ACT_RUN: { - do_run(i_dogP); - food_check(i_dogP); - i_dogP->field_0xc05 = 1; + do_run(i_this); + food_check(i_this); + i_this->field_0xc05 = 1; break; } case ACT_RUN_WALK: { - do_run_walk(i_dogP); - food_check(i_dogP); - i_dogP->field_0xc05 = 1; + do_run_walk(i_this); + food_check(i_this); + i_this->field_0xc05 = 1; break; } case ACT_FOOD: { - do_food(i_dogP); - i_dogP->field_0xc05 = 1; + do_food(i_this); + i_this->field_0xc05 = 1; break; } case ACT_WAIT_1: { - do_wait_1(i_dogP); - food_check(i_dogP); - i_dogP->field_0xc05 = 1; + do_wait_1(i_this); + food_check(i_this); + i_this->field_0xc05 = 1; break; } case ACT_WAIT_2: { - do_wait_2(i_dogP); - food_check(i_dogP); - i_dogP->field_0xc05 = 1; + do_wait_2(i_this); + food_check(i_this); + i_this->field_0xc05 = 1; break; } case ACT_SIT: { - do_sit(i_dogP); - food_check(i_dogP); - i_dogP->field_0xc05 = 1; + do_sit(i_this); + food_check(i_this); + i_this->field_0xc05 = 1; break; } case ACT_A_SWIM: { - do_a_swim(i_dogP); + do_a_swim(i_this); break; } case ACT_SWIM: { - do_swim(i_dogP); + do_swim(i_this); tmp3 = false; - fopAcM_riverStream(&i_dogP->current.pos,&i_dogP->field_0x6b0,&i_dogP->field_0x6b4,FLOAT_LABEL(lit_4588)); + fopAcM_riverStream(&i_this->current.pos,&i_this->field_0x6b0,&i_this->field_0x6b4,FLOAT_LABEL(lit_4588)); break; } case ACT_HELP: { - do_help(i_dogP); + do_help(i_this); break; } case ACT_BOAT: { - tmp1 = do_boat(i_dogP); + tmp1 = do_boat(i_this); break; } case ACT_HANG: { - do_hang(i_dogP); + do_hang(i_this); break; } case ACT_CARRY: { - tmp1 = do_carry(i_dogP); - i_dogP->mCcD_GObjInf1.OffCoSetBit(); + tmp1 = do_carry(i_this); + i_this->mCcD_GObjInf1.OffCoSetBit(); tmp2 = 0; break; } case ACT_MESSAGE: { - do_message(i_dogP); - i_dogP->field_0xc05 = 2; + do_message(i_this); + i_this->field_0xc05 = 2; } } } - if (i_dogP->mItemPcId != -1 && i_dogP->mDistFromPlayer < FLOAT_LABEL(lit_4378) * i_dogP->field_0x674.z) { - daItem_c* item = (daItem_c*)fopAcM_SearchByID(i_dogP->mItemPcId); + if (i_this->mItemPcId != -1 && i_this->mDistFromPlayer < FLOAT_LABEL(lit_4378) * i_this->field_0x674.z) { + daItem_c* item = (daItem_c*)fopAcM_SearchByID(i_this->mItemPcId); if (item) { item->endControl(); } - i_dogP->field_0x6b8 = 0; - i_dogP->mItemPcId = -1; + i_this->field_0x6b8 = 0; + i_this->mItemPcId = -1; } - if (i_dogP->field_0x6ae != 0) { - i_dogP->field_0x6ae--; - if (i_dogP->field_0x6ae == 0) { - i_dogP->mSound.startSound(JAISoundID(Z2SE_M007_DOG_COME_RUNNING),0,-1); + if (i_this->field_0x6ae != 0) { + i_this->field_0x6ae--; + if (i_this->field_0x6ae == 0) { + i_this->mSound.startSound(JAISoundID(Z2SE_M007_DOG_COME_RUNNING),0,-1); } } - if (i_dogP->field_0xc05 == 1 && daPy_py_c::i_checkNowWolf() && i_dogP->mDistFromPlayer < FLOAT_LABEL(lit_4339)) { - i_dogP->mAction = ACT_MESSAGE; - i_dogP->mStayStatus = 0; + if (i_this->field_0xc05 == 1 && daPy_py_c::i_checkNowWolf() && i_this->mDistFromPlayer < FLOAT_LABEL(lit_4339)) { + i_this->mAction = ACT_MESSAGE; + i_this->mStayStatus = 0; } if (tmp2 != 0 && player->mSpeedF < FLOAT_LABEL(lit_3665)) { - cLib_onBit(i_dogP->mAttentionInfo.mFlags,0x10); + cLib_onBit(i_this->mAttentionInfo.mFlags,0x10); - if (do_carry_check(i_dogP)) { + if (do_carry_check(i_this)) { return; } } else { - cLib_offBit(i_dogP->mAttentionInfo.mFlags,0x10); + cLib_offBit(i_this->mAttentionInfo.mFlags,0x10); } - cLib_addCalcAngleS2(&i_dogP->current.angle.x,0,1,0x400); + cLib_addCalcAngleS2(&i_this->current.angle.x,0,1,0x400); - if (i_dogP->mAction != ACT_HANG) { - mDoMtx_YrotS((MtxP)calc_mtx,i_dogP->current.angle.y); + if (i_this->mAction != ACT_HANG) { + mDoMtx_YrotS((MtxP)calc_mtx,i_this->current.angle.y); pos1.x = FLOAT_LABEL(lit_3682); pos1.y = FLOAT_LABEL(lit_3682); - pos1.z = FLOAT_LABEL(lit_3981) * i_dogP->mSpeedF; - pos1.z *= i_dogP->field_0x674.z; + pos1.z = FLOAT_LABEL(lit_3981) * i_this->speedF; + pos1.z *= i_this->field_0x674.z; MtxPosition(&pos1,&pos2); - i_dogP->mSpeed.x = pos2.x; - i_dogP->mSpeed.z = pos2.z; - i_dogP->mSpeed.y += i_dogP->mGravity;; + i_this->speed.x = pos2.x; + i_this->speed.z = pos2.z; + i_this->speed.y += i_this->mGravity;; - i_dogP->current.pos += i_dogP->mSpeed; + i_this->current.pos += i_this->speed; - if (i_dogP->mSpeed.y < FLOAT_LABEL(lit_5345)) { - i_dogP->mSpeed.y = FLOAT_LABEL(lit_5345); + if (i_this->speed.y < FLOAT_LABEL(lit_5345)) { + i_this->speed.y = FLOAT_LABEL(lit_5345); } cXyz* posP; - if (!fopAcM_checkCarryNow(i_dogP) && (posP = i_dogP->mCcD_Stts.GetCCMoveP(), posP)) { - i_dogP->current.pos.x = i_dogP->current.pos.x + FLOAT_LABEL(lit_4967) * posP->x; - i_dogP->current.pos.z = i_dogP->current.pos.z + FLOAT_LABEL(lit_4967) * posP->z; + if (!fopAcM_checkCarryNow(i_this) && (posP = i_this->mCcD_Stts.GetCCMoveP(), posP)) { + i_this->current.pos.x = i_this->current.pos.x + FLOAT_LABEL(lit_4967) * posP->x; + i_this->current.pos.z = i_this->current.pos.z + FLOAT_LABEL(lit_4967) * posP->z; } - if (i_dogP->field_0x608 > FLOAT_LABEL(lit_3662)) { + if (i_this->field_0x608 > FLOAT_LABEL(lit_3662)) { pos1.x = FLOAT_LABEL(lit_3682); pos1.y = FLOAT_LABEL(lit_3682); - pos1.z = -i_dogP->field_0x608; + pos1.z = -i_this->field_0x608; - mDoMtx_YrotS((MtxP)calc_mtx,i_dogP->field_0x60c); + mDoMtx_YrotS((MtxP)calc_mtx,i_this->field_0x60c); MtxPosition(&pos1,&pos2); - i_dogP->current.pos += pos2; - cLib_addCalc0(&i_dogP->field_0x608,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_5949)); + i_this->current.pos += pos2; + cLib_addCalc0(&i_this->field_0x608,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_5949)); - i_dogP->mSpeedF = FLOAT_LABEL(lit_3682); + i_this->speedF = FLOAT_LABEL(lit_3682); tmp1 = 1; } if ((s8)tmp1 != 0) { - i_dogP->mBgS_AcchCir.SetWall(FLOAT_LABEL(lit_3846), (fabsf(i_dogP->field_0x608) + fabsf(i_dogP->mSpeedF)) + FLOAT_LABEL(lit_3846)); - i_dogP->mBgS_Acch.CrrPos(dComIfG_Bgsp()); + i_this->mBgS_AcchCir.SetWall(FLOAT_LABEL(lit_3846), (fabsf(i_this->field_0x608) + fabsf(i_this->speedF)) + FLOAT_LABEL(lit_3846)); + i_this->mBgS_Acch.CrrPos(dComIfG_Bgsp()); - if (i_dogP->mBgS_Acch.ChkGroundHit() && tmp_lit[0x3d] == 0 && !fopAcM_checkCarryNow(i_dogP)) { + if (i_this->mBgS_Acch.ChkGroundHit() && tmp_lit[0x3d] == 0 && !fopAcM_checkCarryNow(i_this)) { dBgS_GndChk gnd_chk; - mDoMtx_YrotS((MtxP)calc_mtx,i_dogP->shape_angle.y); + mDoMtx_YrotS((MtxP)calc_mtx,i_this->shape_angle.y); pos1.x = FLOAT_LABEL(lit_3682); pos1.y = FLOAT_LABEL(lit_3682); - pos1.z = FLOAT_LABEL(lit_5950) * i_dogP->field_0x674.z; + pos1.z = FLOAT_LABEL(lit_5950) * i_this->field_0x674.z; MtxPosition(&pos1,&pos2); - pos2 += i_dogP->current.pos; + pos2 += i_this->current.pos; pos3.x = pos2.x; pos3.y = pos2.y + FLOAT_LABEL(lit_3772); @@ -2750,49 +2749,49 @@ static void action(do_class* i_dogP) { gnd_chk.SetPos(&pos3); pos2.y = dComIfG_Bgsp().GroundCross(&gnd_chk); - pos1 = pos2 - i_dogP->current.pos; + pos1 = pos2 - i_this->current.pos; if (fabsf(pos1.y) < FLOAT_LABEL(lit_3816)) { - i_dogP->current.angle.x = cM_atan2s(pos1.y, JMAFastSqrt(pos1.x * pos1.x + pos1.z * pos1.z)); + i_this->current.angle.x = cM_atan2s(pos1.y, JMAFastSqrt(pos1.x * pos1.x + pos1.z * pos1.z)); } } } } else { - if (i_dogP->field_0x608 < FLOAT_LABEL(lit_3662)) { - cXyz pos = i_dogP->current.pos; - int check = dansa_check(i_dogP,pos,pos.x); + if (i_this->field_0x608 < FLOAT_LABEL(lit_3662)) { + cXyz pos = i_this->current.pos; + int check = dansa_check(i_this,pos,pos.x); if ((-check & ~check) < 0) { - i_dogP->field_0x660 = hang_set(i_dogP); + i_this->field_0x660 = hang_set(i_this); - if (i_dogP->field_0x660 == 0xdcf) { - i_dogP->mAction = ACT_HANG; - i_dogP->mStayStatus = 0; - i_dogP->field_0x63c = 0; + if (i_this->field_0x660 == 0xdcf) { + i_this->mAction = ACT_HANG; + i_this->mStayStatus = 0; + i_this->field_0x63c = 0; } } } } - water_check(i_dogP); + water_check(i_this); if (tmp3) { - if (i_dogP->mAction == ACT_CARRY) { - if (i_dogP->field_0x63c != 0 && i_dogP->field_0x63c--, i_dogP->field_0x63c == 0) { - i_dogP->mAction = ACT_A_SWIM; - i_dogP->mStayStatus = 0; + if (i_this->mAction == ACT_CARRY) { + if (i_this->field_0x63c != 0 && i_this->field_0x63c--, i_this->field_0x63c == 0) { + i_this->mAction = ACT_A_SWIM; + i_this->mStayStatus = 0; } - if (45.0f < i_dogP->field_0x65c - i_dogP->current.pos.y) { - i_dogP->mAction = ACT_SWIM; - i_dogP->mStayStatus = 0; - i_dogP->field_0x608 = FLOAT_LABEL(lit_3682); + if (45.0f < i_this->field_0x65c - i_this->current.pos.y) { + i_this->mAction = ACT_SWIM; + i_this->mStayStatus = 0; + i_this->field_0x608 = FLOAT_LABEL(lit_3682); - if (i_dogP->field_0x606 == 0) { + if (i_this->field_0x606 == 0) { - i_dogP->field_0x606 = 0x14; - cXyz pos = i_dogP->current.pos; - pos.y = i_dogP->field_0x65c; + i_this->field_0x606 = 0x14; + cXyz pos = i_this->current.pos; + pos.y = i_this->field_0x65c; if (l_HIO.mRunSpeed == 0) { scc[0] = 0; // fix later @@ -2803,50 +2802,50 @@ static void action(do_class* i_dogP) { for (int i = 0; i < 4; i++) { // wrong - i_dogP->mMsg.setMsg(dComIfGp_particle_set((u32)0,(u16)l_HIO.field_0x1c,&pos,&i_dogP->mTevStr,(csXyz*)0,(cXyz*)&scc,(u8)0xFF,(dPa_levelEcallBack *)0,(s8)-1,(GXColor*)0,(GXColor*)0,(cXyz*)0)); + i_this->mMsg.setMsg(dComIfGp_particle_set((u32)0,(u16)l_HIO.field_0x1c,&pos,&i_this->mTevStr,(csXyz*)0,(cXyz*)&scc,(u8)0xFF,(dPa_levelEcallBack *)0,(s8)-1,(GXColor*)0,(GXColor*)0,(cXyz*)0)); } - i_dogP->mSound.startSound(JAISoundID(Z2SE_CM_BODYFALL_WATER_S),0,-1); + i_this->mSound.startSound(JAISoundID(Z2SE_CM_BODYFALL_WATER_S),0,-1); } } } } else { - i_dogP->field_0x63c = cM_rndF(FLOAT_LABEL(lit_4025)) + FLOAT_LABEL(lit_3846); + i_this->field_0x63c = cM_rndF(FLOAT_LABEL(lit_4025)) + FLOAT_LABEL(lit_3846); - if (i_dogP->field_0x65c - i_dogP->current.pos.y < FLOAT_LABEL(lit_5951)) { - i_dogP->mAction = ACT_WAIT_1; - i_dogP->mStayStatus = 0; + if (i_this->field_0x65c - i_this->current.pos.y < FLOAT_LABEL(lit_5951)) { + i_this->mAction = ACT_WAIT_1; + i_this->mStayStatus = 0; } } - cLib_addCalcAngleS2(&i_dogP->shape_angle.y,i_dogP->current.angle.y,2,0x2000); - cLib_addCalcAngleS2(&i_dogP->shape_angle.x,i_dogP->current.angle.x,4,0x1000); - i_dogP->shape_angle.z = i_dogP->current.angle.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,4,0x1000); + i_this->shape_angle.z = i_this->current.angle.z; int tmp4 = 0; int tmp5 = 0; - if (i_dogP->field_0x616 != 0 || i_dogP->field_0x624 != 0) { - if (i_dogP->field_0x616 == 2) { - i_dogP->field_0x5f0 & 8U ? tmp4 = -10000 : tmp4 = 10000; + if (i_this->field_0x616 != 0 || i_this->field_0x624 != 0) { + if (i_this->field_0x616 == 2) { + i_this->field_0x5f0 & 8U ? tmp4 = -10000 : tmp4 = 10000; } else { cXyz eyePosDiff; - if (i_dogP->field_0x624 == 0) { - eyePosDiff = player->mEyePos - i_dogP->mEyePos; + if (i_this->field_0x624 == 0) { + eyePosDiff = player->mEyePos - i_this->mEyePos; } else { - i_dogP->field_0x624++; - eyePosDiff = i_dogP->mUnkPos - i_dogP->mEyePos; + i_this->field_0x624++; + eyePosDiff = i_this->mUnkPos - i_this->mEyePos; } - eyePosDiff.y += i_dogP->field_0x674.z * FLOAT_LABEL(lit_5952); + eyePosDiff.y += i_this->field_0x674.z * FLOAT_LABEL(lit_5952); - s16 some_angle = cM_atan2s(eyePosDiff.x,eyePosDiff.z) - i_dogP->shape_angle.y; + s16 some_angle = cM_atan2s(eyePosDiff.x,eyePosDiff.z) - i_this->shape_angle.y; s16 some_angle2 = cM_atan2s(eyePosDiff.y,JMAFastSqrt(eyePosDiff.x * eyePosDiff.x + eyePosDiff.z * eyePosDiff.z)); - tmp5 = i_dogP->shape_angle.x + some_angle2; + tmp5 = i_this->shape_angle.x + some_angle2; - if (i_dogP->field_0x624 == 0 && some_angle > 24000 || some_angle < -24000) { + if (i_this->field_0x624 == 0 && some_angle > 24000 || some_angle < -24000) { some_angle = 0; } @@ -2866,82 +2865,82 @@ static void action(do_class* i_dogP) { tmp5 = 12000; } - tmp4 = some_angle + i_dogP->field_0x614; + tmp4 = some_angle + i_this->field_0x614; } - i_dogP->field_0x616 = 0; + i_this->field_0x616 = 0; } - cLib_addCalcAngleS2(&i_dogP->field_0x610,tmp4 / 2,4,0x2000); - cLib_addCalcAngleS2(&i_dogP->field_0x60e,tmp5 / 2,4,0x2000); - cLib_addCalcAngleS2(&i_dogP->field_0x614,0,2,0x300); - cLib_addCalcAngleS2(&i_dogP->field_0x628,i_dogP->field_0x62e,4,0x400); - cLib_addCalcAngleS2(&i_dogP->field_0x62a,i_dogP->field_0x630,4,0x400); + cLib_addCalcAngleS2(&i_this->field_0x610,tmp4 / 2,4,0x2000); + cLib_addCalcAngleS2(&i_this->field_0x60e,tmp5 / 2,4,0x2000); + cLib_addCalcAngleS2(&i_this->field_0x614,0,2,0x300); + cLib_addCalcAngleS2(&i_this->field_0x628,i_this->field_0x62e,4,0x400); + cLib_addCalcAngleS2(&i_this->field_0x62a,i_this->field_0x630,4,0x400); - if (FLOAT_LABEL(lit_3682) <= fabsf(player->mSpeedF) || FLOAT_LABEL(lit_3682) <= fabsf(i_dogP->mSpeedF)) { - i_dogP->field_0x630 = 0; - i_dogP->field_0x62e = 0; - i_dogP->field_0x632 = cM_rndF(FLOAT_LABEL(lit_3772)) + FLOAT_LABEL(lit_5953); - } else if (i_dogP->field_0x632 != 0 && i_dogP->field_0x632--, i_dogP->field_0x632 == 0) { - i_dogP->field_0x632 = cM_rndF(FLOAT_LABEL(lit_3772)) + FLOAT_LABEL(lit_4189); + if (FLOAT_LABEL(lit_3682) <= fabsf(player->mSpeedF) || FLOAT_LABEL(lit_3682) <= fabsf(i_this->speedF)) { + i_this->field_0x630 = 0; + i_this->field_0x62e = 0; + i_this->field_0x632 = cM_rndF(FLOAT_LABEL(lit_3772)) + FLOAT_LABEL(lit_5953); + } else if (i_this->field_0x632 != 0 && i_this->field_0x632--, i_this->field_0x632 == 0) { + i_this->field_0x632 = cM_rndF(FLOAT_LABEL(lit_3772)) + FLOAT_LABEL(lit_4189); if (cM_rndF(1.0) < 0.5) { - i_dogP->field_0x62e = cM_rndFX(FLOAT_LABEL(lit_4191)); + i_this->field_0x62e = cM_rndFX(FLOAT_LABEL(lit_4191)); } if (cM_rndF(1.0) < 0.5) { - i_dogP->field_0x630 = cM_rndFX(FLOAT_LABEL(lit_4191)); + i_this->field_0x630 = cM_rndFX(FLOAT_LABEL(lit_4191)); } } - if (0.025 <= i_dogP->field_0x634) { + if (0.025 <= i_this->field_0x634) { if (l_HIO.field_0x1c == 0) { - i_dogP->field_0x612 = 0; - i_dogP->field_0x610 = 0; + i_this->field_0x612 = 0; + i_this->field_0x610 = 0; } else { - i_dogP->field_0x610 = cM_ssin(i_dogP->field_0x634 * FLOAT_LABEL(lit_4344)); - i_dogP->field_0x612 = cM_ssin(i_dogP->field_0x634 * FLOAT_LABEL(lit_4344)); + i_this->field_0x610 = cM_ssin(i_this->field_0x634 * FLOAT_LABEL(lit_4344)); + i_this->field_0x612 = cM_ssin(i_this->field_0x634 * FLOAT_LABEL(lit_4344)); } } - cLib_addCalc2(&i_dogP->field_0x634,i_dogP->field_0x638,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_5407)); - cLib_addCalc0(&i_dogP->field_0x638,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_5954)); + cLib_addCalc2(&i_this->field_0x634,i_this->field_0x638,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_5407)); + cLib_addCalc0(&i_this->field_0x638,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_5954)); - i_dogP->field_0x640 = cM_ssin(i_dogP->field_0x648 * i_dogP->field_0x64c); - i_dogP->field_0x63e = cM_ssin(i_dogP->field_0x648 * i_dogP->field_0x650); - i_dogP->field_0x64c += i_dogP->field_0x648 * FLOAT_LABEL(lit_3682); + i_this->field_0x640 = cM_ssin(i_this->field_0x648 * i_this->field_0x64c); + i_this->field_0x63e = cM_ssin(i_this->field_0x648 * i_this->field_0x650); + i_this->field_0x64c += i_this->field_0x648 * FLOAT_LABEL(lit_3682); - if (65536.0 < i_dogP->field_0x64c) { - i_dogP->field_0x64c -= FLOAT_LABEL(lit_4338); + if (65536.0 < i_this->field_0x64c) { + i_this->field_0x64c -= FLOAT_LABEL(lit_4338); } - i_dogP->field_0x650 += i_dogP->field_0x648 * FLOAT_LABEL(lit_4401); + i_this->field_0x650 += i_this->field_0x648 * FLOAT_LABEL(lit_4401); - if (65536.0 < i_dogP->field_0x650) { - i_dogP->field_0x650 -= FLOAT_LABEL(lit_4338); + if (65536.0 < i_this->field_0x650) { + i_this->field_0x650 -= FLOAT_LABEL(lit_4338); } - cLib_addCalc2(&i_dogP->field_0x648,i_dogP->field_0x648,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_3772)); - i_dogP->field_0x648 = FLOAT_LABEL(lit_3682); + cLib_addCalc2(&i_this->field_0x648,i_this->field_0x648,FLOAT_LABEL(lit_3662),FLOAT_LABEL(lit_3772)); + i_this->field_0x648 = FLOAT_LABEL(lit_3682); - if (i_dogP->field_0x5e2 == 0) { - if (i_dogP->field_0x5e0 == 0) { - i_dogP->field_0x5e0 = cM_rndF(FLOAT_LABEL(lit_3772)) + FLOAT_LABEL(lit_3846); + if (i_this->field_0x5e2 == 0) { + if (i_this->field_0x5e0 == 0) { + i_this->field_0x5e0 = cM_rndF(FLOAT_LABEL(lit_3772)) + FLOAT_LABEL(lit_3846); } else { - i_dogP->field_0x5e0--; - i_dogP->field_0x5e0 < 6 ? i_dogP->field_0x5de = 5 - i_dogP->field_0x5e0 : i_dogP->field_0x5e0 = 0; + i_this->field_0x5e0--; + i_this->field_0x5e0 < 6 ? i_this->field_0x5de = 5 - i_this->field_0x5e0 : i_this->field_0x5e0 = 0; } } else { - cLib_addCalcAngleS2(&i_dogP->field_0x5de,3,1,1); - i_dogP->field_0x5e2 = 0; - i_dogP->field_0x5e0 = 0x3c; + cLib_addCalcAngleS2(&i_this->field_0x5de,3,1,1); + i_this->field_0x5e2 = 0; + i_this->field_0x5e0 = 0x3c; } } #else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void action(do_class* i_dogP) { +static asm void action(do_class* i_this) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/action__FP8do_class.s" } @@ -2949,28 +2948,28 @@ static asm void action(do_class* i_dogP) { #endif /* 8066DD48-8066DE64 0060E8 011C+00 1/1 0/0 0/0 .text message__FP8do_class */ -static void message(do_class* i_dogP) { - if (i_dogP->field_0xc06 != 0) { - i_dogP->field_0x604 = 10; +static void message(do_class* i_this) { + if (i_this->field_0xc06 != 0) { + i_this->field_0x604 = 10; - if (i_dogP->mMsg.doFlow(i_dogP,0,0)) { + if (i_this->mMsg.doFlow(i_this,0,0)) { i_dComIfGp_event_reset(); - i_dogP->field_0xc06 = 0; + i_this->field_0xc06 = 0; } } else { - if (i_dComIfGp_event_runCheck() && i_dogP->mEvtInfo.checkCommandTalk()) { - i_dogP->mMsg.init(i_dogP,i_dogP->field_0xc08,0,0); - i_dogP->field_0xc06 = 1; + if (i_dComIfGp_event_runCheck() && i_this->mEvtInfo.checkCommandTalk()) { + i_this->mMsg.init(i_this,i_this->field_0xc08,0,0); + i_this->field_0xc06 = 1; } - if (i_dogP->field_0xc05 == 2 && i_dogP->field_0xc08 != -1 && daPy_py_c::i_checkNowWolf()) { - fopAcM_OnStatus(i_dogP,0); - cLib_onBit(i_dogP->mAttentionInfo.mFlags,10); - i_dogP->mEvtInfo.i_onCondition(1); + if (i_this->field_0xc05 == 2 && i_this->field_0xc08 != -1 && daPy_py_c::i_checkNowWolf()) { + fopAcM_OnStatus(i_this,0); + cLib_onBit(i_this->mAttentionInfo.mFlags,10); + i_this->mEvtInfo.i_onCondition(1); } else { - fopAcM_OffStatus(i_dogP,0); - cLib_offBit(i_dogP->mAttentionInfo.mFlags,10); + fopAcM_OffStatus(i_this,0); + cLib_offBit(i_this->mAttentionInfo.mFlags,10); } } @@ -2980,14 +2979,14 @@ static void message(do_class* i_dogP) { /* 8066DE64-8066E494 006204 0630+00 2/1 0/0 0/0 .text daDo_Execute__FP8do_class */ #ifdef NONMATCHING -static void daDo_Execute(do_class* i_dogP) { +static void daDo_Execute(do_class* i_this) { } #else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void daDo_Execute(do_class* i_dogP) { +static asm void daDo_Execute(do_class* i_this) { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/daDo_Execute__FP8do_class.s" } @@ -2995,22 +2994,22 @@ static asm void daDo_Execute(do_class* i_dogP) { #endif /* 8066E494-8066E49C 006834 0008+00 1/0 0/0 0/0 .text daDo_IsDelete__FP8do_class */ -static bool daDo_IsDelete(do_class* i_dogP) { +static bool daDo_IsDelete(do_class* i_this) { return true; } /* 8066E49C-8066E504 00683C 0068+00 1/0 0/0 0/0 .text daDo_Delete__FP8do_class */ #ifdef NONMATCHING int dComIfG_resDelete(request_of_phase_process_class* i_phase, char const* resName); -static int daDo_Delete(do_class* i_dogP) { - u32 actor_id = fopAcM_GetID(i_dogP); - dComIfG_resDelete(&i_dogP->mPhase, "Do"); - if (i_dogP->field_0xcc0 != 0) { +static int daDo_Delete(do_class* i_this) { + u32 actor_id = fopAcM_GetID(i_this); + dComIfG_resDelete(&i_this->mPhase, "Do"); + if (i_this->field_0xcc0 != 0) { u8* tmp = (u8*)struct_8066F2B4 + 2; *tmp = 0; } - if (i_dogP->mHeap) { - i_dogP->mSound.deleteObject(); + if (i_this->mHeap) { + i_this->mSound.deleteObject(); } return 1; } From cede55ba30101ba7cadba9766adbd41eb76b6f36 Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Sat, 4 Feb 2023 17:45:01 -0700 Subject: [PATCH 34/34] pr fixes --- .github/workflows/ok-check.yml | 2 +- include/JSystem/J3DGraphAnimator/J3DModel.h | 15 +-------------- include/rel/d/a/d_a_do/d_a_do.h | 10 +++------- rel/d/a/d_a_do/d_a_do.cpp | 16 ++++++++-------- 4 files changed, 13 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ok-check.yml b/.github/workflows/ok-check.yml index f703ef02f79..f2c34464762 100644 --- a/.github/workflows/ok-check.yml +++ b/.github/workflows/ok-check.yml @@ -17,4 +17,4 @@ jobs: - name: Copy in dol and compilers run: cp /tmp/baserom.dol ./baserom.dol && cp -r /tmp/mwcc_compiler/ tools/mwcc_compiler && cp tools/mwcc_compiler/2.7/mwcceppc.exe tools/mwcc_compiler/2.7/mwcceppc_modded.exe && chown root /github/home/ - name: Run Make (OK) - run: make all rels + run: make all rels && ./tp check --rels diff --git a/include/JSystem/J3DGraphAnimator/J3DModel.h b/include/JSystem/J3DGraphAnimator/J3DModel.h index 73b892ef3c1..3c20380ef51 100644 --- a/include/JSystem/J3DGraphAnimator/J3DModel.h +++ b/include/JSystem/J3DGraphAnimator/J3DModel.h @@ -24,19 +24,6 @@ struct J3DUnkCalc2 { virtual void calc(J3DModelData* mpModelData); }; -struct UserArea { - u8 field_0x00[0x60e]; - s16 field_0x60e; - s16 field_0x610; - s16 field_0x612; - u8 field_0x614[0x14]; - s16 field_0x628; - s16 field_0x62a; - u8 field_0x62c[0x12]; - s16 field_0x63e; - s16 field_0x640; -}; - typedef void (*J3DCalcCallBack)(J3DModel*, u32 timing); class J3DModel { @@ -97,7 +84,7 @@ public: // is there a better way to handle inlines with same name as non-inlines? MtxP i_getAnmMtx(int p1) { return mMtxBuffer->getAnmMtx(p1); } - void i_setAnmMtx(int p1, Mtx mtx) { return mMtxBuffer->setAnmMtx(p1, mtx); } + void i_setAnmMtx(int p1, Mtx mtx) { mMtxBuffer->setAnmMtx(p1, mtx); } /* 0x04 */ J3DModelData* mModelData; /* 0x08 */ u32 mFlags; diff --git a/include/rel/d/a/d_a_do/d_a_do.h b/include/rel/d/a/d_a_do/d_a_do.h index 79e3bee5894..aa58cbabffb 100644 --- a/include/rel/d/a/d_a_do/d_a_do.h +++ b/include/rel/d/a/d_a_do/d_a_do.h @@ -69,11 +69,7 @@ struct daDo_HIO_tmp { /* 0x1E */ u16 mWaterHuntAnimType; }; -struct some_class { - -}; - -class daDo_HIO_c : public some_class { +class daDo_HIO_c { public: /* 80667D4C */ daDo_HIO_c(); /* 8066ED40 */ virtual ~daDo_HIO_c(); @@ -131,10 +127,10 @@ public: /* 0x617 */ u8 field_0x617; /* 0x618 */ cXyz mUnkPos; // something to do with the dog's eye position /* 0x624 */ s16 field_0x624; - /* 0x63C */ s16 field_0x63c; + /* 0x626 */ csXyz field_0x626; + /* 0x62C */ u8 field_0x62c[18]; /* 0x63E */ csXyz field_0x63e; /* 0x644 */ f32 field_0x644; - /* 0x000 */ u8 field_0x000[20]; // some alignment issue here /* 0x648 */ f32 field_0x648; /* 0x64C */ f32 field_0x64c; /* 0x650 */ f32 field_0x650; diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index 377d8177761..87105c9ce1a 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -438,21 +438,21 @@ static int nodeCallBack(J3DJoint* i_jntP, int param_1) { if (param_1 == 0) { int joint_num = i_jntP->getJntNo(); J3DModel* model = j3dSys.getModel(); - UserArea* user_area = (UserArea*)model->getUserArea(); + do_class* user_area = (do_class*)model->getUserArea(); if (user_area) { PSMTXCopy(model->i_getAnmMtx(joint_num), *calc_mtx); if (joint_num == 9 || joint_num == 10) { - cMtx_YrotM(*calc_mtx, user_area->field_0x610 + user_area->field_0x628); - cMtx_XrotM(*calc_mtx, user_area->field_0x612 + user_area->field_0x62a); - cMtx_ZrotM(*calc_mtx, user_area->field_0x60e); + cMtx_YrotM(*calc_mtx, user_area->field_0x60e.y + user_area->field_0x626.y); + cMtx_XrotM(*calc_mtx, user_area->field_0x60e.z + user_area->field_0x626.z); + cMtx_ZrotM(*calc_mtx, user_area->field_0x60e.x); } else if (joint_num == 22) { - cMtx_YrotM(*calc_mtx, user_area->field_0x640 << 1); - cMtx_ZrotM(*calc_mtx, user_area->field_0x63e << 1); + cMtx_YrotM(*calc_mtx, user_area->field_0x63e.y << 1); + cMtx_ZrotM(*calc_mtx, user_area->field_0x63e.x << 1); } else { - cMtx_YrotM(*calc_mtx, user_area->field_0x640); - cMtx_ZrotM(*calc_mtx, user_area->field_0x63e); + cMtx_YrotM(*calc_mtx, user_area->field_0x63e.y); + cMtx_ZrotM(*calc_mtx, user_area->field_0x63e.x); } model->setAnmMtx(joint_num, *calc_mtx);