From 19e18654c9866a5aa5c181c0432157995596cbcb Mon Sep 17 00:00:00 2001 From: TakaRikka <38417346+TakaRikka@users.noreply.github.com> Date: Sat, 1 Mar 2025 04:48:49 -0800 Subject: [PATCH] tag_allmato almost, swhit0 treesh swball done, misc cleanup (#2312) * d_a_tag_allmato almost done * d_a_swhit0 done * some SSystem cleanup * treesh done * swball done, some other rel cleanup --- config/GZ2E01/rels/d_a_swhit0/symbols.txt | 16 +- configure.py | 11 +- include/JSystem/JUtility/JUTAssert.h | 1 + include/SSystem/SComponent/c_bg_s_chk.h | 4 +- include/SSystem/SComponent/c_bg_s_poly_info.h | 7 +- include/SSystem/SComponent/c_cc_d.h | 4 + include/SSystem/SComponent/c_m3d.h | 10 + include/SSystem/SComponent/c_m3d_g_aab.h | 2 + include/SSystem/SComponent/c_m3d_g_cir.h | 6 + include/SSystem/SComponent/c_m3d_g_tri.h | 6 +- include/SSystem/SComponent/c_m3d_g_vtx.h | 13 + include/SSystem/SComponent/c_xyz.h | 32 +- include/d/actor/d_a_arrow.h | 8 + include/d/actor/d_a_obj_boumato.h | 25 + include/d/actor/d_a_obj_itamato.h | 63 +- include/d/actor/d_a_obj_treesh.h | 35 +- include/d/actor/d_a_swBall.h | 26 +- include/d/actor/d_a_swhit0.h | 77 +- include/d/actor/d_a_tag_allmato.h | 74 +- include/d/actor/d_a_tag_wljump.h | 7 +- include/d/d_camera.h | 2 + include/d/d_com_inf_game.h | 4 + .../MSL/MSL_C/MSL_Common/Include/cmath.h | 4 + src/SSystem/SComponent/c_bg_s_chk.cpp | 4 +- src/SSystem/SComponent/c_bg_s_poly_info.cpp | 20 +- src/SSystem/SComponent/c_bg_w.cpp | 20 +- src/SSystem/SComponent/c_cc_s.cpp | 14 +- src/SSystem/SComponent/c_lib.cpp | 12 +- src/SSystem/SComponent/c_list.cpp | 34 +- src/SSystem/SComponent/c_m2d.cpp | 63 +- src/SSystem/SComponent/c_m3d.cpp | 5 - src/SSystem/SComponent/c_m3d_g_aab.cpp | 56 +- src/SSystem/SComponent/c_m3d_g_cir.cpp | 10 +- src/SSystem/SComponent/c_m3d_g_cps.cpp | 8 +- src/SSystem/SComponent/c_m3d_g_lin.cpp | 19 +- src/SSystem/SComponent/c_m3d_g_pla.cpp | 33 +- src/SSystem/SComponent/c_m3d_g_sph.cpp | 5 +- src/SSystem/SComponent/c_m3d_g_tri.cpp | 37 +- src/SSystem/SComponent/c_m3d_g_vtx.cpp | 8 + src/SSystem/SComponent/c_malloc.cpp | 12 +- src/SSystem/SComponent/c_math.cpp | 50 +- src/SSystem/SComponent/c_node.cpp | 13 +- src/SSystem/SComponent/c_node_iter.cpp | 7 +- src/SSystem/SComponent/c_phase.cpp | 15 +- src/SSystem/SComponent/c_tag.cpp | 8 +- src/SSystem/SComponent/c_tree_iter.cpp | 12 +- src/SSystem/SComponent/c_xyz.cpp | 70 +- src/d/actor/d_a_obj_itamato.cpp | 2 - src/d/actor/d_a_obj_treesh.cpp | 434 +++---- src/d/actor/d_a_swBall.cpp | 410 ++++--- src/d/actor/d_a_swhit0.cpp | 799 +++++++------ src/d/actor/d_a_tag_allmato.cpp | 1048 +++++++++-------- src/d/actor/d_a_tag_wljump.cpp | 235 ++-- src/d/actor/d_a_title.cpp | 29 +- 54 files changed, 2162 insertions(+), 1767 deletions(-) create mode 100644 include/SSystem/SComponent/c_m3d_g_vtx.h create mode 100644 src/SSystem/SComponent/c_m3d_g_vtx.cpp diff --git a/config/GZ2E01/rels/d_a_swhit0/symbols.txt b/config/GZ2E01/rels/d_a_swhit0/symbols.txt index 9c7ead74c7..fea26339ca 100644 --- a/config/GZ2E01/rels/d_a_swhit0/symbols.txt +++ b/config/GZ2E01/rels/d_a_swhit0/symbols.txt @@ -9,7 +9,7 @@ getType__10daSwhit0_cFv = .text:0x000000C8; // type:function size:0x1C scope:glo makeEventId__10daSwhit0_cFv = .text:0x000000E4; // type:function size:0x88 scope:global CreateHeap__10daSwhit0_cFv = .text:0x0000016C; // type:function size:0x128 scope:global CreateInit__10daSwhit0_cFv = .text:0x00000294; // type:function size:0x17C scope:global -CheckCreateHeap__FP10fopAc_ac_c = .text:0x00000410; // type:function size:0x20 scope:global +CheckCreateHeap__FP10fopAc_ac_c = .text:0x00000410; // type:function size:0x20 scope:local create__10daSwhit0_cFv = .text:0x00000430; // type:function size:0x204 scope:global __dt__8cM3dGSphFv = .text:0x00000634; // type:function size:0x48 scope:global __dt__8cM3dGAabFv = .text:0x0000067C; // type:function size:0x48 scope:global @@ -29,10 +29,10 @@ actionToOnDemo2__10daSwhit0_cFv = .text:0x00000E08; // type:function size:0x13C actionSwWait__10daSwhit0_cFv = .text:0x00000F44; // type:function size:0xFC scope:global actionOnWait__10daSwhit0_cFv = .text:0x00001040; // type:function size:0x120 scope:global setDrawMtx__10daSwhit0_cFv = .text:0x00001160; // type:function size:0x58 scope:global -daSwhit0_Draw__FP10daSwhit0_c = .text:0x000011B8; // type:function size:0xF0 scope:global -daSwhit0_Execute__FP10daSwhit0_c = .text:0x000012A8; // type:function size:0xBC scope:global -daSwhit0_Delete__FP10daSwhit0_c = .text:0x00001364; // type:function size:0x48 scope:global -daSwhit0_Create__FP10fopAc_ac_c = .text:0x000013AC; // type:function size:0x20 scope:global +daSwhit0_Draw__FP10daSwhit0_c = .text:0x000011B8; // type:function size:0xF0 scope:local +daSwhit0_Execute__FP10daSwhit0_c = .text:0x000012A8; // type:function size:0xBC scope:local +daSwhit0_Delete__FP10daSwhit0_c = .text:0x00001364; // type:function size:0x48 scope:local +daSwhit0_Create__FP10fopAc_ac_c = .text:0x000013AC; // type:function size:0x20 scope:local cLib_calcTimer__FPUc = .text:0x000013CC; // type:function size:0x1C scope:global _ctors = .ctors:0x00000000; // type:label scope:global _dtors = .dtors:0x00000000; // type:label scope:global @@ -41,12 +41,12 @@ _dtors = .dtors:0x00000000; // type:label scope:global @3982 = .rodata:0x00000008; // type:object size:0x4 scope:local data:float @4212 = .rodata:0x00000010; // type:object size:0x8 scope:local data:double @stringBase0 = .rodata:0x00000018; // type:object size:0x33 scope:local data:string_table -l_arcName = .data:0x00000000; // type:object size:0x4 scope:global -l_sph_src = .data:0x00000004; // type:object size:0x40 scope:global +l_arcName = .data:0x00000000; // type:object size:0x4 scope:local +l_sph_src = .data:0x00000004; // type:object size:0x40 scope:local action_table$3953 = .data:0x00000044; // type:object size:0x8 scope:local l_color$localstatic3$draw__10daSwhit0_cFv = .data:0x0000004C; // type:object size:0x8 scope:local @4230 = .data:0x00000054; // type:object size:0x2C scope:local -l_daSwhit0_Method = .data:0x00000080; // type:object size:0x20 scope:global +l_daSwhit0_Method = .data:0x00000080; // type:object size:0x20 scope:local g_profile_SWHIT0 = .data:0x000000A0; // type:object size:0x30 scope:global __vt__8cM3dGSph = .data:0x000000D0; // type:object size:0xC scope:global __vt__8cM3dGAab = .data:0x000000DC; // type:object size:0xC scope:global diff --git a/configure.py b/configure.py index 7b206e77a4..c5073060f8 100755 --- a/configure.py +++ b/configure.py @@ -708,6 +708,7 @@ config.libs = [ Object(MatchingFor("GZ2E01"), "SSystem/SComponent/c_m3d_g_pla.cpp"), Object(MatchingFor("GZ2E01"), "SSystem/SComponent/c_m3d_g_sph.cpp"), Object(MatchingFor("GZ2E01"), "SSystem/SComponent/c_m3d_g_tri.cpp"), + Object(NonMatching, "SSystem/SComponent/c_m3d_g_vtx.cpp"), Object(MatchingFor("GZ2E01"), "SSystem/SComponent/c_lib.cpp"), Object(MatchingFor("GZ2E01"), "SSystem/SComponent/c_angle.cpp"), Object(MatchingFor("GZ2E01"), "SSystem/SStandard/s_basic.cpp"), @@ -1457,8 +1458,8 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01"), "d_a_path_line"), ActorRel(NonMatching, "d_a_scene_exit"), ActorRel(MatchingFor("GZ2E01"), "d_a_set_bgobj"), - ActorRel(NonMatching, "d_a_swhit0"), - ActorRel(NonMatching, "d_a_tag_allmato"), + ActorRel(MatchingFor("GZ2E01"), "d_a_swhit0"), + ActorRel(NonMatching, "d_a_tag_allmato", extra_cflags=['-pragma "nosyminline off"']), ActorRel(MatchingFor("GZ2E01"), "d_a_tag_camera"), ActorRel(MatchingFor("GZ2E01"), "d_a_tag_chkpoint"), ActorRel(MatchingFor("GZ2E01"), "d_a_tag_event"), @@ -2101,7 +2102,7 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01"), "d_a_obj_tornado"), ActorRel(MatchingFor("GZ2E01"), "d_a_obj_tornado2"), ActorRel(MatchingFor("GZ2E01"), "d_a_obj_tp"), - ActorRel(NonMatching, "d_a_obj_treesh"), + ActorRel(MatchingFor("GZ2E01"), "d_a_obj_treesh"), ActorRel(NonMatching, "d_a_obj_twGate"), ActorRel(NonMatching, "d_a_obj_udoor"), ActorRel(MatchingFor("GZ2E01"), "d_a_obj_usaku"), @@ -2138,7 +2139,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_ppolamp"), ActorRel(MatchingFor("GZ2E01"), "d_a_skip_2D"), ActorRel(MatchingFor("GZ2E01"), "d_a_startAndGoal", extra_cflags=['-pragma "nosyminline off"']), - ActorRel(NonMatching, "d_a_swBall"), + ActorRel(MatchingFor("GZ2E01"), "d_a_swBall"), ActorRel(MatchingFor("GZ2E01"), "d_a_swLBall"), ActorRel(MatchingFor("GZ2E01"), "d_a_swTime"), ActorRel(NonMatching, "d_a_tag_Lv6Gate"), @@ -2187,7 +2188,7 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01"), "d_a_tag_yami", extra_cflags=['-pragma "nosyminline off"']), ActorRel(MatchingFor("GZ2E01"), "d_a_talk"), ActorRel(MatchingFor("GZ2E01"), "d_a_tboxSw"), - ActorRel(NonMatching, "d_a_title"), + ActorRel(Equivalent, "d_a_title"), # weak func order ActorRel(MatchingFor("GZ2E01"), "d_a_warp_bug"), ] diff --git a/include/JSystem/JUtility/JUTAssert.h b/include/JSystem/JUtility/JUTAssert.h index 66256e08b7..89ad5904df 100644 --- a/include/JSystem/JUtility/JUTAssert.h +++ b/include/JSystem/JUtility/JUTAssert.h @@ -40,6 +40,7 @@ namespace JUTAssertion { void showAssert(u32 device, const char * file, int line, const char * assertion); void setWarningMessage_f(u32 device, char * file, int line, const char * fmt, ...); void setLogMessage_f(u32 device, char* file, int line, const char* fmt, ...); + void setConfirmMessage(u32 param_1, char* file, int line, bool param_4, const char* msg); }; extern bool sAssertVisible; diff --git a/include/SSystem/SComponent/c_bg_s_chk.h b/include/SSystem/SComponent/c_bg_s_chk.h index 3ba9867669..9475fe8d42 100644 --- a/include/SSystem/SComponent/c_bg_s_chk.h +++ b/include/SSystem/SComponent/c_bg_s_chk.h @@ -24,7 +24,7 @@ public: public: cBgS_Chk(); void SetExtChk(cBgS_Chk&); - bool ChkSameActorPid(unsigned int) const; + bool ChkSameActorPid(fpc_ProcID) const; void SetActorPid(fpc_ProcID pid) { mActorPid = pid; } fpc_ProcID GetActorPid() const { return mActorPid; } @@ -34,7 +34,7 @@ public: cBgS_GrpPassChk* GetGrpPassChk() const { return mGrpPassChk; } void OffSameActorChk() { mSameActorChk = false; } - virtual ~cBgS_Chk(void); + virtual ~cBgS_Chk(); }; // Size: 0x14 #endif /* C_BG_S_CHK_H */ diff --git a/include/SSystem/SComponent/c_bg_s_poly_info.h b/include/SSystem/SComponent/c_bg_s_poly_info.h index a3b5e915bf..1693b5e058 100644 --- a/include/SSystem/SComponent/c_bg_s_poly_info.h +++ b/include/SSystem/SComponent/c_bg_s_poly_info.h @@ -2,21 +2,22 @@ #define C_BG_S_POLY_INFO_H #include "dolphin/types.h" +#include "f_pc/f_pc_manager.h" class cBgS_PolyInfo { private: /* 0x00 */ u16 mPolyIndex; /* 0x02 */ u16 mBgIndex; /* 0x04 */ void* unk_0x04; - /* 0x08 */ unsigned int mActorId; + /* 0x08 */ fpc_ProcID mActorId; public: cBgS_PolyInfo(); bool ChkSetInfo() const; void ClearPi(); void SetPolyInfo(const cBgS_PolyInfo&); - void SetActorInfo(int, void*, unsigned int); - bool ChkSafe(const void*, unsigned int) const; + void SetActorInfo(int, void*, fpc_ProcID); + bool ChkSafe(const void*, fpc_ProcID) const; void SetPolyIndex(int); bool ChkBgIndex() const; diff --git a/include/SSystem/SComponent/c_cc_d.h b/include/SSystem/SComponent/c_cc_d.h index 7a233a5965..a56f90ca8d 100644 --- a/include/SSystem/SComponent/c_cc_d.h +++ b/include/SSystem/SComponent/c_cc_d.h @@ -211,6 +211,8 @@ public: /* 8026476C */ virtual bool GetNVec(cXyz const&, cXyz*) const; /* 80264808 */ virtual void getShapeAccess(cCcD_ShapeAttr::Shape*) const; + const cM3dGSph* GetShapeP() const { return this; } + }; // Size = 0x34 STATIC_ASSERT(0x34 == sizeof(cCcD_SphAttr)); @@ -243,6 +245,8 @@ public: /* 802643D0 */ virtual bool GetNVec(cXyz const&, cXyz*) const; /* 802644B8 */ virtual void getShapeAccess(cCcD_ShapeAttr::Shape*) const; + const cM3dGCyl* GetShapeP() const { return this; } + }; // Size = 0x38 STATIC_ASSERT(0x38 == sizeof(cCcD_CylAttr)); diff --git a/include/SSystem/SComponent/c_m3d.h b/include/SSystem/SComponent/c_m3d.h index fefbb8108d..e5ef0597a0 100644 --- a/include/SSystem/SComponent/c_m3d.h +++ b/include/SSystem/SComponent/c_m3d.h @@ -101,4 +101,14 @@ inline f32 cM3d_LenSq(const Vec* a, const Vec* b) { return VECSquareDistance(a, b); } +inline bool cM3d_Cross_LinSph(const cM3dGLin* lin_p, const cM3dGSph* sph_p) { + Vec sp10; + return cM3d_Cross_LinSph(lin_p, sph_p, &sp10); +} + +inline bool cM3d_Cross_CylSph(const cM3dGCyl* cyl, const cM3dGSph* sph, Vec* out) { + f32 sp10; + return cM3d_Cross_CylSph(cyl, sph, out, &sp10); +} + #endif diff --git a/include/SSystem/SComponent/c_m3d_g_aab.h b/include/SSystem/SComponent/c_m3d_g_aab.h index 759f2b6402..43ae9226c2 100644 --- a/include/SSystem/SComponent/c_m3d_g_aab.h +++ b/include/SSystem/SComponent/c_m3d_g_aab.h @@ -26,7 +26,9 @@ public: void CalcCenter(cXyz*) const; void PlusR(f32); const cXyz* GetMaxP(void) const { return &mMax; } + const cXyz* GetMaxP(void) { return &mMax; } const cXyz* GetMinP(void) const { return &mMin; } + const cXyz* GetMinP(void) { return &mMin; } const f32 GetMaxX(void) const { return mMax.x; } const f32 GetMaxY(void) const { return mMax.y; } const f32 GetMaxZ(void) const { return mMax.z; } diff --git a/include/SSystem/SComponent/c_m3d_g_cir.h b/include/SSystem/SComponent/c_m3d_g_cir.h index 222de788ff..e82f19b0de 100644 --- a/include/SSystem/SComponent/c_m3d_g_cir.h +++ b/include/SSystem/SComponent/c_m3d_g_cir.h @@ -13,6 +13,12 @@ public: f32 GetCy() const { return mPosY; } f32 GetR() const { return mRadius; } + void Set(f32 pos_x, f32 pos_y, f32 radius) { + mPosX = pos_x; + mPosY = pos_y; + mRadius = radius; + } + cM2dGCir() {} virtual ~cM2dGCir() {} }; diff --git a/include/SSystem/SComponent/c_m3d_g_tri.h b/include/SSystem/SComponent/c_m3d_g_tri.h index 72d0b11472..214c1d0285 100644 --- a/include/SSystem/SComponent/c_m3d_g_tri.h +++ b/include/SSystem/SComponent/c_m3d_g_tri.h @@ -34,6 +34,10 @@ public: bool cross(const cM3dGLin* lin, Vec* xyz, bool param_2, bool param_3) const { return cM3d_Cross_LinTri(lin, this, xyz, param_2, param_3); } + + void setUp() { + SetupFrom3Vtx(&mA, &mB, &mC); + } }; -#endif \ No newline at end of file +#endif diff --git a/include/SSystem/SComponent/c_m3d_g_vtx.h b/include/SSystem/SComponent/c_m3d_g_vtx.h new file mode 100644 index 0000000000..e9f82a4729 --- /dev/null +++ b/include/SSystem/SComponent/c_m3d_g_vtx.h @@ -0,0 +1,13 @@ +#ifndef C_M3D_G_VTX_H_ +#define C_M3D_G_VTX_H_ + +#include "SSystem/SComponent/c_xyz.h" + +class cM3dGVtx { +public: + ~cM3dGVtx(); + + cXyz vtx; +}; + +#endif diff --git a/include/SSystem/SComponent/c_xyz.h b/include/SSystem/SComponent/c_xyz.h index 5198010436..958f0dec80 100644 --- a/include/SSystem/SComponent/c_xyz.h +++ b/include/SSystem/SComponent/c_xyz.h @@ -97,37 +97,16 @@ struct cXyz : Vec { void setall(f32 f) { set(f, f, f); } - void setMin(const cXyz& other) { - if (x > other.x) { - x = other.x; - } - if (y > other.y) { - y = other.y; - } - if (z > other.z) { - z = other.z; - } - } - - void setMax(const cXyz& other) { - if (x < other.x) { - x = other.x; - } - if (y < other.y) { - y = other.y; - } - if (z < other.z) { - z = other.z; - } - } void zero() { set(0.0f, 0.0f, 0.0f); } - float getSquareMag() const { return VECSquareMag(this); } + f32 getSquareMag() const { return VECSquareMag(this); } f32 getSquareDistance(const Vec& other) const { return VECSquareDistance(this, &other); } - static float getNearZeroValue() { return 8e-11f; } + static f32 getNearZeroValue() { return 8e-11f; } bool isNearZeroSquare() const { return (this->getSquareMag() < getNearZeroValue()); } + bool isNearZeroSquare(const cXyz& other) const { return (PSVECSquareMag(&other) < getNearZeroValue()); } + f32 abs2() const { return this->getSquareMag(); } f32 abs2(const Vec& other) const { return this->getSquareDistance(other); } f32 abs2XZ() const { @@ -139,13 +118,16 @@ struct cXyz : Vec { cXyz tmp2(other.x, 0, other.z); return tmp.abs2(tmp2); } + f32 abs() const { return sqrtf(this->abs2()); } f32 abs(const Vec& other) const { return sqrtf(this->abs2(other)); } f32 absXZ() const { return sqrtf(this->abs2XZ()); } f32 absXZ(const Vec& other) const { return sqrtf(this->abs2XZ(other)); } + f32 getMagXZ() const { return cXyz(this->x, 0, this->z).getSquareMag(); } f32 getDotProduct(const Vec& other) const { return VECDotProduct(this, &other); } + f32 inprod(const Vec& other) const { return getDotProduct(other); } f32 inprodXZ(const Vec& other) const { return x * other.x + z * other.z; } }; diff --git a/include/d/actor/d_a_arrow.h b/include/d/actor/d_a_arrow.h index b330655ca5..d630b31764 100644 --- a/include/d/actor/d_a_arrow.h +++ b/include/d/actor/d_a_arrow.h @@ -60,6 +60,14 @@ public: bool checkBombArrow() const { return mArrowType == true; } u32 getHitAcID() { return mHitAcID; } + BOOL checkWait() { return fopAcM_GetParam(this) == 0; } + + f32 getOutLengthRate() { return mOutLengthRate; } + f32 getArrowOutLength() { return 95.0f; } + f32 getArrowAtR() { return 5.0f; } + f32 getFlyMax() { return mFlyMax; } + cXyz getStartPos() { return mStartPos; } + void setShoot() { fopAcM_SetParam(this, 1); } void setChargeShoot() { fopAcM_SetParam(this, 2); } diff --git a/include/d/actor/d_a_obj_boumato.h b/include/d/actor/d_a_obj_boumato.h index 02623377d6..fb21b132a3 100644 --- a/include/d/actor/d_a_obj_boumato.h +++ b/include/d/actor/d_a_obj_boumato.h @@ -2,6 +2,7 @@ #define D_A_OBJ_BOUMATO_H #include "d/d_bg_s_acch.h" +#include "d/actor/d_a_arrow.h" #include "d/d_jnt_col.h" #include "f_op/f_op_actor_mng.h" #include "d/d_cc_d.h" @@ -60,10 +61,34 @@ public: /* 80BBC1F8 */ void setRoomNo(); /* 80BBC23C */ void setMtx(); + int checkCrs(fopAc_ac_c* param_0, cXyz param_1, cXyz param_2, f32 param_3) { + daArrow_c* arrow_p = (daArrow_c*)param_0; + cXyz sp2C; + cXyz sp20; + + JUT_ASSERT(164, 0 != arrow_p); + + if (field_0xa38 != 0) { + return 0; + } + + mCyl2.cM3dGCyl::Set(current.pos, mCyl.GetShapeP()->GetR() + 120.0f, mCyl.GetShapeP()->GetH() + 30.0f); + if ((param_1 - current.pos).abs() < param_3) { + mGLin.SetStartEnd(param_1, param_2); + if (cM3d_Cross_CylLin(&mCyl2, &mGLin, &sp2C, &sp20)) { + return 2; + } + } + + return 0; + } + u8 getType() { return 0; } u8 getOffSwBit() { return (fopAcM_GetParam(this) & 0xff00) >> 8; } u8 getOnSwBit() { return (fopAcM_GetParam(this) & 0xff0000) >> 16; } void setCutType(u8 cutType) { mCutType = cutType; } + fpc_ProcID getTgHitAcId() { return mTargetId; } + void clrTgHitAcId() { mTargetId = fpcM_ERROR_PROCESS_ID_e; } }; STATIC_ASSERT(sizeof(daObj_BouMato_c) == 0xa40); diff --git a/include/d/actor/d_a_obj_itamato.h b/include/d/actor/d_a_obj_itamato.h index ecd5a1998d..960bab0240 100644 --- a/include/d/actor/d_a_obj_itamato.h +++ b/include/d/actor/d_a_obj_itamato.h @@ -2,6 +2,7 @@ #define D_A_OBJ_ITAMATO_H #include "f_op/f_op_actor_mng.h" +#include "d/actor/d_a_arrow.h" #include "d/d_cc_d.h" /** @@ -29,8 +30,68 @@ public: /* 80C2A8EC */ void setRoomNo(); /* 80C2A930 */ void setMtx(); + int checkCrs(fopAc_ac_c* param_0, cXyz param_1, cXyz param_2, f32 param_3) { + daArrow_c* arrow_p = (daArrow_c*)param_0; + cM3dGSph sp38; + cXyz sp2C; + cXyz sp20; + + JUT_ASSERT(170, 0 != arrow_p); + + if (field_0xa16 != 0 || health == 0) { + return 0; + } + + sp38.Set(field_0x80c.GetShapeP()->GetC(), field_0x80c.GetShapeP()->GetR() + (arrow_p->getArrowAtR() * 2.0f)); + if ((param_1 - current.pos).abs() < param_3) { + field_0x944.SetStartEnd(param_1, param_2); + if (cM3d_Cross_LinSph(&field_0x944, &sp38)) { + return 3; + } + } + + return 0; + } + + int getNo() { + u8 var_r31 = fopAcM_GetParam(this) & 0xFF; + + int no; + if (var_r31 == 0xFF) { + no = -1; + } else { + no = var_r31; + } + + return no; + } + + BOOL checkBrk() { + if (field_0xa15 != 0) { + return 4; + } + + return 0; + } + + void onFake() { mFake = true; } + private: - /* 0x568 */ u8 field_0x568[0xa20 - 0x568]; + /* 0x568 */ u8 field_0x568[0x57C - 0x568]; + /* 0x57C */ dBgS_ObjAcch field_0x57c; + /* 0x754 */ dCcD_Stts field_0x754; + /* 0x790 */ dBgS_AcchCir field_0x790; + /* 0x7D0 */ cBgS_GndChk field_0x7d0; + /* 0x80C */ dCcD_Sph field_0x80c; + /* 0x944 */ cM3dGLin field_0x944; + /* 0x960 */ dBgS_LinChk field_0x960; + /* 0x9D0 */ csXyz field_0x9d0[3]; + /* 0x9e2 */ u8 field_0x9e2[0xA15 - 0x9E2]; + /* 0xA15 */ u8 field_0xa15; + /* 0xA15 */ u8 field_0xa16; + /* 0xA17 */ u8 field_0xa17[0xA19 - 0xA17]; + /* 0xA19 */ u8 mFake; + /* 0xA1A */ u8 field_0xa1a[0xA20 - 0xA1A]; }; STATIC_ASSERT(sizeof(daObj_ItaMato_c) == 0xa20); diff --git a/include/d/actor/d_a_obj_treesh.h b/include/d/actor/d_a_obj_treesh.h index ca3b931962..267e086613 100644 --- a/include/d/actor/d_a_obj_treesh.h +++ b/include/d/actor/d_a_obj_treesh.h @@ -2,6 +2,8 @@ #define D_A_OBJ_TREESH_H #include "f_op/f_op_actor_mng.h" +#include "d/d_bg_s_movebg_actor.h" +#include "m_Do/m_Do_hostIO.h" /** * @ingroup actors-objects @@ -11,27 +13,38 @@ * @details * */ -class daTreeSh_c : public fopAc_ac_c { +class daTreeSh_c : public dBgS_MoveBgActor { public: /* 80D1F258 */ void initBaseMtx(); /* 80D1F294 */ void setBaseMtx(); - /* 80D1F2E8 */ void CreateHeap(); - /* 80D1F358 */ void Create(); - /* 80D1F414 */ void create1st(); - /* 80D1F49C */ void Execute(f32 (**)[3][4]); - /* 80D1F648 */ void Draw(); - /* 80D1F6EC */ void Delete(); + /* 80D1F414 */ int create1st(); -private: - /* 0x568 */ u8 field_0x568[0x5cc - 0x568]; + /* 80D1F2E8 */ virtual int CreateHeap(); + /* 80D1F358 */ virtual int Create(); + /* 80D1F49C */ virtual int Execute(Mtx**); + /* 80D1F648 */ virtual int Draw(); + /* 80D1F6EC */ virtual int Delete(); + + /* 0x5A0 */ request_of_phase_process_class mPhase; + /* 0x5A8 */ J3DModel* mpModel; + /* 0x5AC */ csXyz mRot[2]; + /* 0x5B8 */ f32 field_0x5b8[2]; + /* 0x5C0 */ s16 field_0x5c0[2]; + /* 0x5C4 */ s16 field_0x5c4[2]; + /* 0x5C8 */ s16 mShakeTimer[2]; }; STATIC_ASSERT(sizeof(daTreeSh_c) == 0x5cc); -class daTreeSh_HIO_c { +class daTreeSh_HIO_c : public mDoHIO_entry_c { public: /* 80D1F0CC */ daTreeSh_HIO_c(); - /* 80D1F81C */ ~daTreeSh_HIO_c(); + /* 80D1F81C */ virtual ~daTreeSh_HIO_c() {} + + /* 0x4 */ s16 shake_strength; + /* 0x6 */ s16 shake_speed; + /* 0x8 */ s16 field_0x8; + /* 0xA */ csXyz field_0xa; }; diff --git a/include/d/actor/d_a_swBall.h b/include/d/actor/d_a_swBall.h index 45dc0a89db..484f44333d 100644 --- a/include/d/actor/d_a_swBall.h +++ b/include/d/actor/d_a_swBall.h @@ -13,19 +13,31 @@ */ class daSwBall_c : public fopAc_ac_c { public: - /* 80D4E054 */ void checkArea_sub(fopAc_ac_c*); - /* 80D4E194 */ void checkArea(); + /* 80D4E054 */ BOOL checkArea_sub(fopAc_ac_c*); + /* 80D4E194 */ BOOL checkArea(); /* 80D4E248 */ void search_ball(); - /* 80D4E374 */ void Create(); - /* 80D4E42C */ void create(); - /* 80D4E494 */ void execute(); + /* 80D4E374 */ int Create(); + /* 80D4E42C */ int create(); + /* 80D4E494 */ int execute(); /* 80D4E524 */ void actionRun(); /* 80D4E6C4 */ void actionStop(); /* 80D4E6C8 */ void PutCrrPos(); - /* 80D4E90C */ bool _delete(); + /* 80D4E90C */ int _delete(); + + u8 getArg0() { return fopAcM_GetParamBit(this, 0, 8); } + u8 getArg1() { return fopAcM_GetParamBit(this, 8, 8); } + u8 getSwbit() { return fopAcM_GetParamBit(this, 16, 8); } + u8 getType() { return fopAcM_GetParamBit(this, 24, 4); } + bool checkPullLBall() { return fopAcM_GetParamBit(this, 28, 2) == 0; } private: - /* 0x568 */ u8 field_0x568[0x5a0 - 0x568]; + /* 0x568 */ fpc_ProcID mBallIDs[8]; + /* 0x588 */ u8 mTimer; + /* 0x589 */ u8 mAction; + /* 0x58A */ u8 mMode; + /* 0x58B */ u8 mIsBallCarry[8]; + /* 0x593 */ u8 field_0x593[8]; + /* 0x59C */ fpc_ProcID field_0x59c; }; STATIC_ASSERT(sizeof(daSwBall_c) == 0x5a0); diff --git a/include/d/actor/d_a_swhit0.h b/include/d/actor/d_a_swhit0.h index 08604d3547..df7f4bcc7c 100644 --- a/include/d/actor/d_a_swhit0.h +++ b/include/d/actor/d_a_swhit0.h @@ -2,6 +2,7 @@ #define D_A_SWHIT0_H #include "f_op/f_op_actor_mng.h" +#include "d/d_cc_d.h" /** * @ingroup actors-unsorted @@ -11,35 +12,69 @@ * @details * */ -class daSwhit0_c : public fopAc_ac_c { +class daSwhit0_c : public fopAc_ac_c, public request_of_phase_process_class { public: - /* 80485FF8 */ void getSwNo(); - /* 80486004 */ void getSwNo2(); - /* 80486010 */ void getEvNo(); - /* 8048602C */ void getTimer(); - /* 80486048 */ void getType(); + enum Action_e { + ACTION_SW_WAIT_e, + ACTION_OFF_WAIT_e, + ACTION_TO_ON_READY_e, + ACTION_TO_ON_ORDER_e, + ACTION_TO_ON_DEMO_e, + ACTION_TO_ON_DEMO2_e, + ACTION_ON_WAIT_e, + ACTION_TOOL_TO_ON_READY_e, + ACTION_TOOL_TO_ON_ORDER_e, + ACTION_TOOL_TO_ON_DEMO_e, + ACTION_TOOL_TO_ON_DEMO2_e, + }; + + /* 80485FF8 */ int getSwNo(); + /* 80486004 */ int getSwNo2(); + /* 80486010 */ u8 getEvNo(); + /* 8048602C */ u8 getTimer(); + /* 80486048 */ u8 getType(); /* 80486064 */ void makeEventId(); - /* 804860EC */ void CreateHeap(); - /* 80486214 */ void CreateInit(); - /* 804863B0 */ void create(); - /* 8048668C */ void checkHit(); + /* 804860EC */ int CreateHeap(); + /* 80486214 */ int CreateInit(); + /* 804863B0 */ int create(); + /* 8048668C */ bool checkHit(); /* 80486704 */ void setCombackTimer(); - /* 80486788 */ void endCombackTimer(); + /* 80486788 */ int endCombackTimer(); /* 80486800 */ void onSwitch(); /* 80486858 */ void offSwitch(); - /* 804868A8 */ void DemoProc(); + /* 804868A8 */ int DemoProc(); /* 804869C4 */ void orderEvent(); - /* 80486ABC */ void actionOffWait(); - /* 80486BC4 */ void actionToOnReady(); - /* 80486C28 */ void actionToOnOrder(); - /* 80486CE4 */ void actionToOnDemo(); - /* 80486D88 */ void actionToOnDemo2(); - /* 80486EC4 */ void actionSwWait(); - /* 80486FC0 */ void actionOnWait(); + /* 80486ABC */ int actionOffWait(); + /* 80486BC4 */ int actionToOnReady(); + /* 80486C28 */ int actionToOnOrder(); + /* 80486CE4 */ int actionToOnDemo(); + /* 80486D88 */ int actionToOnDemo2(); + /* 80486EC4 */ int actionSwWait(); + /* 80486FC0 */ int actionOnWait(); /* 804870E0 */ void setDrawMtx(); -private: - /* 0x568 */ u8 field_0x568[0x75c - 0x568]; + inline int draw(); + inline int execute(); + + void setActio(u8 i_action) { mAction = i_action; } + void onFlag(u16 i_flag) { mFlags |= i_flag; } + void offFlag(u16 i_flag) { mFlags &= ~i_flag; } + bool checkFlag(u16 i_flag) { return mFlags & i_flag; } + + /* 0x570 */ J3DModel* mpModel; + /* 0x574 */ mDoExt_bckAnm mBck; + /* 0x590 */ mDoExt_brkAnm mBrk; + /* 0x5A8 */ Mtx field_0x5a8; + /* 0x5D8 */ dCcD_Stts mColliderStts; + /* 0x614 */ dCcD_Sph mSph; + /* 0x74C */ u8 mHitWaitTimer; + /* 0x74D */ u8 mAction; + /* 0x74E */ u8 mReadyTimer; + /* 0x750 */ s16 mCombackTimer; + /* 0x752 */ s16 mSwWaitTimer; + /* 0x754 */ u16 mFlags; + /* 0x756 */ s16 mEventId; + /* 0x758 */ int mStaffId; }; STATIC_ASSERT(sizeof(daSwhit0_c) == 0x75c); diff --git a/include/d/actor/d_a_tag_allmato.h b/include/d/actor/d_a_tag_allmato.h index dc288b3f54..7ac95f1027 100644 --- a/include/d/actor/d_a_tag_allmato.h +++ b/include/d/actor/d_a_tag_allmato.h @@ -1,6 +1,78 @@ #ifndef D_A_TAG_ALLMATO_H #define D_A_TAG_ALLMATO_H -#include "dolphin/types.h" +#include "d/actor/d_a_npc.h" + +class daTag_AllMato_c : public fopAc_ac_c { +public: + /* 0x0568 */ daNpcT_ActorMngr_c mBouMatoActorMngr[1]; + /* 0x0570 */ daNpcT_ActorMngr_c mItaMatoActorMngr[2]; + /* 0x0580 */ daNpcT_ActorMngr_c mArrowActorMngr; + /* 0x0588 */ daNpcT_ActorMngr_c mBrkMatoActorMngr; + /* 0x0590 */ cXyz field_0x590[500]; + /* 0x1D00 */ int mBouMatoActorNum; + /* 0x1D04 */ int mItaMatoActorNum; + /* 0x1D08 */ int field_0x1d08; + /* 0x1D0C */ s16 mEventIdx; + /* 0x1D0E */ u8 field_0x1d0e; + /* 0x1D0F */ u8 field_0x1d0f; + /* 0x1D10 */ u8 field_0x1d10; + + /* 80487538 */ int create(); + /* 804876B0 */ int Delete(); + /* 804876B8 */ int Execute(); + /* 80487C5C */ int Draw(); + /* 80487C64 */ static void* srchBouMato(void*, void*); + /* 80487D00 */ static void* srchItaMato(void*, void*); + /* 80487D9C */ static void* srchTaro(void*, void*); + /* 80487E38 */ static void* srchArrow(void*, void*); + /* 80487ED4 */ int isDelete(); + /* 80487F80 */ void entryBouMatoActors(); + /* 80488034 */ void entryItaMatoActors(); + /* 80488104 */ fopAc_ac_c* getTaroActorP(); + /* 804881C0 */ fopAc_ac_c* getArrowActorP(); + /* 80488238 */ int checkCrsMato(); + /* 80488994 */ int checkCrsMato2(); + /* 80488F40 */ int checkBrkMato(); + /* 80488FD8 */ void evtChange(u16); + + /* 80489608 */ virtual ~daTag_AllMato_c() {} + + int getType() { return 0; } + + int getOnEvtBit() { + u32 prm = fopAcM_GetParam(this) & 0xFFF; + + int bit; + if (prm == 0xFFF) { + bit = -1; + } else { + bit = prm; + } + + return bit; + } + + u32 getOffEvtBit() { + u32 prm = (fopAcM_GetParam(this) & 0xFFF000) >> 12; + + u32 bit; + if (prm == 0xFFF) { + bit = 0xFFFFFFFF; + } else { + bit = prm; + } + + return bit; + } + + u8 getOnSwBit() { + return home.angle.x & 0xFF; + } + + u8 getOffSwBit() { + return (home.angle.x & 0xFF00) >> 8; + } +}; #endif /* D_A_TAG_ALLMATO_H */ diff --git a/include/d/actor/d_a_tag_wljump.h b/include/d/actor/d_a_tag_wljump.h index bcdd00520d..d0160bea61 100644 --- a/include/d/actor/d_a_tag_wljump.h +++ b/include/d/actor/d_a_tag_wljump.h @@ -29,8 +29,11 @@ public: /* 0x569 */ s8 field_0x569; /* 0x56A */ u8 field_0x56a; /* 0x56B */ u8 mNextCheckFlg; - /* 0x56C */ u8 field_0x56c[4]; - /* 0x570 */ u8 field_0x570; + /* 0x56C */ u8 field_0x56c; + /* 0x56D */ u8 field_0x56d; + /* 0x56E */ u8 field_0x56e; + /* 0x56F */ u8 field_0x56f; + /* 0x570 */ s8 field_0x570; /* 0x571 */ u8 field_0x571; /* 0x572 */ u8 field_0x572; /* 0x573 */ u8 field_0x573; diff --git a/include/d/d_camera.h b/include/d/d_camera.h index b04436fac4..730f9eea3d 100644 --- a/include/d/d_camera.h +++ b/include/d/d_camera.h @@ -456,6 +456,8 @@ public: void U2(s16 i_val) { field_0x8c = i_val; } + void CorrectCenter() { setFlag(0x40000000); } + static engine_fn engine_tbl[]; /* 0x000 */ camera_class* field_0x0; diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 534ed8ed11..9e391caec2 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -3549,6 +3549,10 @@ inline s16 dComIfGp_evmng_getEventIdx(const char* eventName, u8 mapToolID) { return g_dComIfG_gameInfo.play.getEvtManager().getEventIdx(eventName, mapToolID, -1); } +inline BOOL dComIfGp_evmng_isMapToolCamera(u8 mapToolID) { + return g_dComIfG_gameInfo.play.getEvtManager().isMapToolCamera(mapToolID, -1); +} + inline void dComIfGp_particle_createCommon(const void* data) { g_dComIfG_gameInfo.play.getParticle()->createCommon(data); } diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cmath.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cmath.h index 7d97141670..425777b915 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cmath.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cmath.h @@ -23,6 +23,10 @@ inline float sqrt(float x) { inline float abs(float x) { return ::fabsf(x); } + +inline float fmod(float x, float y) { + return ::fmod(x, y); +} } // namespace std #endif diff --git a/src/SSystem/SComponent/c_bg_s_chk.cpp b/src/SSystem/SComponent/c_bg_s_chk.cpp index 1a301597a1..5ad8e264b6 100644 --- a/src/SSystem/SComponent/c_bg_s_chk.cpp +++ b/src/SSystem/SComponent/c_bg_s_chk.cpp @@ -28,7 +28,9 @@ void cBgS_Chk::SetExtChk(cBgS_Chk& other) { bool cBgS_Chk::ChkSameActorPid(fpc_ProcID pid) const { if (mActorPid == fpcM_ERROR_PROCESS_ID_e || pid == fpcM_ERROR_PROCESS_ID_e || !mSameActorChk) { return FALSE; + } else if (mActorPid == pid) { + return TRUE; } else { - return (mActorPid == pid) ? TRUE : FALSE; + return FALSE; } } diff --git a/src/SSystem/SComponent/c_bg_s_poly_info.cpp b/src/SSystem/SComponent/c_bg_s_poly_info.cpp index e791c24c17..f6f389bb75 100644 --- a/src/SSystem/SComponent/c_bg_s_poly_info.cpp +++ b/src/SSystem/SComponent/c_bg_s_poly_info.cpp @@ -4,6 +4,7 @@ */ #include "SSystem/SComponent/c_bg_s_poly_info.h" +#include "JSystem/JUtility/JUTAssert.h" /* 80268074-802680B0 2629B4 003C+00 0/0 7/7 9/9 .text __ct__13cBgS_PolyInfoFv */ cBgS_PolyInfo::cBgS_PolyInfo() { @@ -33,22 +34,20 @@ void cBgS_PolyInfo::ClearPi() { /* 80268148-8026816C 262A88 0024+00 0/0 11/11 1/1 .text * SetPolyInfo__13cBgS_PolyInfoFRC13cBgS_PolyInfo */ void cBgS_PolyInfo::SetPolyInfo(const cBgS_PolyInfo& poly) { - mPolyIndex = poly.mPolyIndex; - mBgIndex = poly.mBgIndex; - unk_0x04 = poly.unk_0x04; - mActorId = poly.mActorId; + *this = poly; } /* 8026816C-8026817C 262AAC 0010+00 0/0 6/6 0/0 .text SetActorInfo__13cBgS_PolyInfoFiPvUi */ -void cBgS_PolyInfo::SetActorInfo(int bg_index, void* p_data, unsigned int actor_id) { +void cBgS_PolyInfo::SetActorInfo(int bg_index, void* p_data, fpc_ProcID actor_id) { + JUT_ASSERT(74, 0 <= bg_index); mBgIndex = bg_index; unk_0x04 = p_data; mActorId = actor_id; } /* 8026817C-802681A4 262ABC 0028+00 0/0 1/1 0/0 .text ChkSafe__13cBgS_PolyInfoCFPCvUi */ -bool cBgS_PolyInfo::ChkSafe(const void* param_1, unsigned int actor_id) const { +bool cBgS_PolyInfo::ChkSafe(const void* param_1, fpc_ProcID actor_id) const { if (unk_0x04 == param_1 && mActorId == actor_id) { return true; } else { @@ -59,10 +58,15 @@ bool cBgS_PolyInfo::ChkSafe(const void* param_1, unsigned int actor_id) const { /* 802681A4-802681AC 262AE4 0008+00 0/0 11/11 0/0 .text SetPolyIndex__13cBgS_PolyInfoFi */ void cBgS_PolyInfo::SetPolyIndex(int poly_index) { + JUT_ASSERT(103, 0 <= poly_index); mPolyIndex = poly_index; } /* 802681AC-802681C0 262AEC 0014+00 0/0 3/3 0/0 .text ChkBgIndex__13cBgS_PolyInfoCFv */ bool cBgS_PolyInfo::ChkBgIndex() const { - return mBgIndex != 0x100; -} \ No newline at end of file + if (mBgIndex == 0x100) { + return false; + } + + return true; +} diff --git a/src/SSystem/SComponent/c_bg_w.cpp b/src/SSystem/SComponent/c_bg_w.cpp index ea99569437..fb680d5326 100644 --- a/src/SSystem/SComponent/c_bg_w.cpp +++ b/src/SSystem/SComponent/c_bg_w.cpp @@ -17,17 +17,29 @@ void cBgW_BgId::Release() { /* 802681D4-802681E4 262B14 0010+00 0/0 7/7 121/121 .text ChkUsed__9cBgW_BgIdCFv */ bool cBgW_BgId::ChkUsed() const { - return m_id < 0x100; + if (m_id < 0x100) { + return true; + } + + return false; } /* 802681E4-802681FC 262B24 0018+00 1/1 22/22 8/8 .text cBgW_CheckBGround__Ff */ bool cBgW_CheckBGround(float y) { - return y >= 0.5f; + if (y >= 0.5f) { + return true; + } else { + return false; + } } /* 802681FC-80268210 262B3C 0014+00 1/1 6/6 0/0 .text cBgW_CheckBRoof__Ff */ bool cBgW_CheckBRoof(float y) { - return y < (-4.0f / 5.0f); + if (y < (-4.0f / 5.0f)) { + return true; + } else { + return false; + } } /* 80268210-80268260 262B50 0050+00 0/0 16/16 4/4 .text cBgW_CheckBWall__Ff */ @@ -36,4 +48,4 @@ bool cBgW_CheckBWall(float y) { return true; return false; -} \ No newline at end of file +} diff --git a/src/SSystem/SComponent/c_cc_s.cpp b/src/SSystem/SComponent/c_cc_s.cpp index 6db895bdf8..7fa9b0cbbd 100644 --- a/src/SSystem/SComponent/c_cc_s.cpp +++ b/src/SSystem/SComponent/c_cc_s.cpp @@ -165,7 +165,7 @@ void cCcS::ChkAtTg() { continue; cCcD_ShapeAttr* pat_sa = (*pat_obj)->GetShapeAttr(); - JUT_ASSERT(pat_sa != 0); + JUT_ASSERT(0, pat_sa != 0); for (cCcD_Obj** ptg_obj = mpObjTg; ptg_obj < objTgEnd; ++ptg_obj) { if (*ptg_obj == NULL || !(*ptg_obj)->ChkTgSet()) @@ -176,7 +176,7 @@ void cCcS::ChkAtTg() { continue; cCcD_ShapeAttr* ptg_sa = (*ptg_obj)->GetShapeAttr(); - JUT_ASSERT(ptg_sa != 0); + JUT_ASSERT(0, ptg_sa != 0); static cXyz cross; bool didCross = pat_sa->CrossAtTg(*ptg_sa, &cross); @@ -225,7 +225,7 @@ void cCcS::ChkCo() { continue; cCcD_ShapeAttr* pco1_sa = (*pco1_obj)->GetShapeAttr(); - JUT_ASSERT(pco1_sa != 0); + JUT_ASSERT(0, pco1_sa != 0); for (cCcD_Obj** pco2_obj = pco1_obj + 1; pco2_obj < objCoEnd; ++pco2_obj) { if (*pco2_obj == NULL || !(*pco2_obj)->ChkCoSet()) @@ -236,7 +236,7 @@ void cCcS::ChkCo() { continue; cCcD_ShapeAttr* pco2_sa = (*pco2_obj)->GetShapeAttr(); - JUT_ASSERT(pco2_sa != 0); + JUT_ASSERT(0, pco2_sa != 0); f32 cross_len; if (pco1_sa->CrossCo(*pco2_sa, &cross_len)) { @@ -456,7 +456,7 @@ void cCcS::CalcArea() { for (cCcD_Obj** pset_obj = mpObj; pset_obj < mpObj + mObjCount; ++pset_obj) { if (*pset_obj != NULL) { cCcD_ShapeAttr* pset_sa = (*pset_obj)->GetShapeAttr(); - JUT_ASSERT(pset_sa != 0); + JUT_ASSERT(0, pset_sa != 0); pset_sa->CalcAabBox(); aab.SetMinMax(pset_sa->GetWorkAab()); @@ -467,7 +467,7 @@ void cCcS::CalcArea() { for (cCcD_Obj** pset_obj = mpObj; pset_obj < mpObj + mObjCount; ++pset_obj) { if (*pset_obj != NULL) { const cCcD_ShapeAttr* pset_sa = (*pset_obj)->GetShapeAttr(); - JUT_ASSERT(pset_sa != 0); + JUT_ASSERT(0, pset_sa != 0); cCcD_DivideInfo* divideInfo = &(*pset_obj)->GetDivideInfo(); mDivideArea.CalcDivideInfo(divideInfo, pset_sa->GetWorkAab(), @@ -553,4 +553,4 @@ bool cCcS::ChkNoHitGCo(cCcD_Obj* pco1_obj, cCcD_Obj* pco2_obj) { } /* 80265E18-80265E1C 260758 0004+00 1/0 0/0 0/0 .text MoveAfterCheck__4cCcSFv */ -void cCcS::MoveAfterCheck() {} \ No newline at end of file +void cCcS::MoveAfterCheck() {} diff --git a/src/SSystem/SComponent/c_lib.cpp b/src/SSystem/SComponent/c_lib.cpp index 62c86b920b..16fd52e15d 100644 --- a/src/SSystem/SComponent/c_lib.cpp +++ b/src/SSystem/SComponent/c_lib.cpp @@ -41,8 +41,9 @@ void cLib_memSet(void* ptr, int value, unsigned long num) { * @return The absolute value of remaining distance to target */ f32 cLib_addCalc(f32* pvalue, f32 target, f32 scale, f32 maxStep, f32 minStep) { + f32 step = 0.0f; if (*pvalue != target) { - f32 step = scale * (target - *pvalue); + step = scale * (target - *pvalue); if (step >= minStep || step <= -minStep) { if (step > maxStep) { step = maxStep; @@ -54,15 +55,16 @@ f32 cLib_addCalc(f32* pvalue, f32 target, f32 scale, f32 maxStep, f32 minStep) { } else { if (step > 0) { if (step < minStep) { - *pvalue += minStep; + step = minStep; + *pvalue += step; if (*pvalue > target) { *pvalue = target; } } } else { - minStep = -minStep; - if (step > minStep) { - *pvalue += minStep; + if (step > -minStep) { + step = -minStep; + *pvalue += step; if (*pvalue < target) { *pvalue = target; } diff --git a/src/SSystem/SComponent/c_list.cpp b/src/SSystem/SComponent/c_list.cpp index 10e6144f5f..72cce7dd9a 100644 --- a/src/SSystem/SComponent/c_list.cpp +++ b/src/SSystem/SComponent/c_list.cpp @@ -5,7 +5,7 @@ #include "SSystem/SComponent/c_list.h" #include "SSystem/SComponent/c_node.h" -#include "dolphin/types.h" +#include /* 80265E64-80265E78 0014+00 s=1 e=0 z=0 None .text cLs_Init__FP15node_list_class */ void cLs_Init(node_list_class* list) { @@ -17,15 +17,23 @@ void cLs_Init(node_list_class* list) { /* 80265E78-80265EFC 0084+00 s=1 e=4 z=0 None .text cLs_SingleCut__FP10node_class */ int cLs_SingleCut(node_class* node) { node_list_class* list = (node_list_class*)node->mpData; + if (node == list->mpHead) list->mpHead = node->mpNextNode; if (node == list->mpTail) list->mpTail = node->mpPrevNode; + cNd_SingleCut(node); cNd_ClearObject(node); - int newSize = list->mSize - 1; - list->mSize = newSize; - return newSize > 0; + + int ret; + if (--list->mSize > 0) { + ret = 1; + } else { + ret = 0; + } + + return ret; } /* 80265EFC-80265F70 0074+00 s=1 e=4 z=0 None .text @@ -49,13 +57,13 @@ int cLs_Insert(node_list_class* list, int idx, node_class* node) { node_class* pExisting = cNd_Order(list->mpHead, idx); if (pExisting == NULL) { return cLs_Addition(list, node); - } else { - cNd_SetObject(node, list); - cNd_Insert(pExisting, node); - list->mpHead = cNd_First(node); - list->mSize = cNd_LengthOf(list->mpHead); - return list->mSize; } + + cNd_SetObject(node, list); + cNd_Insert(pExisting, node); + list->mpHead = cNd_First(node); + list->mSize = cNd_LengthOf(list->mpHead); + return list->mSize; } /* 80265FF8-80266040 0048+00 s=0 e=1 z=0 None .text cLs_GetFirst__FP15node_list_class */ @@ -64,12 +72,12 @@ node_class* cLs_GetFirst(node_list_class* list) { node_class* pHead = list->mpHead; cLs_SingleCut(pHead); return pHead; - } else { - return NULL; } + + return NULL; } /* 80266040-80266060 0020+00 s=0 e=4 z=0 None .text cLs_Create__FP15node_list_class */ void cLs_Create(node_list_class* list) { cLs_Init(list); -} \ No newline at end of file +} diff --git a/src/SSystem/SComponent/c_m2d.cpp b/src/SSystem/SComponent/c_m2d.cpp index 618ef3f625..17bd3ae3af 100644 --- a/src/SSystem/SComponent/c_m2d.cpp +++ b/src/SSystem/SComponent/c_m2d.cpp @@ -6,47 +6,78 @@ #include "SSystem/SComponent/c_m2d.h" #include "SSystem/SComponent/c_m3d.h" #include "SSystem/SComponent/c_m3d_g_cir.h" +#include "JSystem/JUtility/JUTAssert.h" /* 80268260-80268560 262BA0 0300+00 0/0 4/4 0/0 .text cM2d_CrossCirLin__FR8cM2dGCirffffPfPf */ void cM2d_CrossCirLin(cM2dGCir& param_0, f32 param_1, f32 param_2, f32 param_3, f32 param_4, f32* param_5, f32* param_6) { + int ans = 0; f32 fVar1 = param_1 - param_0.GetCx(); f32 fVar15 = param_2 - param_0.GetCy(); f32 dVar13 = param_3 * param_3 + param_4 * param_4; f32 dVar14 = 2.0f * ((param_3 * fVar1) + (param_4 * fVar15)); - f32 fVar3 = (fVar1 * fVar1 + fVar15 * fVar15) - (param_0.GetR() * param_0.GetR()); - f32 in_f31; + + f32 c = (fVar1 * fVar1 + fVar15 * fVar15) - (param_0.GetR() * param_0.GetR()); + JUT_ASSERT(71, c < 0.0f); + + f32 t; if (cM3d_IsZero(dVar13)) { - if (!cM3d_IsZero(dVar14)) { - in_f31 = -fVar3 / dVar14; + if (cM3d_IsZero(dVar14)) { + ans = 0; + } else { + ans = 1; + t = -c / dVar14; } } else { - f32 dVar10 = ((dVar14 * dVar14) - (4.0f * dVar13) * fVar3); + f32 dVar10 = ((dVar14 * dVar14) - (4.0f * dVar13) * c); if (cM3d_IsZero(dVar10)) { - in_f31 = (-dVar14 / (2.0f * dVar13)); + ans = 1; + t = (-dVar14 / (2.0f * dVar13)); } else { if (dVar10 < 0.0f) { + ans = 0; } else { + ans = 2; + f32 fVar2 = 1.0f / (2.0f * dVar13); - f32 fVar15 = sqrtf(dVar10); - fVar15 = fVar2 * (-dVar14 + fVar15); - f32 fVar16 = sqrtf(dVar10); - f32 fVar4 = fVar2 * (-dVar14 - fVar16); + f32 fVar15 = fVar2 * (-dVar14 + sqrtf(dVar10)); + f32 fVar4 = fVar2 * (-dVar14 - sqrtf(dVar10)); if (fVar15 > fVar4) { - in_f31 = fVar15; + t = fVar15; } else { - in_f31 = fVar4; + t = fVar4; } } } } - if (cM3d_IsZero(in_f31)) { + if (cM3d_IsZero(t)) { *param_5 = param_1; *param_6 = param_2; } else { - *param_5 = param_1 + (in_f31 * param_3); - *param_6 = param_2 + (in_f31 * param_4); + if (ans == 0 || t < 0.0f) { + OS_REPORT("\x1b[41;37m"); + + if (ans == 0) { + OS_REPORT("ans == 0\n"); + } + + if (t < 0.0f) { + OS_REPORT("t %f < 0.0f\n", t); + } + + OS_REPORT("c.x %f c.y %f\n", param_0.GetCx(), param_0.GetCy()); + OS_REPORT("r %f\n", param_0.GetR()); + OS_REPORT("px %f py %f\n", param_1, param_2); + OS_REPORT("vx %f vy %f\n", param_3, param_4); + OS_REPORT("\x1b[m"); + } + + JUT_ASSERT(135, ans != 0); + JUT_ASSERT(137, t >= 0.0f); + + *param_5 = param_1 + (t * param_3); + *param_6 = param_2 + (t * param_4); } -} \ No newline at end of file +} diff --git a/src/SSystem/SComponent/c_m3d.cpp b/src/SSystem/SComponent/c_m3d.cpp index 1e048cc834..17221cfb81 100644 --- a/src/SSystem/SComponent/c_m3d.cpp +++ b/src/SSystem/SComponent/c_m3d.cpp @@ -1347,11 +1347,6 @@ void cM3d_CalcSphVsTriCrossPoint(const cM3dGSph* pSphere, const cM3dGTri* pTrian } } -inline bool cM3d_Cross_LinSph(cM3dGLin const* line, cM3dGSph const* sph) { - Vec vec; - return cM3d_Cross_LinSph(line, sph, &vec); -} - /* 8026BF04-8026C22C 266844 0328+00 1/1 4/4 0/0 .text * cM3d_Cross_SphTri__FPC8cM3dGSphPC8cM3dGTriP3Vec */ bool cM3d_Cross_SphTri(cM3dGSph const* sph, cM3dGTri const* tri, Vec* param_2) { diff --git a/src/SSystem/SComponent/c_m3d_g_aab.cpp b/src/SSystem/SComponent/c_m3d_g_aab.cpp index 4eb4dd1781..f3fb27c3b9 100644 --- a/src/SSystem/SComponent/c_m3d_g_aab.cpp +++ b/src/SSystem/SComponent/c_m3d_g_aab.cpp @@ -22,22 +22,26 @@ bool cM3dGAab::CrossY(const cXyz* other) const { /* 8026ECD0-8026ECE4 0014+00 s=0 e=6 z=0 None .text UnderPlaneYUnder__8cM3dGAabCFf */ bool cM3dGAab::UnderPlaneYUnder(f32 y) const { - return mMin.y < y; + if (mMin.y < y) { + return true; + } + + return false; } /* 8026ECE4-8026ECF8 0014+00 s=0 e=6 z=0 None .text TopPlaneYUnder__8cM3dGAabCFf */ bool cM3dGAab::TopPlaneYUnder(f32 y) const { - return mMax.y < y; + if (mMax.y < y) { + return true; + } + + return false; } /* 8026ECF8-8026ED1C 0024+00 s=0 e=6 z=0 None .text ClearForMinMax__8cM3dGAabFv */ void cM3dGAab::ClearForMinMax() { - mMin.z = 1000000000.0f; - mMin.y = 1000000000.0f; - mMin.x = 1000000000.0f; - mMax.z = -1000000000.0f; - mMax.y = -1000000000.0f; - mMax.x = -1000000000.0f; + mMin.x = mMin.y = mMin.z = 1000000000.0f; + mMax.x = mMax.y = mMax.z = -1000000000.0f; } /* 8026ED1C-8026ED60 0044+00 s=1 e=3 z=0 None .text SetMinMax__8cM3dGAabFRC4cXyz */ @@ -54,21 +58,43 @@ void cM3dGAab::SetMinMax(const cM3dGAab& other) { /* 8026EDA4-8026EDE4 0040+00 s=1 e=1 z=0 None .text SetMin__8cM3dGAabFRC4cXyz */ void cM3dGAab::SetMin(const cXyz& min) { - mMin.setMin(min); + if (mMin.x > min.x) { + mMin.x = min.x; + } + if (mMin.y > min.y) { + mMin.y = min.y; + } + if (mMin.z > min.z) { + mMin.z = min.z; + } } /* 8026EDE4-8026EE24 0040+00 s=1 e=1 z=0 None .text SetMax__8cM3dGAabFRC4cXyz */ void cM3dGAab::SetMax(const cXyz& max) { - mMax.setMax(max); + if (mMax.x < max.x) { + mMax.x = max.x; + } + if (mMax.y < max.y) { + mMax.y = max.y; + } + if (mMax.z < max.z) { + mMax.z = max.z; + } } + /* 8026EE24-8026EE68 0044+00 s=0 e=1 z=0 None .text CalcCenter__8cM3dGAabCFP4cXyz */ void cM3dGAab::CalcCenter(cXyz* out) const { - VECAdd(&mMin, &mMax, out); - VECScale(out, out, 0.5f); + PSVECAdd(&mMin, &mMax, out); + PSVECScale(out, out, 0.5f); } /* 8026EE68-8026EEB4 004C+00 s=0 e=1 z=0 None .text PlusR__8cM3dGAabFf */ void cM3dGAab::PlusR(f32 r) { - mMin -= r; - mMax += r; -} \ No newline at end of file + mMin.x -= r; + mMin.y -= r; + mMin.z -= r; + + mMax.x += r; + mMax.y += r; + mMax.z += r; +} diff --git a/src/SSystem/SComponent/c_m3d_g_cir.cpp b/src/SSystem/SComponent/c_m3d_g_cir.cpp index cc7cd8a3d1..9d102d11ae 100644 --- a/src/SSystem/SComponent/c_m3d_g_cir.cpp +++ b/src/SSystem/SComponent/c_m3d_g_cir.cpp @@ -12,9 +12,7 @@ cM3dGCir::cM3dGCir() {} cM3dGCir::~cM3dGCir() {} /* 8026EF74-8026EF88 0014+00 s=0 e=1 z=0 None .text Set__8cM3dGCirFffff */ -void cM3dGCir::Set(f32 pos_x, f32 pos_y, f32 posz, f32 radius) { - mPosX = pos_x; - mPosY = pos_y; - mRadius = radius; - mPosZ = posz; -} \ No newline at end of file +void cM3dGCir::Set(f32 pos_x, f32 pos_y, f32 pos_z, f32 radius) { + cM2dGCir::Set(pos_x, pos_y, radius); + mPosZ = pos_z; +} diff --git a/src/SSystem/SComponent/c_m3d_g_cps.cpp b/src/SSystem/SComponent/c_m3d_g_cps.cpp index dfc66baefb..835251483d 100644 --- a/src/SSystem/SComponent/c_m3d_g_cps.cpp +++ b/src/SSystem/SComponent/c_m3d_g_cps.cpp @@ -14,16 +14,16 @@ cM3dGCps::~cM3dGCps() {} /* 8026F000-8026F03C 269940 003C+00 1/1 2/2 10/10 .text Set__8cM3dGCpsFRC4cXyzRC4cXyzf */ void cM3dGCps::Set(const cXyz& start, const cXyz& end, f32 radius) { SetStartEnd(start, end); - mRadius = radius; + SetR(radius); } /* 8026F03C-8026F080 26997C 0044+00 0/0 1/1 10/10 .text Set__8cM3dGCpsFRC9cM3dGCpsS */ void cM3dGCps::Set(const cM3dGCpsS& other) { SetStartEnd(other.mStart, other.mEnd); - mRadius = other.mRadius; + SetR(other.mRadius); } /* 8026F080-8026F0A8 2699C0 0028+00 0/0 1/1 0/0 .text SetCps__8cM3dGCpsFRC8cM3dGCps */ void cM3dGCps::SetCps(const cM3dGCps& other) { - Set(other.GetStartP(), other.GetEndP(), other.mRadius); -} \ No newline at end of file + Set(other.GetStart(), other.GetEnd(), other.GetR()); +} diff --git a/src/SSystem/SComponent/c_m3d_g_lin.cpp b/src/SSystem/SComponent/c_m3d_g_lin.cpp index 8f59724098..a9daac2c41 100644 --- a/src/SSystem/SComponent/c_m3d_g_lin.cpp +++ b/src/SSystem/SComponent/c_m3d_g_lin.cpp @@ -6,7 +6,10 @@ #include "SSystem/SComponent/c_m3d_g_lin.h" /* 8026F2A8-8026F2E8 0040+00 s=0 e=8 z=1 None .text __ct__8cM3dGLinFRC4cXyzRC4cXyz */ -cM3dGLin::cM3dGLin(const cXyz& start, const cXyz& end) : mStart(start), mEnd(end) {} +cM3dGLin::cM3dGLin(const cXyz& start, const cXyz& end) { + mStart = start; + mEnd = end; +} /* 8026F2E8-8026F31C 0034+00 s=0 e=8 z=10 None .text SetStartEnd__8cM3dGLinFRC4cXyzRC4cXyz */ void cM3dGLin::SetStartEnd(const cXyz& start, const cXyz& end) { @@ -16,19 +19,19 @@ void cM3dGLin::SetStartEnd(const cXyz& start, const cXyz& end) { /* 8026F31C-8026F350 0034+00 s=0 e=7 z=4 None .text SetStartEnd__8cM3dGLinFRC3VecRC3Vec */ void cM3dGLin::SetStartEnd(const Vec& start, const Vec& end) { - mStart = start; - mEnd = end; + mStart.set(start); + mEnd.set(end); } /* 8026F350-8026F3C0 0070+00 s=0 e=3 z=0 None .text CalcPos__8cM3dGLinCFP3Vecf */ void cM3dGLin::CalcPos(Vec* out, f32 scale) const { - Vec tmp; - VECSubtract(&mEnd, &mStart, &tmp); - VECScale(&tmp, &tmp, scale); - VECAdd(&tmp, &mStart, out); + cXyz tmp; + PSVECSubtract(&mEnd, &mStart, &tmp); + PSVECScale(&tmp, &tmp, scale); + PSVECAdd(&tmp, &mStart, out); } /* 8026F3C0-8026F3DC 001C+00 s=0 e=1 z=0 None .text SetEnd__8cM3dGLinFRC4cXyz */ void cM3dGLin::SetEnd(const cXyz& end) { mEnd = end; -} \ No newline at end of file +} diff --git a/src/SSystem/SComponent/c_m3d_g_pla.cpp b/src/SSystem/SComponent/c_m3d_g_pla.cpp index 25f222a5cc..7bfe588c2d 100644 --- a/src/SSystem/SComponent/c_m3d_g_pla.cpp +++ b/src/SSystem/SComponent/c_m3d_g_pla.cpp @@ -7,38 +7,42 @@ #include "SSystem/SComponent/c_m3d.h" /* 8026F3DC-8026F408 269D1C 002C+00 0/0 3/3 0/0 .text __ct__8cM3dGPlaFPC4cXyzf */ -cM3dGPla::cM3dGPla(const cXyz* normal, f32 d) : mNormal(*normal), mD(d) {} +cM3dGPla::cM3dGPla(const cXyz* normal, f32 d) { + mNormal = *normal; + mD = d; +} /* 8026F408-8026F4C4 269D48 00BC+00 0/0 3/3 0/0 .text crossInfLin__8cM3dGPlaCFRC4cXyzRC4cXyzR4cXyz */ bool cM3dGPla::crossInfLin(const cXyz& start, const cXyz& end, cXyz& out) const { - f32 tmp1 = (mD + VECDotProduct(&mNormal, &start)); - f32 tmp2 = tmp1 - (mD + VECDotProduct(&mNormal, &end)); - if (fabsf(tmp2) < G_CM3D_F_ABS_MIN) { + f32 tmp1 = getPlaneFunc(&start); + f32 tmp2 = getPlaneFunc(&end); + if (cM3d_IsZero(tmp1 - tmp2)) { out = end; return false; - } else { - cM3d_InDivPos2(&start, &end, (tmp1 / tmp2), &out); - return true; } + + f32 var_f29 = tmp1 / (tmp1 - tmp2); + cM3d_InDivPos2(&start, &end, var_f29, &out); + return true; } /* 8026F4C4-8026F52C 269E04 0068+00 0/0 1/1 0/0 .text SetupNP0__8cM3dGPlaFRC3VecRC3Vec */ void cM3dGPla::SetupNP0(const Vec& normal, const Vec& point) { mNormal = normal; - VECNormalize(&mNormal, &mNormal); - mD = -VECDotProduct(&mNormal, &point); + PSVECNormalize(&mNormal, &mNormal); + mD = -PSVECDotProduct(&mNormal, &point); } /* 8026F52C-8026F57C 269E6C 0050+00 0/0 2/2 0/0 .text SetupNP__8cM3dGPlaFRC3VecRC3Vec */ void cM3dGPla::SetupNP(const Vec& normal, const Vec& point) { mNormal = normal; - mD = -VECDotProduct(&mNormal, &point); + mD = -PSVECDotProduct(&mNormal, &point); } /* 8026F57C-8026F5D4 269EBC 0058+00 0/0 2/2 0/0 .text getCrossY__8cM3dGPlaCFRC4cXyzPf */ bool cM3dGPla::getCrossY(const cXyz& point, f32* out) const { - if (fabsf(mNormal.y) < G_CM3D_F_ABS_MIN) { + if (cM3d_IsZero(mNormal.y)) { return false; } else { *out = (-mNormal.x * point.x - mNormal.z * point.z - mD) / mNormal.y; @@ -49,7 +53,7 @@ bool cM3dGPla::getCrossY(const cXyz& point, f32* out) const { /* 8026F5D4-8026F624 269F14 0050+00 0/0 1/1 0/0 .text getCrossYLessD__8cM3dGPlaCFRC3VecPf */ bool cM3dGPla::getCrossYLessD(const Vec& point, f32* out) const { - if (fabsf(mNormal.y) < G_CM3D_F_ABS_MIN) { + if (cM3d_IsZero(mNormal.y)) { return false; } else { *out = (-mNormal.x * point.x - mNormal.z * point.z) / mNormal.y; @@ -59,5 +63,6 @@ bool cM3dGPla::getCrossYLessD(const Vec& point, f32* out) const { /* 8026F624-8026F648 269F64 0024+00 0/0 1/1 0/0 .text Set__8cM3dGPlaFPC8cM3dGPla */ void cM3dGPla::Set(const cM3dGPla* other) { - *this = *other; -} \ No newline at end of file + mNormal = *other->GetNP(); + mD = other->GetD(); +} diff --git a/src/SSystem/SComponent/c_m3d_g_sph.cpp b/src/SSystem/SComponent/c_m3d_g_sph.cpp index 32ea4e4da8..ed91e0ea94 100644 --- a/src/SSystem/SComponent/c_m3d_g_sph.cpp +++ b/src/SSystem/SComponent/c_m3d_g_sph.cpp @@ -37,8 +37,7 @@ bool cM3dGSph::cross(const cM3dGSph* other, cXyz* out) const { /* 8026F73C-8026F76C 26A07C 0030+00 0/0 1/1 0/0 .text cross__8cM3dGSphCFPC8cM3dGCylP4cXyz */ bool cM3dGSph::cross(const cM3dGCyl* cyl, cXyz* out) const { - f32 f; - return cM3d_Cross_CylSph(cyl, this, out, &f); + return cM3d_Cross_CylSph(cyl, this, out); } /* 8026F76C-8026F7B0 26A0AC 0044+00 0/0 1/1 0/0 .text GetMinMaxCube__8cM3dGSphCFR4cXyzR4cXyz */ @@ -49,4 +48,4 @@ void cM3dGSph::GetMinMaxCube(cXyz& min, cXyz& max) const { max.x = mCenter.x + mRadius; max.y = mCenter.y + mRadius; max.z = mCenter.z + mRadius; -} \ No newline at end of file +} diff --git a/src/SSystem/SComponent/c_m3d_g_tri.cpp b/src/SSystem/SComponent/c_m3d_g_tri.cpp index 95a32858af..00e0c0e7cb 100644 --- a/src/SSystem/SComponent/c_m3d_g_tri.cpp +++ b/src/SSystem/SComponent/c_m3d_g_tri.cpp @@ -5,6 +5,7 @@ #include "SSystem/SComponent/c_m3d_g_tri.h" #include "SSystem/SComponent/c_m3d.h" +#include "JSystem/JUtility/JUTAssert.h" /* 8026F7B0-8026F7DC 26A0F0 002C+00 0/0 1/1 0/0 .text cross__8cM3dGTriCFPC8cM3dGCylP3Vec */ @@ -17,22 +18,42 @@ void cM3dGTri::setPos(const Vec* vtx_a, const Vec* vtx_b, const Vec* vtx_c) { mA = *vtx_a; mB = *vtx_b; mC = *vtx_c; - cM3d_CalcPla(&mA, &mB, &mC, &mNormal, &mD); + setUp(); + + JUT_ASSERT(99, !cM3d_IsZero(GetNP()->x) || !cM3d_IsZero(GetNP()->y) || !cM3d_IsZero(GetNP()->z)); } /* 8026F85C-8026F8C8 26A19C 006C+00 0/0 2/2 0/0 .text * setBg__8cM3dGTriFPC3VecPC3VecPC3VecPC8cM3dGPla */ void cM3dGTri::setBg(const Vec* vtx_a, const Vec* vtx_b, const Vec* vtx_c, const cM3dGPla* plane) { - mA = *vtx_a; - mB = *vtx_b; - mC = *vtx_c; + mA.x = vtx_a->x; + mA.y = vtx_a->y; + mA.z = vtx_a->z; + + mB.x = vtx_b->x; + mB.y = vtx_b->y; + mB.z = vtx_b->z; + + mC.x = vtx_c->x; + mC.y = vtx_c->y; + mC.z = vtx_c->z; + Set(plane); } /* 8026F8C8-8026F93C 26A208 0074+00 0/0 1/1 0/0 .text set__8cM3dGTriFPC3VecPC3VecPC3VecPC3Vec */ void cM3dGTri::set(const Vec* vtx_a, const Vec* vtx_b, const Vec* vtx_c, const Vec* normal) { - mA = *vtx_a; - mB = *vtx_b; - mC = *vtx_c; + mA.x = vtx_a->x; + mA.y = vtx_a->y; + mA.z = vtx_a->z; + + mB.x = vtx_b->x; + mB.y = vtx_b->y; + mB.z = vtx_b->z; + + mC.x = vtx_c->x; + mC.y = vtx_c->y; + mC.z = vtx_c->z; + SetupNP(*normal, *vtx_a); -} \ No newline at end of file +} diff --git a/src/SSystem/SComponent/c_m3d_g_vtx.cpp b/src/SSystem/SComponent/c_m3d_g_vtx.cpp new file mode 100644 index 0000000000..59cd737ea8 --- /dev/null +++ b/src/SSystem/SComponent/c_m3d_g_vtx.cpp @@ -0,0 +1,8 @@ +/** + * c_m3d_g_vtx.cpp + * + */ + +#include "SSystem/SComponent/c_m3d_g_vtx.h" + +cM3dGVtx::~cM3dGVtx() {} diff --git a/src/SSystem/SComponent/c_malloc.cpp b/src/SSystem/SComponent/c_malloc.cpp index 1961932935..cedf67fbe2 100644 --- a/src/SSystem/SComponent/c_malloc.cpp +++ b/src/SSystem/SComponent/c_malloc.cpp @@ -6,7 +6,6 @@ #include "SSystem/SComponent/c_malloc.h" #include "JSystem/JKernel/JKRHeap.h" -/* ############################################################################################## */ /* 80451150-80451158 0004+04 s=3 e=0 z=0 None .sbss Heap__3cMl */ JKRHeap* cMl::Heap; @@ -16,12 +15,15 @@ void cMl::init(JKRHeap* heap) { } /* 80263228-80263260 0038+00 s=0 e=8 z=0 None .text memalignB__3cMlFiUl */ -void* cMl::memalignB(int alignment, unsigned long size) { +void* cMl::memalignB(int alignment, u32 size) { + void* ret; if (size == 0) { - return NULL; + ret = NULL; } else { - return Heap->alloc(size, alignment); + ret = Heap->alloc(size, alignment); } + + return ret; } /* 80263260-8026328C 002C+00 s=0 e=4 z=0 None .text free__3cMlFPv */ @@ -29,4 +31,4 @@ void cMl::free(void* ptr) { if (ptr != NULL) { Heap->free(ptr); } -} \ No newline at end of file +} diff --git a/src/SSystem/SComponent/c_math.cpp b/src/SSystem/SComponent/c_math.cpp index a31818e983..983b47d705 100644 --- a/src/SSystem/SComponent/c_math.cpp +++ b/src/SSystem/SComponent/c_math.cpp @@ -5,12 +5,11 @@ #include "SSystem/SComponent/c_math.h" #include "SSystem/SComponent/c_m3d.h" +#include /* 802675E4-80267640 261F24 005C+00 0/0 23/23 11/11 .text cM_rad2s__Ff */ -s16 cM_rad2s(float rad) { - f32 rad_mod = fmod(rad, 2 * M_PI); - - s32 s = (rad_mod * (0x8000 / M_PI)); +s16 cM_rad2s(f32 rad) { + s32 s = (std::fmod(rad, 2 * M_PI) * (0x8000 / M_PI)); if (s < -0x8000) { s += 0x10000; } else if (s > 0x7FFF) { @@ -19,7 +18,6 @@ s16 cM_rad2s(float rad) { return s; } -/* ############################################################################################## */ /* 803C3778-803C3F80 020898 0802+06 1/1 0/0 0/0 .data atntable */ static u16 atntable[1025] = { 0x0000, 0x000A, 0x0014, 0x001F, 0x0029, 0x0033, 0x003D, 0x0047, 0x0051, 0x005C, 0x0066, 0x0070, @@ -111,20 +109,21 @@ static u16 atntable[1025] = { }; /* 80267640-80267674 261F80 0034+00 1/1 0/0 0/0 .text U_GetAtanTable__Fff */ -u16 U_GetAtanTable(float f0, float f1) { - return atntable[(int)(f0 / f1 * 0x400)]; +u16 U_GetAtanTable(f32 f0, f32 f1) { + int idx = f0 / f1 * 0x400; + return atntable[idx]; } /* 80267674-80267814 261FB4 01A0+00 1/1 82/82 822/822 .text cM_atan2s__Fff */ -s16 cM_atan2s(float y, float x) { +s16 cM_atan2s(f32 y, f32 x) { u32 ret; - if (fabsf(y) < G_CM3D_F_ABS_MIN) { + if (cM3d_IsZero(y)) { if (x >= 0.0f) { ret = 0; } else { ret = 0x8000; } - } else if (fabsf(x) < G_CM3D_F_ABS_MIN) { + } else if (cM3d_IsZero(x)) { if (y >= 0.0f) { ret = 0x4000; } else { @@ -145,7 +144,7 @@ s16 cM_atan2s(float y, float x) { } } } else if (x < 0.0f) { - if (x <= y) { + if (-x >= -y) { ret = U_GetAtanTable(-y, -x) + 0x8000; } else { ret = 0xC000 - U_GetAtanTable(-x, -y); @@ -161,11 +160,12 @@ s16 cM_atan2s(float y, float x) { } /* 80267814-8026785C 262154 0048+00 0/0 4/4 5/5 .text cM_atan2f__Fff */ -float cM_atan2f(float y, float x) { - return ((2 * M_PI) / 0x10000) * cM_atan2s(y, x); +f32 cM_atan2f(f32 y, f32 x) { + f32 atanS = cM_atan2s(y, x); + f32 ret = ((2 * M_PI) / 0x10000) * atanS; + return ret; } -/* ############################################################################################## */ /* 80451168-8045116C 000668 0004+00 2/2 0/0 0/0 .sbss r0 */ static s32 r0; @@ -187,11 +187,13 @@ void cM_initRnd(int s0, int s1, int s2) { * Gets a random value * @return a random value */ -float cM_rnd() { +f32 cM_rnd() { r0 = (r0 * 171) % 30269; r1 = (r1 * 172) % 30307; r2 = (r2 * 170) % 30323; - return fabsf(fmod(r0 / 30269.0f + r1 / 30307.0f + r2 / 30323.0f, 1.0)); + + f32 var_f31 = r0 / 30269.0f + r1 / 30307.0f + r2 / 30323.0f; + return fabsf(fmodf(var_f31, 1.0)); } /* 80267954-8026798C 262294 0038+00 0/0 34/34 951/951 .text cM_rndF__Ff */ @@ -200,7 +202,7 @@ float cM_rnd() { * @param max The upper bound the random value can be * @return a random value between 0 and `max` */ -float cM_rndF(float max) { +f32 cM_rndF(f32 max) { return cM_rnd() * max; } @@ -210,7 +212,7 @@ float cM_rndF(float max) { * @param max The upper and lower bound the random value can be * @return a random value between -`max` and +`max` */ -float cM_rndFX(float max) { +f32 cM_rndFX(f32 max) { return max * (cM_rnd() - 0.5f) * 2.0f; } @@ -232,19 +234,21 @@ void cM_initRnd2(int s0, int s1, int s2) { } /* 802679E4-80267ACC 262324 00E8+00 2/2 0/0 0/0 .text cM_rnd2__Fv */ -float cM_rnd2() { +f32 cM_rnd2() { r02 = (r02 * 171) % 30269; r12 = (r12 * 172) % 30307; r22 = (r22 * 170) % 30323; - return fabsf(fmod(r02 / 30269.0f + r12 / 30307.0f + r22 / 30323.0f, 1.0)); + + f32 var_f31 = r02 / 30269.0f + r12 / 30307.0f + r22 / 30323.0f; + return fabsf(fmodf(var_f31, 1.0)); } /* 80267ACC-80267B04 26240C 0038+00 0/0 0/0 14/14 .text cM_rndF2__Ff */ -float cM_rndF2(float max) { +f32 cM_rndF2(f32 max) { return cM_rnd2() * max; } /* 80267B04-80267B4C 262444 0048+00 0/0 0/0 7/7 .text cM_rndFX2__Ff */ -float cM_rndFX2(float max) { +f32 cM_rndFX2(f32 max) { return max * (cM_rnd2() - 0.5f) * 2.0f; -} \ No newline at end of file +} diff --git a/src/SSystem/SComponent/c_node.cpp b/src/SSystem/SComponent/c_node.cpp index da50d9efb2..a8b26b4c24 100644 --- a/src/SSystem/SComponent/c_node.cpp +++ b/src/SSystem/SComponent/c_node.cpp @@ -4,7 +4,7 @@ */ #include "SSystem/SComponent/c_node.h" -#include "dolphin/types.h" +#include /* 802660D0-802660DC 000C+00 s=1 e=0 z=0 None .text cNd_Join__FP10node_classP10node_class */ void cNd_Join(node_class* node_a, node_class* node_b) { @@ -51,9 +51,8 @@ node_class* cNd_Order(node_class* node, int idx) { i++; node = NODE_GET_NEXT(node); } - if (i < idx) - return ret; - return NULL; + + return i < idx ? ret : NULL; } /* 802661BC-802661F0 0034+00 s=0 e=1 z=0 None .text cNd_SingleCut__FP10node_class */ @@ -85,10 +84,10 @@ void cNd_Addition(node_class* node_a, node_class* node_b) { /* 80266244-802662B0 006C+00 s=0 e=1 z=0 None .text cNd_Insert__FP10node_classP10node_class */ void cNd_Insert(node_class* node_a, node_class* node_b) { - node_class* prev = node_a->mpPrevNode; - if (prev == NULL) { + if (node_a->mpPrevNode == NULL) { cNd_Addition(node_b, node_a); } else { + node_class* prev = node_a->mpPrevNode; cNd_Cut(node_a); cNd_Addition(prev, node_b); cNd_Addition(node_b, node_a); @@ -120,4 +119,4 @@ void cNd_Create(node_class* node, void* data) { node->mpPrevNode = NULL; node->mpNextNode = NULL; node->mpData = data; -} \ No newline at end of file +} diff --git a/src/SSystem/SComponent/c_node_iter.cpp b/src/SSystem/SComponent/c_node_iter.cpp index 5b48a83acd..82f3263ace 100644 --- a/src/SSystem/SComponent/c_node_iter.cpp +++ b/src/SSystem/SComponent/c_node_iter.cpp @@ -5,7 +5,7 @@ #include "SSystem/SComponent/c_node_iter.h" #include "SSystem/SComponent/c_node.h" -#include "dolphin/types.h" +#include /* 80266324-802663B4 0090+00 s=0 e=1 z=0 None .text * cNdIt_Method__FP10node_classPFP10node_classPv_iPv */ @@ -14,8 +14,7 @@ int cNdIt_Method(node_class* node, cNdIt_MethodFunc method, void* data) { node_class* pNext = NODE_GET_NEXT(node); while (node) { - int methodRet = method(node, data); - if (!methodRet) + if (!method(node, data)) ret = 0; node = pNext; pNext = NODE_GET_NEXT(pNext); @@ -38,4 +37,4 @@ void* cNdIt_Judge(node_class* node, cNdIt_JudgeFunc judge, void* data) { } return NULL; -} \ No newline at end of file +} diff --git a/src/SSystem/SComponent/c_phase.cpp b/src/SSystem/SComponent/c_phase.cpp index f0d0cf94fb..594e18efd9 100644 --- a/src/SSystem/SComponent/c_phase.cpp +++ b/src/SSystem/SComponent/c_phase.cpp @@ -35,13 +35,14 @@ int cPhs_Compleate(request_of_phase_process_class* phase) { /* 80266678-802666D8 0060+00 s=1 e=0 z=0 None .text cPhs_Next__FP30request_of_phase_process_class */ int cPhs_Next(request_of_phase_process_class* phase) { - if (const cPhs__Handler* handlerTable = phase->mpHandlerTable) { + if (phase->mpHandlerTable != NULL) { + cPhs__Handler* handler = phase->mpHandlerTable; phase->id++; - cPhs__Handler handler = handlerTable[phase->id]; + handler += phase->id; // Double null check here actually matters for emitted assembly. // Wee old compilers. - if (handler == NULL || handler == NULL) { + if (*handler == NULL || *handler == NULL) { return cPhs_Compleate(phase); } else { return cPhs_LOADING_e; @@ -64,7 +65,11 @@ int cPhs_Do(request_of_phase_process_class* phase, void* data) { case cPhs_LOADING_e: return cPhs_Next(phase); case cPhs_NEXT_e: - return cPhs_Next(phase) == cPhs_LOADING_e ? cPhs_NEXT_e : cPhs_COMPLEATE_e; + if (cPhs_Next(phase) == cPhs_LOADING_e) { + return cPhs_NEXT_e; + } else { + return cPhs_COMPLEATE_e; + } case cPhs_COMPLEATE_e: return cPhs_Compleate(phase); case cPhs_UNK3_e: @@ -87,4 +92,4 @@ int cPhs_Do(request_of_phase_process_class* phase, void* data) { int cPhs_Handler(request_of_phase_process_class* phase, cPhs__Handler* handlerTbl, void* data) { phase->mpHandlerTable = handlerTbl; return cPhs_Do(phase, data); -} \ No newline at end of file +} diff --git a/src/SSystem/SComponent/c_tag.cpp b/src/SSystem/SComponent/c_tag.cpp index ab27e759bf..d18004f927 100644 --- a/src/SSystem/SComponent/c_tag.cpp +++ b/src/SSystem/SComponent/c_tag.cpp @@ -57,10 +57,10 @@ node_class* cTg_GetFirst(node_list_class* list) { create_tag_class* tag = (create_tag_class*)cLs_GetFirst(list); if (tag != NULL) { tag->mbIsUse = false; - } else { - tag = NULL; + return &tag->mpNode; } - return &tag->mpNode; + + return NULL; } /* 802669A4-802669E4 0040+00 s=0 e=7 z=0 None .text cTg_SingleCut__FP16create_tag_class */ @@ -93,4 +93,4 @@ void cTg_Create(create_tag_class* tag, void* data) { cNd_Create(&tag->mpNode, NULL); tag->mpTagData = data; tag->mbIsUse = false; -} \ No newline at end of file +} diff --git a/src/SSystem/SComponent/c_tree_iter.cpp b/src/SSystem/SComponent/c_tree_iter.cpp index e3f5186bed..3e43e40961 100644 --- a/src/SSystem/SComponent/c_tree_iter.cpp +++ b/src/SSystem/SComponent/c_tree_iter.cpp @@ -7,7 +7,7 @@ #include "SSystem/SComponent/c_list.h" #include "SSystem/SComponent/c_list_iter.h" #include "SSystem/SComponent/c_tree.h" -#include "dolphin/types.h" +#include /* 80266540-802665B4 0074+00 s=0 e=2 z=0 None .text * cTrIt_Method__FP21node_lists_tree_classPFP10node_classPv_iPv */ @@ -16,8 +16,7 @@ int cTrIt_Method(node_lists_tree_class* tree, cNdIt_MethodFunc method, void* dat int i = tree->mNumLists; int ret = 1; while (i-- > 0) { - int sub = cLsIt_Method(list++, method, data); - if (sub == 0) + if (cLsIt_Method(list++, method, data) == 0) ret = 0; } return ret; @@ -28,10 +27,13 @@ int cTrIt_Method(node_lists_tree_class* tree, cNdIt_MethodFunc method, void* dat void* cTrIt_Judge(node_lists_tree_class* tree, cNdIt_JudgeFunc judge, void* data) { node_list_class* list = tree->mpLists; int i = tree->mNumLists; + void* pJudgeRet; + while (i-- > 0) { - void* pJudgeRet = cLsIt_Judge(list++, judge, data); + pJudgeRet = cLsIt_Judge(list++, judge, data); if (pJudgeRet != NULL) return pJudgeRet; } + return NULL; -} \ No newline at end of file +} diff --git a/src/SSystem/SComponent/c_xyz.cpp b/src/SSystem/SComponent/c_xyz.cpp index 3402404352..4ffddf1de7 100644 --- a/src/SSystem/SComponent/c_xyz.cpp +++ b/src/SSystem/SComponent/c_xyz.cpp @@ -5,26 +5,27 @@ #include "SSystem/SComponent/c_xyz.h" #include "SSystem/SComponent/c_math.h" +#include "JSystem/JUtility/JUTAssert.h" /* 80266AE4-80266B34 0050+00 s=0 e=103 z=300 None .text __pl__4cXyzCFRC3Vec */ cXyz cXyz::operator+(const Vec& vec) const { Vec ret; - VECAdd(this, &vec, &ret); - return cXyz(ret); + PSVECAdd(this, &vec, &ret); + return ret; } /* 80266B34-80266B84 0050+00 s=0 e=196 z=1082 None .text __mi__4cXyzCFRC3Vec */ cXyz cXyz::operator-(const Vec& vec) const { Vec ret; - VECSubtract(this, &vec, &ret); - return cXyz(ret); + PSVECSubtract(this, &vec, &ret); + return ret; } /* 80266B84-80266BD0 004C+00 s=1 e=99 z=158 None .text __ml__4cXyzCFf */ cXyz cXyz::operator*(f32 scale) const { Vec ret; - VECScale(this, &ret, scale); - return cXyz(ret); + PSVECScale(this, &ret, scale); + return ret; } /* 80266BD0-80266C18 0048+00 s=0 e=7 z=0 None .text __ml__4cXyzCFRC3Vec */ @@ -33,21 +34,21 @@ cXyz cXyz::operator*(const Vec& vec) const { ret.x = this->x * vec.x; ret.y = this->y * vec.y; ret.z = this->z * vec.z; - return cXyz(ret); + return ret; } /* 80266C18-80266C6C 0054+00 s=0 e=3 z=12 None .text __dv__4cXyzCFf */ cXyz cXyz::operator/(f32 scale) const { Vec ret; - VECScale(this, &ret, 1.0f / scale); - return cXyz(ret); + PSVECScale(this, &ret, 1.0f / scale); + return ret; } /* 80266C6C-80266CBC 0050+00 s=1 e=0 z=0 None .text getCrossProduct__4cXyzCFRC3Vec */ cXyz cXyz::getCrossProduct(const Vec& vec) const { Vec ret; - VECCrossProduct(this, &vec, &ret); - return cXyz(ret); + PSVECCrossProduct(this, &vec, &ret); + return ret; } /* 80266CBC-80266CE4 0028+00 s=0 e=7 z=6 None .text outprod__4cXyzCFRC3Vec */ @@ -58,54 +59,52 @@ cXyz cXyz::outprod(const Vec& vec) const { /* 80266CE4-80266D30 004C+00 s=0 e=10 z=1 None .text norm__4cXyzCFv */ cXyz cXyz::norm() const { Vec ret; - VECNormalize(this, &ret); - return cXyz(ret); + JUT_CONFIRM(251, isNearZeroSquare() == 0); + PSVECNormalize(this, &ret); + return ret; } /* 80266D30-80266DC4 0094+00 s=1 e=4 z=0 None .text normZP__4cXyzCFv */ cXyz cXyz::normZP() const { Vec vec; if (this->isNearZeroSquare() == false) { - VECNormalize(this, &vec); + PSVECNormalize(this, &vec); } else { vec = cXyz::Zero; } - return cXyz(vec); -} - -// doesn't exist in debug rom, but needed to match? -inline void normToUpZIfNearZero(Vec& vec) { - if (cXyz(vec).isNearZeroSquare()) { - vec.x = 0.0f; - vec.y = 0.0f; - vec.z = 1.0f; - const Vec v = {0, 0, 1}; - vec = v; - } + return vec; } /* 80266DC4-80266EF4 0130+00 s=0 e=0 z=2 None .text normZC__4cXyzCFv */ cXyz cXyz::normZC() const { Vec outVec; - if (this->isNearZeroSquare() == false) { - VECNormalize(this, &outVec); + if (isNearZeroSquare() == 0) { + PSVECNormalize(this, &outVec); } else { outVec = (*this * 1.25f * 1000000.0f).normZP(); - normToUpZIfNearZero(outVec); + + if (isNearZeroSquare(outVec)) { + outVec.x = 0.0f; + outVec.y = 0.0f; + outVec.z = 1.0f; + outVec = (Vec){0,0,1}; + } } + return outVec; } /* 80266EF4-80266F48 0054+00 s=0 e=13 z=17 None .text normalize__4cXyzFv */ cXyz cXyz::normalize() { - VECNormalize(this, this); + JUT_ASSERT(285, isNearZeroSquare() == 0); + PSVECNormalize(this, this); return *this; } /* 80266F48-80266FDC 0094+00 s=0 e=19 z=59 None .text normalizeZP__4cXyzFv */ cXyz cXyz::normalizeZP() { if (this->isNearZeroSquare() == false) { - VECNormalize(this, this); + PSVECNormalize(this, this); } else { *this = cXyz::Zero; } @@ -117,7 +116,7 @@ bool cXyz::normalizeRS() { if (this->isNearZeroSquare()) { return false; } else { - VECNormalize(this, this); + PSVECNormalize(this, this); return true; } } @@ -129,7 +128,7 @@ bool cXyz::operator==(const Vec& vec) const { /* 8026706C-802670AC 0040+00 s=0 e=6 z=6 None .text __ne__4cXyzCFRC3Vec */ bool cXyz::operator!=(const Vec& vec) const { - return !(this->x == vec.x && this->y == vec.y && this->z == vec.z); + return this->x != vec.x || this->y != vec.y || this->z != vec.z; } /* 802670AC-80267128 007C+00 s=0 e=4 z=7 None .text isZero__4cXyzCFv */ @@ -145,8 +144,7 @@ s16 cXyz::atan2sX_Z() const { /* 80267150-80267290 0140+00 s=0 e=21 z=33 None .text atan2sY_XZ__4cXyzCFv */ s16 cXyz::atan2sY_XZ() const { - f32 mag = this->getMagXZ(); - return cM_atan2s(-this->y, sqrtf(mag)); + return cM_atan2s(-this->y, absXZ()); } const cXyz cXyz::Zero(0, 0, 0); @@ -156,4 +154,4 @@ const cXyz cXyz::BaseZ(0, 0, 1); const cXyz cXyz::BaseXY(1, 1, 0); const cXyz cXyz::BaseXZ(1, 0, 1); const cXyz cXyz::BaseYZ(0, 1, 1); -const cXyz cXyz::BaseXYZ(1, 1, 1); \ No newline at end of file +const cXyz cXyz::BaseXYZ(1, 1, 1); diff --git a/src/d/actor/d_a_obj_itamato.cpp b/src/d/actor/d_a_obj_itamato.cpp index 0669616539..060670c963 100644 --- a/src/d/actor/d_a_obj_itamato.cpp +++ b/src/d/actor/d_a_obj_itamato.cpp @@ -131,10 +131,8 @@ extern "C" extern void* __vt__12cCcD_SphAttr[25]; extern "C" extern void* __vt__14cCcD_ShapeAttr[22]; extern "C" extern void* __vt__9cCcD_Stts[8]; extern "C" u8 now__14mDoMtx_stack_c[48]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; extern "C" u8 mSimpleTexObj__21dDlst_shadowControl_c[32]; extern "C" u8 sincosTable___5JMath[65536]; -extern "C" extern u8 mStayNo__20dStage_roomControl_c[4]; extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */]; extern "C" void __register_global_object(); diff --git a/src/d/actor/d_a_obj_treesh.cpp b/src/d/actor/d_a_obj_treesh.cpp index 9b2d5f3a61..b1d17cda23 100644 --- a/src/d/actor/d_a_obj_treesh.cpp +++ b/src/d/actor/d_a_obj_treesh.cpp @@ -4,93 +4,176 @@ */ #include "d/actor/d_a_obj_treesh.h" -#include "dol2asm.h" - - - -// -// Forward References: -// - -extern "C" void __ct__14daTreeSh_HIO_cFv(); -extern "C" void __dt__5csXyzFv(); -extern "C" void __dt__14mDoHIO_entry_cFv(); -extern "C" static void nodeCallBack__FP8J3DJointi(); -extern "C" void initBaseMtx__10daTreeSh_cFv(); -extern "C" void setBaseMtx__10daTreeSh_cFv(); -extern "C" void CreateHeap__10daTreeSh_cFv(); -extern "C" void Create__10daTreeSh_cFv(); -extern "C" void create1st__10daTreeSh_cFv(); -extern "C" void Execute__10daTreeSh_cFPPA3_A4_f(); -extern "C" void Draw__10daTreeSh_cFv(); -extern "C" void Delete__10daTreeSh_cFv(); -extern "C" static void daTreeSh_create1st__FP10daTreeSh_c(); -extern "C" void __ct__5csXyzFv(); -extern "C" static void daTreeSh_MoveBGDelete__FP10daTreeSh_c(); -extern "C" static void daTreeSh_MoveBGExecute__FP10daTreeSh_c(); -extern "C" static void daTreeSh_MoveBGDraw__FP10daTreeSh_c(); -extern "C" void __dt__14daTreeSh_HIO_cFv(); -extern "C" void __sinit_d_a_obj_treesh_cpp(); -extern "C" extern char const* const d_a_obj_treesh__stringBase0; - -// -// External References: -// - -extern "C" void mDoMtx_YrotM__FPA4_fs(); -extern "C" void transS__14mDoMtx_stack_cFRC4cXyz(); -extern "C" void mDoExt_modelUpdateDL__FP8J3DModel(); -extern "C" void mDoExt_J3DModel__create__FP12J3DModelDataUlUl(); -extern "C" void fopAcM_setCullSizeBox__FP10fopAc_ac_cffffff(); -extern "C" void dComIfG_resLoad__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfG_resDelete__FP30request_of_phase_process_classPCc(); -extern "C" void getRes__14dRes_control_cFPCclP11dRes_info_ci(); -extern "C" void dKyw_get_wind_pow__Fv(); -extern "C" void __ct__16dBgS_MoveBgActorFv(); -extern "C" bool IsDelete__16dBgS_MoveBgActorFv(); -extern "C" bool ToFore__16dBgS_MoveBgActorFv(); -extern "C" bool ToBack__16dBgS_MoveBgActorFv(); -extern "C" void -MoveBGCreate__16dBgS_MoveBgActorFPCciPFP4dBgWPvRC13cBgS_PolyInfobP4cXyzP5csXyzP5csXyz_vUlPA3_A4_f(); -extern "C" void MoveBGDelete__16dBgS_MoveBgActorFv(); -extern "C" void MoveBGExecute__16dBgS_MoveBgActorFv(); -extern "C" void settingTevStruct__18dScnKy_env_light_cFiP4cXyzP12dKy_tevstr_c(); -extern "C" void setLightTevColorType_MAJI__18dScnKy_env_light_cFP12J3DModelDataP12dKy_tevstr_c(); -extern "C" void cM_rndF__Ff(); -extern "C" void cM_rndFX__Ff(); -extern "C" void __dl__FPv(); -extern "C" void __construct_array(); -extern "C" void _savegpr_23(); -extern "C" void _savegpr_28(); -extern "C" void _restgpr_23(); -extern "C" void _restgpr_28(); -extern "C" u8 now__14mDoMtx_stack_c[48]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; -extern "C" u8 mCurrentMtx__6J3DSys[48]; -extern "C" u8 sincosTable___5JMath[65536]; -extern "C" void __register_global_object(); - -// -// Declarations: -// - -/* ############################################################################################## */ -/* 80D1F8E8-80D1F8E8 000020 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80D1F8E8 = "M_TreeSh"; -#pragma pop +#include "d/d_com_inf_game.h" /* 80D1F8F4-80D1F8F8 -00001 0004+00 4/4 0/0 0/0 .data l_arcName */ -SECTION_DATA static void* l_arcName = (void*)&d_a_obj_treesh__stringBase0; +static char* l_arcName = "M_TreeSh"; + +/* 80D1F0CC-80D1F10C 0000EC 0040+00 1/1 0/0 0/0 .text __ct__14daTreeSh_HIO_cFv */ +daTreeSh_HIO_c::daTreeSh_HIO_c() { + shake_strength = 800; + shake_speed = 500; + field_0x8 = 0; + field_0xa.z = 0; + field_0xa.y = 0; + field_0xa.x = 0; +} + +/* 80D1F190-80D1F258 0001B0 00C8+00 1/1 0/0 0/0 .text nodeCallBack__FP8J3DJointi */ +static int nodeCallBack(J3DJoint* i_joint, int param_1) { + if (!param_1) { + int jnt_no = i_joint->getJntNo(); + J3DModel* model_p = j3dSys.getModel(); + daTreeSh_c* tree_p = (daTreeSh_c*)model_p->getUserArea(); + + cMtx_copy(model_p->getAnmMtx(jnt_no), mDoMtx_stack_c::get()); + + if (jnt_no == 1) { + mDoMtx_stack_c::YrotM(tree_p->mRot[0].y); + } else if (jnt_no == 2) { + mDoMtx_stack_c::YrotM(tree_p->mRot[1].y); + } + + model_p->setAnmMtx(jnt_no, mDoMtx_stack_c::get()); + mDoMtx_copy(mDoMtx_stack_c::get(), j3dSys.mCurrentMtx); + } + + return 1; +} + +/* 80D1F258-80D1F294 000278 003C+00 1/1 0/0 0/0 .text initBaseMtx__10daTreeSh_cFv */ +void daTreeSh_c::initBaseMtx() { + mpModel->setBaseScale(scale); + setBaseMtx(); +} + +/* 80D1F294-80D1F2E8 0002B4 0054+00 1/1 0/0 0/0 .text setBaseMtx__10daTreeSh_cFv */ +void daTreeSh_c::setBaseMtx() { + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::YrotM(shape_angle.y); + mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); +} + +/* 80D1F2E8-80D1F358 000308 0070+00 1/0 0/0 0/0 .text CreateHeap__10daTreeSh_cFv */ +int daTreeSh_c::CreateHeap() { + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 4); + JUT_ASSERT(211, modelData != 0); + + mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); + if (mpModel == NULL) { + return 0; + } + + return 1; +} + +/* 80D1F358-80D1F414 000378 00BC+00 1/0 0/0 0/0 .text Create__10daTreeSh_cFv */ +int daTreeSh_c::Create() { + initBaseMtx(); + fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); + + J3DJoint* joint_p = mpModel->getModelData()->getJointNodePointer(0); + fopAcM_setCullSizeBox(this, + joint_p->getMin()->x, joint_p->getMin()->y, joint_p->getMin()->z, + joint_p->getMax()->x, joint_p->getMax()->y, joint_p->getMax()->z); + + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 4); + modelData->getJointNodePointer(1)->setCallBack(nodeCallBack); + modelData->getJointNodePointer(2)->setCallBack(nodeCallBack); + mpModel->setUserArea((u32)this); + return 1; +} + +/* 80D1F99C-80D1F9AC 000014 0010+00 2/2 0/0 0/0 .bss l_HIO */ +static daTreeSh_HIO_c l_HIO; + +/* 80D1F414-80D1F49C 000434 0088+00 1/1 0/0 0/0 .text create1st__10daTreeSh_cFv */ +int daTreeSh_c::create1st() { + int phase_state = dComIfG_resLoad(&mPhase, l_arcName); + if (phase_state == cPhs_COMPLEATE_e) { + if (MoveBGCreate(l_arcName, 7, NULL, 0x4000, NULL) == cPhs_ERROR_e) { + return cPhs_ERROR_e; + } + +#ifdef DEBUG + l_HIO.entryHIO("針葉樹"); +#endif + } + + return phase_state; +} + +/* 80D1F49C-80D1F648 0004BC 01AC+00 1/0 0/0 0/0 .text Execute__10daTreeSh_cFPPA3_A4_f */ +int daTreeSh_c::Execute(Mtx** param_0) { + for (int i = 0; i < 2; i++) { + if (mShakeTimer[i] == 0) { + mShakeTimer[i] = cM_rndF(30.0f) + 15.0f; + field_0x5b8[i] = cM_rndFX(0.3f) + 1.0f; + field_0x5c4[i] = field_0x5b8[i] * (l_HIO.shake_speed * (dKyw_get_wind_pow() + 0.2f)); + } else { + mShakeTimer[i]--; + } + + field_0x5c0[i] += field_0x5c4[i]; + } + + mRot[0].y = l_HIO.shake_strength * cM_ssin(field_0x5c0[0]); + mRot[1].y = l_HIO.shake_strength * cM_scos(field_0x5c0[1]); + + *param_0 = &mpModel->getBaseTRMtx(); + return 1; +} + +/* 80D1F648-80D1F6EC 000668 00A4+00 1/0 0/0 0/0 .text Draw__10daTreeSh_cFv */ +int daTreeSh_c::Draw() { + g_env_light.settingTevStruct(0x10, ¤t.pos, &tevStr); + g_env_light.setLightTevColorType_MAJI(mpModel, &tevStr); + + dComIfGd_setListBG(); + mDoExt_modelUpdateDL(mpModel); + dComIfGd_setList(); + return 1; +} + +/* 80D1F6EC-80D1F720 00070C 0034+00 1/0 0/0 0/0 .text Delete__10daTreeSh_cFv */ +int daTreeSh_c::Delete() { + dComIfG_resDelete(&mPhase, l_arcName); +#ifdef DEBUG + l_HIO.removeHIO(); +#endif + return 1; +} + +/* 80D1F720-80D1F7AC 000740 008C+00 1/0 0/0 0/0 .text daTreeSh_create1st__FP10daTreeSh_c + */ +static int daTreeSh_create1st(daTreeSh_c* i_this) { + fopAcM_SetupActor(i_this, daTreeSh_c); + return i_this->create1st(); +} + +/* 80D1F7B0-80D1F7D0 0007D0 0020+00 1/0 0/0 0/0 .text daTreeSh_MoveBGDelete__FP10daTreeSh_c */ +static int daTreeSh_MoveBGDelete(daTreeSh_c* i_this) { + return i_this->MoveBGDelete(); +} + +/* 80D1F7D0-80D1F7F0 0007F0 0020+00 1/0 0/0 0/0 .text daTreeSh_MoveBGExecute__FP10daTreeSh_c */ +static int daTreeSh_MoveBGExecute(daTreeSh_c* i_this) { + return i_this->MoveBGExecute(); +} + +/* 80D1F7F0-80D1F81C 000810 002C+00 1/0 0/0 0/0 .text daTreeSh_MoveBGDraw__FP10daTreeSh_c + */ +static int daTreeSh_MoveBGDraw(daTreeSh_c* i_this) { + return i_this->MoveBGDraw(); +} /* 80D1F8F8-80D1F918 -00001 0020+00 1/0 0/0 0/0 .data daTreeSh_METHODS */ static actor_method_class daTreeSh_METHODS = { - (process_method_func)daTreeSh_create1st__FP10daTreeSh_c, - (process_method_func)daTreeSh_MoveBGDelete__FP10daTreeSh_c, - (process_method_func)daTreeSh_MoveBGExecute__FP10daTreeSh_c, - 0, - (process_method_func)daTreeSh_MoveBGDraw__FP10daTreeSh_c, + (process_method_func)daTreeSh_create1st, + (process_method_func)daTreeSh_MoveBGDelete, + (process_method_func)daTreeSh_MoveBGExecute, + (process_method_func)NULL, + (process_method_func)daTreeSh_MoveBGDraw, }; /* 80D1F918-80D1F948 -00001 0030+00 0/0 0/0 1/0 .data g_profile_TREESH */ @@ -110,190 +193,3 @@ extern actor_process_profile_definition g_profile_TREESH = { fopAc_ACTOR_e, // mActorType fopAc_CULLBOX_CUSTOM_e, // cullType }; - -/* 80D1F948-80D1F970 000054 0028+00 1/1 0/0 0/0 .data __vt__10daTreeSh_c */ -SECTION_DATA extern void* __vt__10daTreeSh_c[10] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)CreateHeap__10daTreeSh_cFv, - (void*)Create__10daTreeSh_cFv, - (void*)Execute__10daTreeSh_cFPPA3_A4_f, - (void*)Draw__10daTreeSh_cFv, - (void*)Delete__10daTreeSh_cFv, - (void*)IsDelete__16dBgS_MoveBgActorFv, - (void*)ToFore__16dBgS_MoveBgActorFv, - (void*)ToBack__16dBgS_MoveBgActorFv, -}; - -/* 80D1F970-80D1F97C 00007C 000C+00 2/2 0/0 0/0 .data __vt__14daTreeSh_HIO_c */ -SECTION_DATA extern void* __vt__14daTreeSh_HIO_c[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__14daTreeSh_HIO_cFv, -}; - -/* 80D1F97C-80D1F988 000088 000C+00 3/3 0/0 0/0 .data __vt__14mDoHIO_entry_c */ -SECTION_DATA extern void* __vt__14mDoHIO_entry_c[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__14mDoHIO_entry_cFv, -}; - -/* 80D1F0CC-80D1F10C 0000EC 0040+00 1/1 0/0 0/0 .text __ct__14daTreeSh_HIO_cFv */ -daTreeSh_HIO_c::daTreeSh_HIO_c() { - // NONMATCHING -} - -/* 80D1F10C-80D1F148 00012C 003C+00 1/1 0/0 0/0 .text __dt__5csXyzFv */ -// csXyz::~csXyz() { -extern "C" void __dt__5csXyzFv() { - // NONMATCHING -} - -/* 80D1F148-80D1F190 000168 0048+00 1/0 0/0 0/0 .text __dt__14mDoHIO_entry_cFv */ -// mDoHIO_entry_c::~mDoHIO_entry_c() { -extern "C" void __dt__14mDoHIO_entry_cFv() { - // NONMATCHING -} - -/* 80D1F190-80D1F258 0001B0 00C8+00 1/1 0/0 0/0 .text nodeCallBack__FP8J3DJointi */ -static void nodeCallBack(J3DJoint* param_0, int param_1) { - // NONMATCHING -} - -/* 80D1F258-80D1F294 000278 003C+00 1/1 0/0 0/0 .text initBaseMtx__10daTreeSh_cFv */ -void daTreeSh_c::initBaseMtx() { - // NONMATCHING -} - -/* 80D1F294-80D1F2E8 0002B4 0054+00 1/1 0/0 0/0 .text setBaseMtx__10daTreeSh_cFv */ -void daTreeSh_c::setBaseMtx() { - // NONMATCHING -} - -/* 80D1F2E8-80D1F358 000308 0070+00 1/0 0/0 0/0 .text CreateHeap__10daTreeSh_cFv */ -void daTreeSh_c::CreateHeap() { - // NONMATCHING -} - -/* 80D1F358-80D1F414 000378 00BC+00 1/0 0/0 0/0 .text Create__10daTreeSh_cFv */ -void daTreeSh_c::Create() { - // NONMATCHING -} - -/* 80D1F414-80D1F49C 000434 0088+00 1/1 0/0 0/0 .text create1st__10daTreeSh_cFv */ -void daTreeSh_c::create1st() { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 80D1F8C8-80D1F8CC 000000 0004+00 1/1 0/0 0/0 .rodata @3767 */ -SECTION_RODATA static f32 const lit_3767 = 15.0f; -COMPILER_STRIP_GATE(0x80D1F8C8, &lit_3767); - -/* 80D1F8CC-80D1F8D0 000004 0004+00 0/1 0/0 0/0 .rodata @3768 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3768 = 30.0f; -COMPILER_STRIP_GATE(0x80D1F8CC, &lit_3768); -#pragma pop - -/* 80D1F8D0-80D1F8D4 000008 0004+00 0/1 0/0 0/0 .rodata @3769 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3769 = 1.0f; -COMPILER_STRIP_GATE(0x80D1F8D0, &lit_3769); -#pragma pop - -/* 80D1F8D4-80D1F8D8 00000C 0004+00 0/1 0/0 0/0 .rodata @3770 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3770 = 3.0f / 10.0f; -COMPILER_STRIP_GATE(0x80D1F8D4, &lit_3770); -#pragma pop - -/* 80D1F8D8-80D1F8E0 000010 0004+04 0/1 0/0 0/0 .rodata @3771 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3771[1 + 1 /* padding */] = { - 1.0f / 5.0f, - /* padding */ - 0.0f, -}; -COMPILER_STRIP_GATE(0x80D1F8D8, &lit_3771); -#pragma pop - -/* 80D1F8E0-80D1F8E8 000018 0008+00 0/1 0/0 0/0 .rodata @3774 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3774[8] = { - 0x43, 0x30, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x80D1F8E0, &lit_3774); -#pragma pop - -/* 80D1F990-80D1F99C 000008 000C+00 1/1 0/0 0/0 .bss @3618 */ -static u8 lit_3618[12]; - -/* 80D1F99C-80D1F9AC 000014 0010+00 2/2 0/0 0/0 .bss l_HIO */ -static u8 l_HIO[16]; - -/* 80D1F49C-80D1F648 0004BC 01AC+00 1/0 0/0 0/0 .text Execute__10daTreeSh_cFPPA3_A4_f */ -void daTreeSh_c::Execute(f32 (**param_0)[3][4]) { - // NONMATCHING -} - -/* 80D1F648-80D1F6EC 000668 00A4+00 1/0 0/0 0/0 .text Draw__10daTreeSh_cFv */ -void daTreeSh_c::Draw() { - // NONMATCHING -} - -/* 80D1F6EC-80D1F720 00070C 0034+00 1/0 0/0 0/0 .text Delete__10daTreeSh_cFv */ -void daTreeSh_c::Delete() { - // NONMATCHING -} - -/* 80D1F720-80D1F7AC 000740 008C+00 1/0 0/0 0/0 .text daTreeSh_create1st__FP10daTreeSh_c - */ -static void daTreeSh_create1st(daTreeSh_c* param_0) { - // NONMATCHING -} - -/* 80D1F7AC-80D1F7B0 0007CC 0004+00 1/1 0/0 0/0 .text __ct__5csXyzFv */ -// csXyz::csXyz() { -extern "C" void __ct__5csXyzFv() { - /* empty function */ -} - -/* 80D1F7B0-80D1F7D0 0007D0 0020+00 1/0 0/0 0/0 .text daTreeSh_MoveBGDelete__FP10daTreeSh_c */ -static void daTreeSh_MoveBGDelete(daTreeSh_c* param_0) { - // NONMATCHING -} - -/* 80D1F7D0-80D1F7F0 0007F0 0020+00 1/0 0/0 0/0 .text daTreeSh_MoveBGExecute__FP10daTreeSh_c */ -static void daTreeSh_MoveBGExecute(daTreeSh_c* param_0) { - // NONMATCHING -} - -/* 80D1F7F0-80D1F81C 000810 002C+00 1/0 0/0 0/0 .text daTreeSh_MoveBGDraw__FP10daTreeSh_c - */ -static void daTreeSh_MoveBGDraw(daTreeSh_c* param_0) { - // NONMATCHING -} - -/* 80D1F81C-80D1F878 00083C 005C+00 2/1 0/0 0/0 .text __dt__14daTreeSh_HIO_cFv */ -daTreeSh_HIO_c::~daTreeSh_HIO_c() { - // NONMATCHING -} - -/* 80D1F878-80D1F8B4 000898 003C+00 0/0 1/0 0/0 .text __sinit_d_a_obj_treesh_cpp */ -void __sinit_d_a_obj_treesh_cpp() { - // NONMATCHING -} - -#pragma push -#pragma force_active on -REGISTER_CTORS(0x80D1F878, __sinit_d_a_obj_treesh_cpp); -#pragma pop - -/* 80D1F8E8-80D1F8E8 000020 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ diff --git a/src/d/actor/d_a_swBall.cpp b/src/d/actor/d_a_swBall.cpp index 12d864bb84..6a2218c229 100644 --- a/src/d/actor/d_a_swBall.cpp +++ b/src/d/actor/d_a_swBall.cpp @@ -4,233 +4,293 @@ */ #include "d/actor/d_a_swBall.h" -#include "dol2asm.h" +#include "d/actor/d_a_obj_carry.h" +#include "d/d_com_inf_game.h" +#include "d/d_lib.h" +#include "d/d_s_play.h" - -// -// Forward References: -// - -extern "C" static void s_ball_sub__FPvPv(); -extern "C" void checkArea_sub__10daSwBall_cFP10fopAc_ac_c(); -extern "C" void checkArea__10daSwBall_cFv(); -extern "C" void search_ball__10daSwBall_cFv(); -extern "C" void Create__10daSwBall_cFv(); -extern "C" void create__10daSwBall_cFv(); -extern "C" void execute__10daSwBall_cFv(); -extern "C" void actionRun__10daSwBall_cFv(); -extern "C" void actionStop__10daSwBall_cFv(); -extern "C" void PutCrrPos__10daSwBall_cFv(); -extern "C" bool _delete__10daSwBall_cFv(); -extern "C" static void daSwBall_Execute__FP10daSwBall_c(); -extern "C" static void daSwBall_Delete__FP10daSwBall_c(); -extern "C" static void daSwBall_Create__FP10fopAc_ac_c(); -extern "C" void func_80D4E974(void* _this, u8*); - -// -// External References: -// - -extern "C" void __ct__10fopAc_ac_cFv(); -extern "C" void fopAc_IsActor__FPv(); -extern "C" void fopAcIt_Judge__FPFPvPv_PvPv(); -extern "C" void fopAcM_searchActorDistanceXZ__FPC10fopAc_ac_cPC10fopAc_ac_c(); -extern "C" void fpcEx_Search__FPFPvPv_PvPv(); -extern "C" void fpcSch_JudgeByID__FPvPv(); -extern "C" void dLib_checkActorInRectangle__FP10fopAc_ac_cP10fopAc_ac_cPC4cXyzPC4cXyz(); -extern "C" void onSwitch__10dSv_info_cFii(); -extern "C" void offSwitch__10dSv_info_cFii(); -extern "C" void cLib_chaseF__FPfff(); -extern "C" void cLib_targetAngleY__FPC3VecPC3Vec(); -extern "C" void __ptmf_scall(); -extern "C" void _savegpr_25(); -extern "C" void _savegpr_28(); -extern "C" void _restgpr_25(); -extern "C" void _restgpr_28(); -extern "C" extern u8 g_dComIfG_gameInfo[122384]; - -// -// Declarations: -// - -/* ############################################################################################## */ /* 80D4EA50-80D4EA70 000000 0020+00 2/2 0/0 0/0 .bss l_target_info */ -static u8 l_target_info[32]; +static fopAc_ac_c* l_target_info[8]; /* 80D4EA70-80D4EA74 000020 0004+00 2/2 0/0 0/0 .bss l_target_info_count */ -static u8 l_target_info_count[4]; +static int l_target_info_count; /* 80D4DFD8-80D4E054 000078 007C+00 1/1 0/0 0/0 .text s_ball_sub__FPvPv */ -static void s_ball_sub(void* param_0, void* param_1) { - // NONMATCHING +static void* s_ball_sub(void* i_actor, void* i_data) { + if (fopAcM_IsActor(i_actor) && fopAcM_GetName(i_actor) == PROC_Obj_Carry && ((daObjCarry_c*)i_actor)->getType() == daObjCarry_c::TYPE_LV8_BALL) { + if (l_target_info_count < 8) { + l_target_info[l_target_info_count] = (fopAc_ac_c*)i_actor; + l_target_info_count++; + } else { + // "Mysterious Ball Reaction Area Switch: mysterious ball count has exceeded limit!\n" + OS_REPORT("\x1b[43;30m怪しい玉反応領域スイッチ:怪しい玉対応できる数を越えてます!\n\x1b[m"); + } + } + + return NULL; } -/* ############################################################################################## */ -/* 80D4E998-80D4E99C 000000 0004+00 2/2 0/0 0/0 .rodata @3718 */ -SECTION_RODATA static f32 const lit_3718 = 10.0f; -COMPILER_STRIP_GATE(0x80D4E998, &lit_3718); - -/* 80D4E99C-80D4E9A0 000004 0004+00 0/1 0/0 0/0 .rodata @3719 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3719 = 100.0f; -COMPILER_STRIP_GATE(0x80D4E99C, &lit_3719); -#pragma pop - -/* 80D4E9A0-80D4E9A4 000008 0004+00 0/1 0/0 0/0 .rodata @3720 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3720 = -100.0f; -COMPILER_STRIP_GATE(0x80D4E9A0, &lit_3720); -#pragma pop - -/* 80D4E9A4-80D4E9A8 00000C 0004+00 0/2 0/0 0/0 .rodata @3721 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3721[4] = { - 0x00, - 0x00, - 0x00, - 0x00, -}; -COMPILER_STRIP_GATE(0x80D4E9A4, &lit_3721); -#pragma pop - /* 80D4E054-80D4E194 0000F4 0140+00 2/2 0/0 0/0 .text checkArea_sub__10daSwBall_cFP10fopAc_ac_c */ -void daSwBall_c::checkArea_sub(fopAc_ac_c* param_0) { - // NONMATCHING +BOOL daSwBall_c::checkArea_sub(fopAc_ac_c* i_ball) { + if (getType() == 0) { + if (i_ball->current.pos.y >= current.pos.y - 10.0f && i_ball->current.pos.y < current.pos.y + (100.0f * scale.y) && fopAcM_searchActorDistanceXZ(this, i_ball) < (100.0f * scale.x)) { + return TRUE; + } + } else if (getType() == 1) { + cXyz bound_a(-100.0f * scale.x, 0.0f, -100.0f * scale.z); + cXyz bound_b(100.0f * scale.x, 100.0f * scale.y, 100.0f * scale.z); + bound_a.y += current.pos.y - 10.0f; + bound_b.y += current.pos.y; + + if (i_ball->current.pos.y >= bound_a.y && i_ball->current.pos.y < bound_b.y && dLib_checkActorInRectangle(i_ball, this, &bound_a, &bound_b)) { + return TRUE; + } + } + + return FALSE; } /* 80D4E194-80D4E248 000234 00B4+00 2/2 0/0 0/0 .text checkArea__10daSwBall_cFv */ -void daSwBall_c::checkArea() { - // NONMATCHING +BOOL daSwBall_c::checkArea() { + fopAc_ac_c* ball_actors[8]; + + for (int i = 0; i < 8; i++) { + if (mBallIDs[i] != fpcM_ERROR_PROCESS_ID_e) { + ball_actors[i] = fopAcM_SearchByID(mBallIDs[i]); + } else { + ball_actors[i] = NULL; + } + + if (ball_actors[i] != NULL && checkArea_sub(ball_actors[i])) { + return TRUE; + } + } + + return FALSE; } /* 80D4E248-80D4E374 0002E8 012C+00 1/1 0/0 0/0 .text search_ball__10daSwBall_cFv */ void daSwBall_c::search_ball() { - // NONMATCHING + l_target_info_count = 0; + + for (int i = 0; i < 8; i++) { + l_target_info[i] = NULL; + } + + fpcM_Search(s_ball_sub, this); + + for (int i = 0; i < l_target_info_count; i++) { + if (l_target_info[i] != NULL) { + fpc_ProcID target_id = fopAcM_GetID(l_target_info[i]); + if (target_id != fpcM_ERROR_PROCESS_ID_e) { + int ball_idx = -1; + for (int j = 0; j < 8; j++) { + if (target_id == mBallIDs[j]) { + ball_idx = j; + break; + } + } + + if (ball_idx < 0) { + for (int j = 0; j < 8; j++) { + if (mBallIDs[j] == fpcM_ERROR_PROCESS_ID_e) { + mBallIDs[j] = target_id; + break; + } + } + } + } + } + } } /* 80D4E374-80D4E42C 000414 00B8+00 1/1 0/0 0/0 .text Create__10daSwBall_cFv */ -void daSwBall_c::Create() { - // NONMATCHING +int daSwBall_c::Create() { + for (int i = 0; i < 8; i++) { + mBallIDs[i] = fpcM_ERROR_PROCESS_ID_e; + } + + field_0x59c = fpcM_ERROR_PROCESS_ID_e; + + execute(); + + if (checkArea()) { + if (getArg0() == 1) { + mMode = 3; + } else { + mMode = 2; + } + + fopAcM_onSwitch(this, getSwbit()); + } else { + mMode = 0; + } + + return 1; } /* 80D4E42C-80D4E494 0004CC 0068+00 1/1 0/0 0/0 .text create__10daSwBall_cFv */ -void daSwBall_c::create() { - // NONMATCHING +int daSwBall_c::create() { + fopAcM_SetupActor(this, daSwBall_c); + + if (!Create()) { + return cPhs_ERROR_e; + } + + return cPhs_COMPLEATE_e; } -/* ############################################################################################## */ -/* 80D4E9AC-80D4E9B8 000000 000C+00 1/1 0/0 0/0 .data cNullVec__6Z2Calc */ -SECTION_DATA static u8 cNullVec__6Z2Calc[12] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -/* 80D4E9B8-80D4E9CC 00000C 0004+10 0/0 0/0 0/0 .data @1787 */ -#pragma push -#pragma force_active on -SECTION_DATA static u32 lit_1787[1 + 4 /* padding */] = { - 0x02000201, - /* padding */ - 0x40080000, - 0x00000000, - 0x3FE00000, - 0x00000000, -}; -#pragma pop - -/* 80D4E9CC-80D4E9D8 -00001 000C+00 0/1 0/0 0/0 .data @3847 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_3847[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)actionRun__10daSwBall_cFv, -}; -#pragma pop - -/* 80D4E9D8-80D4E9E4 -00001 000C+00 0/1 0/0 0/0 .data @3848 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_3848[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)actionStop__10daSwBall_cFv, -}; -#pragma pop - -/* 80D4E9E4-80D4E9FC 000038 0018+00 0/1 0/0 0/0 .data l_func$3846 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_func[24] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -#pragma pop - -/* 80D4EA74-80D4EA78 000024 0004+00 1/1 0/0 0/0 .bss None */ -static u8 data_80D4EA74[4]; +UNK_REL_DATA /* 80D4E494-80D4E524 000534 0090+00 2/2 0/0 0/0 .text execute__10daSwBall_cFv */ -void daSwBall_c::execute() { - // NONMATCHING +int daSwBall_c::execute() { + static void (daSwBall_c::*l_func[])() = { + &daSwBall_c::actionRun, + &daSwBall_c::actionStop, + }; + + (this->*l_func[mAction])(); + return 1; } /* 80D4E524-80D4E6C4 0005C4 01A0+00 1/0 0/0 0/0 .text actionRun__10daSwBall_cFv */ void daSwBall_c::actionRun() { - // NONMATCHING + search_ball(); + BOOL in_area = checkArea(); + + switch (mMode) { + case 0: + if (in_area) { + mTimer = getArg1(); + if (mTimer == 0xFF) { + mTimer = 15; + } + + if (getArg0() == 1) { + if (mTimer == 0) { + fopAcM_onSwitch(this, getSwbit()); + mMode = 3; + } + } else if (mTimer == 0) { + fopAcM_onSwitch(this, getSwbit()); + mMode = 2; + } + + mMode = 1; + } + + fopAcM_offSwitch(this, getSwbit()); + break; + case 1: + if (!in_area) { + mMode = 0; + } else if (cLib_calcTimer(&mTimer) == 0) { + mMode = 2; + } + break; + case 2: + fopAcM_onSwitch(this, getSwbit()); + + if (getArg0() == 1) { + mMode = 3; + } else if (!in_area) { + mMode = 0; + } + break; + case 3: + break; + } + + PutCrrPos(); } /* 80D4E6C4-80D4E6C8 000764 0004+00 1/0 0/0 0/0 .text actionStop__10daSwBall_cFv */ -void daSwBall_c::actionStop() { - /* empty function */ -} - -/* ############################################################################################## */ -/* 80D4E9A8-80D4E9AC 000010 0004+00 0/1 0/0 0/0 .rodata @3994 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3994 = 300.0f; -COMPILER_STRIP_GATE(0x80D4E9A8, &lit_3994); -#pragma pop +void daSwBall_c::actionStop() {} /* 80D4E6C8-80D4E90C 000768 0244+00 1/1 0/0 0/0 .text PutCrrPos__10daSwBall_cFv */ void daSwBall_c::PutCrrPos() { - // NONMATCHING + if (checkPullLBall()) { + daPy_py_c* player = daPy_getPlayerActorClass(); + s16 spA = cLib_targetAngleY(&player->current.pos, ¤t.pos) - player->shape_angle.y; + + if (fopAcM_searchPlayerDistanceXZ(this) < 300.0f + KREG_F(0) && spA < 0x4000) { + fopAc_ac_c* grab_actor = fopAcM_SearchByID(player->getGrabActorID()); + if (grab_actor != NULL && fopAcM_IsActor(grab_actor) && fopAcM_GetName(grab_actor) == PROC_Obj_Carry) { + daObjCarry_c* carry_obj = (daObjCarry_c*)grab_actor; + if (carry_obj->getType() == daObjCarry_c::TYPE_LV8_BALL) { + player->setForcePutPos(current.pos); + } + } + } + + daObjCarry_c* carry_obj; + for (int i = 0; i < 8; i++) { + if (mBallIDs[i] != fpcM_ERROR_PROCESS_ID_e) { + carry_obj = (daObjCarry_c*)fopAcM_SearchByID(mBallIDs[i]); + } else { + carry_obj = NULL; + } + + bool sp8 = false; + if (carry_obj != NULL) { + if (field_0x59c == mBallIDs[i] || field_0x59c == fpcM_ERROR_PROCESS_ID_e) { + switch (field_0x593[i]) { + case 0: + if (!fopAcM_checkCarryNow(carry_obj) && checkArea_sub(carry_obj)) { + if (current.pos.x != carry_obj->current.pos.x || current.pos.z != carry_obj->current.pos.z) { + carry_obj->startCtrl(); + field_0x593[i] = 1; + } + field_0x59c = mBallIDs[i]; + } else { + field_0x59c = fpcM_ERROR_PROCESS_ID_e; + } + break; + case 1: + cLib_chaseF(&carry_obj->current.pos.x, current.pos.x, 10.0f); + cLib_chaseF(&carry_obj->current.pos.z, current.pos.z, 10.0f); + + if (0.0f == fopAcM_searchActorDistanceXZ(this, carry_obj)) { + carry_obj->endCtrl(); + field_0x593[i] = 0; + } + + field_0x59c = mBallIDs[i]; + break; + } + } + + mIsBallCarry[i] = fopAcM_checkCarryNow(carry_obj) != 0; + } + } + } } /* 80D4E90C-80D4E914 0009AC 0008+00 1/1 0/0 0/0 .text _delete__10daSwBall_cFv */ -bool daSwBall_c::_delete() { - return true; +int daSwBall_c::_delete() { + return 1; } /* 80D4E914-80D4E934 0009B4 0020+00 1/0 0/0 0/0 .text daSwBall_Execute__FP10daSwBall_c */ -static void daSwBall_Execute(daSwBall_c* param_0) { - // NONMATCHING +static int daSwBall_Execute(daSwBall_c* i_this) { + return i_this->execute(); } /* 80D4E934-80D4E954 0009D4 0020+00 1/0 0/0 0/0 .text daSwBall_Delete__FP10daSwBall_c */ -static void daSwBall_Delete(daSwBall_c* param_0) { - // NONMATCHING +static int daSwBall_Delete(daSwBall_c* i_this) { + return i_this->_delete(); } /* 80D4E954-80D4E974 0009F4 0020+00 1/0 0/0 0/0 .text daSwBall_Create__FP10fopAc_ac_c */ -static void daSwBall_Create(fopAc_ac_c* param_0) { - // NONMATCHING +static int daSwBall_Create(fopAc_ac_c* i_this) { + return ((daSwBall_c*)i_this)->create(); } -/* 80D4E974-80D4E990 000A14 001C+00 1/1 0/0 0/0 .text cLib_calcTimer__FPUc */ -extern "C" void func_80D4E974(void* _this, u8* param_0) { - // NONMATCHING -} - -/* ############################################################################################## */ /* 80D4E9FC-80D4EA1C -00001 0020+00 1/0 0/0 0/0 .data l_daSwBall_Method */ static actor_method_class l_daSwBall_Method = { - (process_method_func)daSwBall_Create__FP10fopAc_ac_c, - (process_method_func)daSwBall_Delete__FP10daSwBall_c, - (process_method_func)daSwBall_Execute__FP10daSwBall_c, + (process_method_func)daSwBall_Create, + (process_method_func)daSwBall_Delete, + (process_method_func)daSwBall_Execute, }; /* 80D4EA1C-80D4EA4C -00001 0030+00 0/0 0/0 1/0 .data g_profile_SwBall */ diff --git a/src/d/actor/d_a_swhit0.cpp b/src/d/actor/d_a_swhit0.cpp index a972f31c32..ac62ce94c6 100644 --- a/src/d/actor/d_a_swhit0.cpp +++ b/src/d/actor/d_a_swhit0.cpp @@ -4,164 +4,86 @@ */ #include "d/actor/d_a_swhit0.h" -#include "d/d_cc_d.h" -#include "dol2asm.h" +#include "d/d_com_inf_game.h" +#define COLOR_YELLOW 0 +#define COLOR_BLUE 1 +#define COLOR_RED 2 +#define COLOR_GREEN 3 -// -// Forward References: -// - -extern "C" void getSwNo__10daSwhit0_cFv(); -extern "C" void getSwNo2__10daSwhit0_cFv(); -extern "C" void getEvNo__10daSwhit0_cFv(); -extern "C" void getTimer__10daSwhit0_cFv(); -extern "C" void getType__10daSwhit0_cFv(); -extern "C" void makeEventId__10daSwhit0_cFv(); -extern "C" void CreateHeap__10daSwhit0_cFv(); -extern "C" void CreateInit__10daSwhit0_cFv(); -extern "C" static void CheckCreateHeap__FP10fopAc_ac_c(); -extern "C" void create__10daSwhit0_cFv(); -extern "C" void __dt__8cM3dGSphFv(); -extern "C" void __dt__8cM3dGAabFv(); -extern "C" void __dt__12J3DFrameCtrlFv(); -extern "C" void checkHit__10daSwhit0_cFv(); -extern "C" void setCombackTimer__10daSwhit0_cFv(); -extern "C" void endCombackTimer__10daSwhit0_cFv(); -extern "C" void onSwitch__10daSwhit0_cFv(); -extern "C" void offSwitch__10daSwhit0_cFv(); -extern "C" void DemoProc__10daSwhit0_cFv(); -extern "C" void orderEvent__10daSwhit0_cFv(); -extern "C" void actionOffWait__10daSwhit0_cFv(); -extern "C" void actionToOnReady__10daSwhit0_cFv(); -extern "C" void actionToOnOrder__10daSwhit0_cFv(); -extern "C" void actionToOnDemo__10daSwhit0_cFv(); -extern "C" void actionToOnDemo2__10daSwhit0_cFv(); -extern "C" void actionSwWait__10daSwhit0_cFv(); -extern "C" void actionOnWait__10daSwhit0_cFv(); -extern "C" void setDrawMtx__10daSwhit0_cFv(); -extern "C" static void daSwhit0_Draw__FP10daSwhit0_c(); -extern "C" static void daSwhit0_Execute__FP10daSwhit0_c(); -extern "C" static void daSwhit0_Delete__FP10daSwhit0_c(); -extern "C" static void daSwhit0_Create__FP10fopAc_ac_c(); -extern "C" void func_8048734C(void* _this, u8*); -extern "C" extern char const* const d_a_swhit0__stringBase0; - -// -// External References: -// - -extern "C" void mDoMtx_XYZrotM__FPA4_fsss(); -extern "C" void play__14mDoExt_baseAnmFv(); -extern "C" void init__13mDoExt_brkAnmFP16J3DMaterialTableP15J3DAnmTevRegKeyiifss(); -extern "C" void entry__13mDoExt_brkAnmFP16J3DMaterialTablef(); -extern "C" void init__13mDoExt_bckAnmFP15J3DAnmTransformiifssb(); -extern "C" void entry__13mDoExt_bckAnmFP12J3DModelDataf(); -extern "C" void mDoExt_modelUpdateDL__FP8J3DModel(); -extern "C" void mDoExt_J3DModel__create__FP12J3DModelDataUlUl(); -extern "C" void __ct__10fopAc_ac_cFv(); -extern "C" void fopAcM_entrySolidHeap__FP10fopAc_ac_cPFP10fopAc_ac_c_iUl(); -extern "C" void fopAcM_orderOtherEventId__FP10fopAc_ac_csUcUsUsUs(); -extern "C" void fopAcM_orderMapToolAutoNextEvent__FP10fopAc_ac_cUcsUsUsUs(); -extern "C" void dComIfG_resLoad__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfG_resDelete__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfGp_getReverb__Fi(); -extern "C" void onSwitch__10dSv_info_cFii(); -extern "C" void offSwitch__10dSv_info_cFii(); -extern "C" void isSwitch__10dSv_info_cCFii(); -extern "C" void getRes__14dRes_control_cFPCclP11dRes_info_ci(); -extern "C" void reset__14dEvt_control_cFv(); -extern "C" void getEventIdx__16dEvent_manager_cFPCcUcl(); -extern "C" void getEventIdx__16dEvent_manager_cFP10fopAc_ac_cUc(); -extern "C" void isMapToolCamera__16dEvent_manager_cFUcl(); -extern "C" void endCheck__16dEvent_manager_cFs(); -extern "C" void getMyStaffId__16dEvent_manager_cFPCcP10fopAc_ac_ci(); -extern "C" void getIsAddvance__16dEvent_manager_cFi(); -extern "C" void getMyActIdx__16dEvent_manager_cFiPCPCciii(); -extern "C" void cutEnd__16dEvent_manager_cFi(); -extern "C" void __ct__10dCcD_GSttsFv(); -extern "C" void Init__9dCcD_SttsFiiP10fopAc_ac_c(); -extern "C" void __ct__12dCcD_GObjInfFv(); -extern "C" void ChkTgHit__12dCcD_GObjInfFv(); -extern "C" void Set__8dCcD_SphFRC11dCcD_SrcSph(); -extern "C" void settingTevStruct__18dScnKy_env_light_cFiP4cXyzP12dKy_tevstr_c(); -extern "C" void setLightTevColorType__18dScnKy_env_light_cFP12J3DModelDataP12dKy_tevstr_c(); -extern "C" void Set__4cCcSFP8cCcD_Obj(); -extern "C" void SetC__8cM3dGSphFRC4cXyz(); -extern "C" void seStart__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc(); -extern "C" void __dl__FPv(); -extern "C" void init__12J3DFrameCtrlFs(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_29(); -extern "C" extern void* __vt__8dCcD_Sph[36]; -extern "C" extern void* __vt__9dCcD_Stts[11]; -extern "C" extern void* __vt__12cCcD_SphAttr[25]; -extern "C" extern void* __vt__14cCcD_ShapeAttr[22]; -extern "C" extern void* __vt__9cCcD_Stts[8]; -extern "C" u8 now__14mDoMtx_stack_c[48]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; -extern "C" u8 sincosTable___5JMath[65536]; -extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */]; - -// -// Declarations: -// +/* 804873BC-804873C0 -00001 0004+00 3/3 0/0 0/0 .data l_arcName */ +static char* l_arcName = "S_swHit00"; /* 80485FF8-80486004 000078 000C+00 9/9 0/0 0/0 .text getSwNo__10daSwhit0_cFv */ -void daSwhit0_c::getSwNo() { - // NONMATCHING +int daSwhit0_c::getSwNo() { + return fopAcM_GetParam(this) & 0xFF; } /* 80486004-80486010 000084 000C+00 1/1 0/0 0/0 .text getSwNo2__10daSwhit0_cFv */ -void daSwhit0_c::getSwNo2() { - // NONMATCHING +int daSwhit0_c::getSwNo2() { + return home.angle.z & 0xFF; } /* 80486010-8048602C 000090 001C+00 3/3 0/0 0/0 .text getEvNo__10daSwhit0_cFv */ -void daSwhit0_c::getEvNo() { - // NONMATCHING +u8 daSwhit0_c::getEvNo() { + u8 evNo = (fopAcM_GetParam(this) >> 8) & 0xFF; + if (evNo == 0xFE) { + evNo = 0xFF; + } + + return evNo; } /* 8048602C-80486048 0000AC 001C+00 1/1 0/0 0/0 .text getTimer__10daSwhit0_cFv */ -void daSwhit0_c::getTimer() { - // NONMATCHING +u8 daSwhit0_c::getTimer() { + u8 timer = (fopAcM_GetParam(this) >> 16) & 0xFF; + if (timer == 0xFF) { + timer = 0; + } + + return timer; } /* 80486048-80486064 0000C8 001C+00 4/4 0/0 0/0 .text getType__10daSwhit0_cFv */ -void daSwhit0_c::getType() { - // NONMATCHING -} +u8 daSwhit0_c::getType() { + u8 type = (fopAcM_GetParam(this) >> 30); + if (type >= 4) { + type = 0; + } -/* ############################################################################################## */ -/* 80487388-80487388 000018 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80487388 = "S_swHit00"; -SECTION_DEAD static char const* const stringBase_80487392 = "DEFAULT_SWITCH"; -#pragma pop + return type; +} /* 80486064-804860EC 0000E4 0088+00 1/1 0/0 0/0 .text makeEventId__10daSwhit0_cFv */ void daSwhit0_c::makeEventId() { - // NONMATCHING + u8 prm = (fopAcM_GetParam(this) >> 8) & 0xFF; + if (prm == 0xFE) { + mEventId = dComIfGp_evmng_getEventIdx("DEFAULT_SWITCH", getEvNo()); + } else { + mEventId = dComIfGp_getEventManager().getEventIdx(this, getEvNo()); + } } -/* ############################################################################################## */ -/* 80487370-80487374 000000 0004+00 6/6 0/0 0/0 .rodata @3685 */ -SECTION_RODATA static f32 const lit_3685 = 1.0f; -COMPILER_STRIP_GATE(0x80487370, &lit_3685); - -/* 804873BC-804873C0 -00001 0004+00 3/3 0/0 0/0 .data l_arcName */ -SECTION_DATA static void* l_arcName = (void*)&d_a_swhit0__stringBase0; - /* 804860EC-80486214 00016C 0128+00 1/1 0/0 0/0 .text CreateHeap__10daSwhit0_cFv */ -void daSwhit0_c::CreateHeap() { - // NONMATCHING -} +int daSwhit0_c::CreateHeap() { + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 8); + JUT_ASSERT(193, modelData != 0); -/* ############################################################################################## */ -/* 80487374-80487378 000004 0004+00 1/1 0/0 0/0 .rodata @3725 */ -SECTION_RODATA static f32 const lit_3725 = 95.0f; -COMPILER_STRIP_GATE(0x80487374, &lit_3725); + mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000202); + if (mpModel == NULL) { + return 0; + } + + if (!mBck.init((J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, 5), TRUE, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, 0, -1, false)) { + return 0; + } + + if (!mBrk.init(modelData, (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_arcName, 11), FALSE, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, 0, -1)) { + return 0; + } + + return 1; +} /* 804873C0-80487400 000004 0040+00 1/1 0/0 0/0 .data l_sph_src */ static dCcD_SrcSph l_sph_src = { @@ -177,56 +99,411 @@ static dCcD_SrcSph l_sph_src = { }; /* 80486214-80486390 000294 017C+00 1/1 0/0 0/0 .text CreateInit__10daSwhit0_cFv */ -void daSwhit0_c::CreateInit() { - // NONMATCHING +int daSwhit0_c::CreateInit() { + shape_angle.z = 0; + current.angle.z = 0; + + mColliderStts.Init(0xFF, 0xFF, this); + + attention_info.position.x += (cM_ssin(home.angle.x) * 95.0f) * cM_ssin(home.angle.y); + attention_info.position.y += cM_scos(home.angle.x) * 95.0f; + attention_info.position.z += (cM_ssin(home.angle.x) * 95.0f) * cM_scos(home.angle.y); + eyePos = attention_info.position; + + cXyz sp28; + mSph.Set(l_sph_src); + mSph.SetStts(&mColliderStts); + mSph.SetC(attention_info.position); + + if (fopAcM_isSwitch(this, getSwNo())) { + setActio(ACTION_ON_WAIT_e); + onFlag(1); + } else { + setActio(ACTION_OFF_WAIT_e); + offFlag(1); + } + + makeEventId(); + return 1; } /* 80486390-804863B0 000410 0020+00 1/1 0/0 0/0 .text CheckCreateHeap__FP10fopAc_ac_c */ -static void CheckCreateHeap(fopAc_ac_c* param_0) { - // NONMATCHING +static int CheckCreateHeap(fopAc_ac_c* i_this) { + return ((daSwhit0_c*)i_this)->CreateHeap(); } -/* ############################################################################################## */ -/* 80487388-80487388 000018 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_804873A1 = "WAIT"; -SECTION_DEAD static char const* const stringBase_804873A6 = "CHANGE"; -#pragma pop +/* 804863B0-804865B4 000430 0204+00 1/1 0/0 0/0 .text create__10daSwhit0_cFv */ +int daSwhit0_c::create() { + fopAcM_SetupActor(this, daSwhit0_c); -/* 80487400-80487408 -00001 0008+00 1/1 0/0 0/0 .data action_table$3953 */ -SECTION_DATA static void* action_table[2] = { - (void*)(((char*)&d_a_swhit0__stringBase0) + 0x19), - (void*)(((char*)&d_a_swhit0__stringBase0) + 0x1E), -}; + if (subtype != 0) { + setDrawMtx(); + cMtx_copy(mDoMtx_stack_c::get(), field_0x5a8); + fopAcM_SetMtx(this, field_0x5a8); + CreateInit(); + return cPhs_COMPLEATE_e; + } -/* 80487408-80487410 00004C 0008+00 1/1 0/0 0/0 .data l_color$localstatic3$draw__10daSwhit0_cFv */ -SECTION_DATA static u8 data_80487408[8] = { - 0x01, 0x00, 0x02, 0x03, 0x03, 0x02, 0x00, 0x01, -}; + int phase_state = dComIfG_resLoad(this, l_arcName); + if (phase_state == cPhs_COMPLEATE_e) { + if (!fopAcM_entrySolidHeap(this, CheckCreateHeap, 0xB30)) { + return cPhs_ERROR_e; + } -/* 80487410-8048743C -00001 002C+00 1/1 0/0 0/0 .data @4230 */ -SECTION_DATA static void* lit_4230[11] = { - (void*)(((char*)daSwhit0_Execute__FP10daSwhit0_c) + 0x40), - (void*)(((char*)daSwhit0_Execute__FP10daSwhit0_c) + 0x4C), - (void*)(((char*)daSwhit0_Execute__FP10daSwhit0_c) + 0x58), - (void*)(((char*)daSwhit0_Execute__FP10daSwhit0_c) + 0x64), - (void*)(((char*)daSwhit0_Execute__FP10daSwhit0_c) + 0x70), - (void*)(((char*)daSwhit0_Execute__FP10daSwhit0_c) + 0x7C), - (void*)(((char*)daSwhit0_Execute__FP10daSwhit0_c) + 0x88), - (void*)(((char*)daSwhit0_Execute__FP10daSwhit0_c) + 0x58), - (void*)(((char*)daSwhit0_Execute__FP10daSwhit0_c) + 0x64), - (void*)(((char*)daSwhit0_Execute__FP10daSwhit0_c) + 0x70), - (void*)(((char*)daSwhit0_Execute__FP10daSwhit0_c) + 0x7C), -}; + mpModel->setBaseScale(scale); + setDrawMtx(); + mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); + fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); + CreateInit(); + } + + return phase_state; +} + +/* 8048668C-80486704 00070C 0078+00 2/2 0/0 0/0 .text checkHit__10daSwhit0_cFv */ +bool daSwhit0_c::checkHit() { + if (dComIfGp_event_runCheck()) { + return false; + } + + if (cLib_calcTimer(&mHitWaitTimer) == 0 && mSph.ChkTgHit()) { + mHitWaitTimer = 8; + return true; + } + + return false; +} + +/* 80486704-80486788 000784 0084+00 1/1 0/0 0/0 .text setCombackTimer__10daSwhit0_cFv */ +void daSwhit0_c::setCombackTimer() { + if (getType() == 0 || getType() == 3) { + mCombackTimer = 0; + } else if (getTimer() != 0) { + mCombackTimer = getTimer() * 15; + } else { + mCombackTimer = 0; + } +} + +/* 80486788-80486800 000808 0078+00 1/1 0/0 0/0 .text endCombackTimer__10daSwhit0_cFv */ +int daSwhit0_c::endCombackTimer() { + if (mCombackTimer > 0) { + if (!fopAcM_isSwitch(this, getSwNo2()) && --mCombackTimer == 0) { + return 1; + } + } + + return 0; +} + +/* 80486800-80486858 000880 0058+00 4/4 0/0 0/0 .text onSwitch__10daSwhit0_cFv */ +void daSwhit0_c::onSwitch() { + fopAcM_onSwitch(this, getSwNo()); + onFlag(1); + setCombackTimer(); +} + +/* 80486858-804868A8 0008D8 0050+00 4/4 0/0 0/0 .text offSwitch__10daSwhit0_cFv */ +void daSwhit0_c::offSwitch() { + fopAcM_offSwitch(this, getSwNo()); + offFlag(1); +} + +/* 804868A8-804869C4 000928 011C+00 2/2 0/0 0/0 .text DemoProc__10daSwhit0_cFv */ +int daSwhit0_c::DemoProc() { + static char* action_table[2] = { + "WAIT", + "CHANGE", + }; + + if (dComIfGp_evmng_getIsAddvance(mStaffId)) { + int act_idx = dComIfGp_evmng_getMyActIdx(mStaffId, action_table, 2, 0, 0); + switch (act_idx) { + case 1: + if (fopAcM_isSwitch(this, getSwNo())) { + offSwitch(); + } else { + onSwitch(); + } + + fopAcM_seStart(this, Z2SE_OBJ_SHOCK_SW_ON, 0); + break; + } + } + + dComIfGp_evmng_cutEnd(mStaffId); + return 1; +} + +/* 804869C4-80486ABC 000A44 00F8+00 2/2 0/0 0/0 .text orderEvent__10daSwhit0_cFv */ +void daSwhit0_c::orderEvent() { + if (strcmp(dComIfGp_getStartStageName(), "D_MN06") == 0 && dComIfGp_getStartStageRoomNo() == 4 && fopAcM_isSwitch(this, 50) && fopAcM_isSwitch(this, 51)) { + fopAcM_orderOtherEventId(this, mEventId, getEvNo(), 0xFFFF, 0, 1); + } else { + fopAcM_orderMapToolAutoNextEvent(this, getEvNo(), mEventId, 0xFFFF, 1, 0); + } + + eventInfo.i_onCondition(2); +} + +/* 80486ABC-80486BC4 000B3C 0108+00 1/1 0/0 0/0 .text actionOffWait__10daSwhit0_cFv */ +int daSwhit0_c::actionOffWait() { + if (checkHit()) { + fopAcM_seStart(this, JA_SE_OBJ_HIT_SHOCK_SWITCH, 0); + + if (getType() != 3) { + if (mEventId == -1) { + setActio(ACTION_SW_WAIT_e); + mSwWaitTimer = 0; + } else { + setActio(ACTION_TO_ON_READY_e); + mReadyTimer = 5; + } + } + } else { + if (fopAcM_isSwitch(this, getSwNo())) { + setActio(ACTION_ON_WAIT_e); + onSwitch(); + } + } + + return 1; +} + +/* 80486BC4-80486C28 000C44 0064+00 1/1 0/0 0/0 .text actionToOnReady__10daSwhit0_cFv */ +int daSwhit0_c::actionToOnReady() { + if (dComIfGp_event_runCheck()) { + return 1; + } + + if (mReadyTimer != 0) { + mReadyTimer--; + } else { + mAction++; + setActio(mAction); + orderEvent(); + } + + return 1; +} + +/* 80486C28-80486CE4 000CA8 00BC+00 1/1 0/0 0/0 .text actionToOnOrder__10daSwhit0_cFv */ +int daSwhit0_c::actionToOnOrder() { + if (eventInfo.i_checkCommandDemoAccrpt()) { + if (dComIfGp_evmng_isMapToolCamera(getEvNo())) { + mReadyTimer = 6; + mAction += 2; + setActio(mAction); + } else { + mAction++; + setActio(mAction); + mStaffId = dComIfGp_evmng_getMyStaffId("SWITCH", NULL, 0); + DemoProc(); + } + } else { + orderEvent(); + } + + return 1; +} + +/* 80486CE4-80486D88 000D64 00A4+00 1/1 0/0 0/0 .text actionToOnDemo__10daSwhit0_cFv */ +int daSwhit0_c::actionToOnDemo() { + if (dComIfGp_evmng_endCheck(mEventId)) { + if (fopAcM_isSwitch(this, getSwNo())) { + setActio(ACTION_ON_WAIT_e); + } else { + setActio(ACTION_OFF_WAIT_e); + } + + dComIfGp_event_reset(); + return 1; + } + + DemoProc(); + return 1; +} + +/* 80486D88-80486EC4 000E08 013C+00 1/1 0/0 0/0 .text actionToOnDemo2__10daSwhit0_cFv */ +int daSwhit0_c::actionToOnDemo2() { + if (mReadyTimer != 0) { + mReadyTimer--; + if (mReadyTimer == 0) { + if (fopAcM_isSwitch(this, getSwNo())) { + offSwitch(); + } else { + onSwitch(); + } + + fopAcM_seStart(this, Z2SE_OBJ_SHOCK_SW_ON, 0); + } + } + + if (dComIfGp_evmng_endCheck(mEventId)) { + if (mAction == 5) { + setActio(ACTION_ON_WAIT_e); + onSwitch(); + } else { + setActio(ACTION_OFF_WAIT_e); + offSwitch(); + } + + dComIfGp_event_reset(); + return 1; + } + + return 1; +} + +/* 80486EC4-80486FC0 000F44 00FC+00 1/1 0/0 0/0 .text actionSwWait__10daSwhit0_cFv */ +int daSwhit0_c::actionSwWait() { + if (dComIfGp_event_runCheck()) { + return 0; + } + + if (++mSwWaitTimer > 30) { + if (!fopAcM_isSwitch(this, getSwNo())) { + setActio(ACTION_ON_WAIT_e); + onSwitch(); + } else { + setActio(ACTION_OFF_WAIT_e); + offSwitch(); + } + + fopAcM_seStart(this, Z2SE_OBJ_SHOCK_SW_ON, 0); + } + + return 1; +} + +/* 80486FC0-804870E0 001040 0120+00 1/1 0/0 0/0 .text actionOnWait__10daSwhit0_cFv */ +int daSwhit0_c::actionOnWait() { + if (!fopAcM_isSwitch(this, getSwNo()) || endCombackTimer()) { + offSwitch(); + setActio(ACTION_OFF_WAIT_e); + return 1; + } + + if (checkHit()) { + fopAcM_seStart(this, JA_SE_OBJ_HIT_SHOCK_SWITCH, 0); + + if (getType() != 0) { + if (mEventId == -1) { + setActio(ACTION_SW_WAIT_e); + mSwWaitTimer = 0; + } else { + setActio(ACTION_TOOL_TO_ON_READY_e); + mReadyTimer = 5; + } + return 1; + } + } + + return 1; +} + +/* 804870E0-80487138 001160 0058+00 1/1 0/0 0/0 .text setDrawMtx__10daSwhit0_cFv */ +void daSwhit0_c::setDrawMtx() { + mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z); + mDoMtx_stack_c::XYZrotM(current.angle.x, current.angle.y, current.angle.z); +} + +int daSwhit0_c::draw() { + g_env_light.settingTevStruct(16, ¤t.pos, &tevStr); + g_env_light.setLightTevColorType(mpModel, &tevStr); + + // each set of 2 colors represents an on/off state color + static u8 l_color[] = { + COLOR_BLUE, COLOR_YELLOW, + COLOR_RED, COLOR_GREEN, + COLOR_GREEN, COLOR_RED, + COLOR_YELLOW, COLOR_BLUE, + }; + + u8* color_p = l_color; + if (checkFlag(1)) { + color_p++; + } + + mBrk.setFrame(color_p[getType() * 2]); + + J3DModelData* modelData = mpModel->getModelData(); + mBck.entry(modelData); + mBrk.entry(modelData); + mDoExt_modelUpdateDL(mpModel); + return 1; +} + +/* 80487138-80487228 0011B8 00F0+00 1/0 0/0 0/0 .text daSwhit0_Draw__FP10daSwhit0_c */ +static int daSwhit0_Draw(daSwhit0_c* i_this) { + if (i_this->subtype != 0) { + return 1; + } + + return i_this->draw(); +} + +int daSwhit0_c::execute() { + switch (mAction) { + case ACTION_SW_WAIT_e: + actionSwWait(); + break; + case ACTION_OFF_WAIT_e: + actionOffWait(); + break; + case ACTION_TO_ON_READY_e: + case ACTION_TOOL_TO_ON_READY_e: + actionToOnReady(); + break; + case ACTION_TO_ON_ORDER_e: + case ACTION_TOOL_TO_ON_ORDER_e: + actionToOnOrder(); + break; + case ACTION_TO_ON_DEMO_e: + case ACTION_TOOL_TO_ON_DEMO_e: + actionToOnDemo(); + break; + case ACTION_TO_ON_DEMO2_e: + case ACTION_TOOL_TO_ON_DEMO2_e: + actionToOnDemo2(); + break; + case ACTION_ON_WAIT_e: + actionOnWait(); + break; + } + + return 1; +} + +/* 80487228-804872E4 0012A8 00BC+00 2/0 0/0 0/0 .text daSwhit0_Execute__FP10daSwhit0_c */ +static int daSwhit0_Execute(daSwhit0_c* i_this) { + i_this->mBck.play(); + i_this->execute(); + dComIfG_Ccsp()->Set(&i_this->mSph); + return 1; +} + +/* 804872E4-8048732C 001364 0048+00 1/0 0/0 0/0 .text daSwhit0_Delete__FP10daSwhit0_c */ +static int daSwhit0_Delete(daSwhit0_c* i_this) { + if (i_this->subtype == 0) { + dComIfG_resDelete(i_this, l_arcName); + } + + return 1; +} + +/* 8048732C-8048734C 0013AC 0020+00 1/0 0/0 0/0 .text daSwhit0_Create__FP10fopAc_ac_c */ +static int daSwhit0_Create(fopAc_ac_c* i_this) { + return ((daSwhit0_c*)i_this)->create(); +} /* 8048743C-8048745C -00001 0020+00 1/0 0/0 0/0 .data l_daSwhit0_Method */ static actor_method_class l_daSwhit0_Method = { - (process_method_func)daSwhit0_Create__FP10fopAc_ac_c, - (process_method_func)daSwhit0_Delete__FP10daSwhit0_c, - (process_method_func)daSwhit0_Execute__FP10daSwhit0_c, - 0, - (process_method_func)daSwhit0_Draw__FP10daSwhit0_c, + (process_method_func)daSwhit0_Create, + (process_method_func)daSwhit0_Delete, + (process_method_func)daSwhit0_Execute, + (process_method_func)NULL, + (process_method_func)daSwhit0_Draw, }; /* 8048745C-8048748C -00001 0030+00 0/0 0/0 1/0 .data g_profile_SWHIT0 */ @@ -246,179 +523,3 @@ extern actor_process_profile_definition g_profile_SWHIT0 = { fopAc_ACTOR_e, // mActorType fopAc_CULLBOX_0_e, // cullType }; - -/* 8048748C-80487498 0000D0 000C+00 2/2 0/0 0/0 .data __vt__8cM3dGSph */ -SECTION_DATA extern void* __vt__8cM3dGSph[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__8cM3dGSphFv, -}; - -/* 80487498-804874A4 0000DC 000C+00 2/2 0/0 0/0 .data __vt__8cM3dGAab */ -SECTION_DATA extern void* __vt__8cM3dGAab[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__8cM3dGAabFv, -}; - -/* 804874A4-804874B0 0000E8 000C+00 2/2 0/0 0/0 .data __vt__12J3DFrameCtrl */ -SECTION_DATA extern void* __vt__12J3DFrameCtrl[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12J3DFrameCtrlFv, -}; - -/* 804863B0-804865B4 000430 0204+00 1/1 0/0 0/0 .text create__10daSwhit0_cFv */ -void daSwhit0_c::create() { - // NONMATCHING -} - -/* 804865B4-804865FC 000634 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGSphFv */ -// cM3dGSph::~cM3dGSph() { -extern "C" void __dt__8cM3dGSphFv() { - // NONMATCHING -} - -/* 804865FC-80486644 00067C 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGAabFv */ -// cM3dGAab::~cM3dGAab() { -extern "C" void __dt__8cM3dGAabFv() { - // NONMATCHING -} - -/* 80486644-8048668C 0006C4 0048+00 1/0 0/0 0/0 .text __dt__12J3DFrameCtrlFv */ -// J3DFrameCtrl::~J3DFrameCtrl() { -extern "C" void __dt__12J3DFrameCtrlFv() { - // NONMATCHING -} - -/* 8048668C-80486704 00070C 0078+00 2/2 0/0 0/0 .text checkHit__10daSwhit0_cFv */ -void daSwhit0_c::checkHit() { - // NONMATCHING -} - -/* 80486704-80486788 000784 0084+00 1/1 0/0 0/0 .text setCombackTimer__10daSwhit0_cFv */ -void daSwhit0_c::setCombackTimer() { - // NONMATCHING -} - -/* 80486788-80486800 000808 0078+00 1/1 0/0 0/0 .text endCombackTimer__10daSwhit0_cFv */ -void daSwhit0_c::endCombackTimer() { - // NONMATCHING -} - -/* 80486800-80486858 000880 0058+00 4/4 0/0 0/0 .text onSwitch__10daSwhit0_cFv */ -void daSwhit0_c::onSwitch() { - // NONMATCHING -} - -/* 80486858-804868A8 0008D8 0050+00 4/4 0/0 0/0 .text offSwitch__10daSwhit0_cFv */ -void daSwhit0_c::offSwitch() { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 80487378-80487380 000008 0004+04 5/5 0/0 0/0 .rodata @3982 */ -SECTION_RODATA static f32 const lit_3982[1 + 1 /* padding */] = { - -1.0f, - /* padding */ - 0.0f, -}; -COMPILER_STRIP_GATE(0x80487378, &lit_3982); - -/* 804868A8-804869C4 000928 011C+00 2/2 0/0 0/0 .text DemoProc__10daSwhit0_cFv */ -void daSwhit0_c::DemoProc() { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 80487388-80487388 000018 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_804873AD = "D_MN06"; -#pragma pop - -/* 804869C4-80486ABC 000A44 00F8+00 2/2 0/0 0/0 .text orderEvent__10daSwhit0_cFv */ -void daSwhit0_c::orderEvent() { - // NONMATCHING -} - -/* 80486ABC-80486BC4 000B3C 0108+00 1/1 0/0 0/0 .text actionOffWait__10daSwhit0_cFv */ -void daSwhit0_c::actionOffWait() { - // NONMATCHING -} - -/* 80486BC4-80486C28 000C44 0064+00 1/1 0/0 0/0 .text actionToOnReady__10daSwhit0_cFv */ -void daSwhit0_c::actionToOnReady() { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 80487388-80487388 000018 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_804873B4 = "SWITCH"; -#pragma pop - -/* 80486C28-80486CE4 000CA8 00BC+00 1/1 0/0 0/0 .text actionToOnOrder__10daSwhit0_cFv */ -void daSwhit0_c::actionToOnOrder() { - // NONMATCHING -} - -/* 80486CE4-80486D88 000D64 00A4+00 1/1 0/0 0/0 .text actionToOnDemo__10daSwhit0_cFv */ -void daSwhit0_c::actionToOnDemo() { - // NONMATCHING -} - -/* 80486D88-80486EC4 000E08 013C+00 1/1 0/0 0/0 .text actionToOnDemo2__10daSwhit0_cFv */ -void daSwhit0_c::actionToOnDemo2() { - // NONMATCHING -} - -/* 80486EC4-80486FC0 000F44 00FC+00 1/1 0/0 0/0 .text actionSwWait__10daSwhit0_cFv */ -void daSwhit0_c::actionSwWait() { - // NONMATCHING -} - -/* 80486FC0-804870E0 001040 0120+00 1/1 0/0 0/0 .text actionOnWait__10daSwhit0_cFv */ -void daSwhit0_c::actionOnWait() { - // NONMATCHING -} - -/* 804870E0-80487138 001160 0058+00 1/1 0/0 0/0 .text setDrawMtx__10daSwhit0_cFv */ -void daSwhit0_c::setDrawMtx() { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 80487380-80487388 000010 0008+00 1/1 0/0 0/0 .rodata @4212 */ -SECTION_RODATA static u8 const lit_4212[8] = { - 0x43, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x80487380, &lit_4212); - -/* 80487138-80487228 0011B8 00F0+00 1/0 0/0 0/0 .text daSwhit0_Draw__FP10daSwhit0_c */ -static void daSwhit0_Draw(daSwhit0_c* param_0) { - // NONMATCHING -} - -/* 80487228-804872E4 0012A8 00BC+00 2/0 0/0 0/0 .text daSwhit0_Execute__FP10daSwhit0_c */ -static void daSwhit0_Execute(daSwhit0_c* param_0) { - // NONMATCHING -} - -/* 804872E4-8048732C 001364 0048+00 1/0 0/0 0/0 .text daSwhit0_Delete__FP10daSwhit0_c */ -static void daSwhit0_Delete(daSwhit0_c* param_0) { - // NONMATCHING -} - -/* 8048732C-8048734C 0013AC 0020+00 1/0 0/0 0/0 .text daSwhit0_Create__FP10fopAc_ac_c */ -static void daSwhit0_Create(fopAc_ac_c* param_0) { - // NONMATCHING -} - -/* 8048734C-80487368 0013CC 001C+00 1/1 0/0 0/0 .text cLib_calcTimer__FPUc */ -extern "C" void func_8048734C(void* _this, u8* param_0) { - // NONMATCHING -} - -/* 80487388-80487388 000018 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ diff --git a/src/d/actor/d_a_tag_allmato.cpp b/src/d/actor/d_a_tag_allmato.cpp index d793d7d9ab..4aead0e8b8 100644 --- a/src/d/actor/d_a_tag_allmato.cpp +++ b/src/d/actor/d_a_tag_allmato.cpp @@ -1,606 +1,624 @@ -// -// Generated By: dol2asm -// Translation Unit: d_a_tag_allmato -// - #include "d/actor/d_a_tag_allmato.h" -#include "dol2asm.h" - -// -// Types: -// - -struct fopAc_ac_c { - /* 80018B64 */ fopAc_ac_c(); - /* 80018C8C */ ~fopAc_ac_c(); -}; - -struct daTag_AllMato_c { - /* 80487538 */ void create(); - /* 804876B0 */ bool Delete(); - /* 804876B8 */ void Execute(); - /* 80487C5C */ bool Draw(); - /* 80487C64 */ void srchBouMato(void*, void*); - /* 80487D00 */ void srchItaMato(void*, void*); - /* 80487D9C */ void srchTaro(void*, void*); - /* 80487E38 */ void srchArrow(void*, void*); - /* 80487ED4 */ void isDelete(); - /* 80487F80 */ void entryBouMatoActors(); - /* 80488034 */ void entryItaMatoActors(); - /* 80488104 */ void getTaroActorP(); - /* 804881C0 */ void getArrowActorP(); - /* 80488238 */ void checkCrsMato(); - /* 80488994 */ void checkCrsMato2(); - /* 80488F40 */ void checkBrkMato(); - /* 80488FD8 */ void evtChange(u16); - /* 80489608 */ ~daTag_AllMato_c(); -}; - -struct Vec {}; - -struct cXyz { - /* 80266AE4 */ void operator+(Vec const&) const; - /* 80266B34 */ void operator-(Vec const&) const; - /* 80266B84 */ void operator*(f32) const; - /* 80487670 */ ~cXyz(); - /* 804876AC */ cXyz(); -}; - -struct daObj_ItaMato_c { - /* 804891BC */ void checkCrs(fopAc_ac_c*, cXyz, cXyz, f32); -}; - -struct daObj_BouMato_c { - /* 8048940C */ void checkCrs(fopAc_ac_c*, cXyz, cXyz, f32); -}; - -struct daNpcT_ActorMngr_c { - /* 801456D4 */ void initialize(); - /* 801456E0 */ void entry(fopAc_ac_c*); - /* 801456FC */ void remove(); - /* 80145708 */ void getActorP(); - /* 80489138 */ ~daNpcT_ActorMngr_c(); - /* 80489180 */ daNpcT_ActorMngr_c(); -}; - -struct daArrow_c { - /* 804895EC */ void getStartPos(); -}; - -struct dSv_info_c { - /* 80035360 */ void isSwitch(int, int) const; -}; - -struct dEvt_control_c { - /* 80042468 */ void reset(); - /* 80042518 */ void reset(void*); - /* 8004365C */ void setPt2(void*); -}; - -struct dEvent_manager_c { - /* 80046800 */ void setObjectArchive(char*); - /* 80047758 */ void getEventIdx(fopAc_ac_c*, char const*, u8); - /* 80047A78 */ void endCheck(s16); - /* 80047B1C */ void getMyStaffId(char const*, fopAc_ac_c*, int); - /* 80047D4C */ void getIsAddvance(int); - /* 80047E10 */ void getMyActIdx(int, char const* const*, int, int, int); - /* 8004817C */ void cutEnd(int); -}; - -struct dCamera_c { - /* 80174EAC */ void SaveZoomRatio(); -}; - -struct cM3dGSph { - /* 8026F664 */ void Set(cXyz const&, f32); - /* 804893C4 */ ~cM3dGSph(); -}; - -struct cM3dGLin { - /* 8026F2E8 */ void SetStartEnd(cXyz const&, cXyz const&); -}; - -struct cM3dGCyl { - /* 8026F180 */ void Set(cXyz const&, f32, f32); -}; - -// -// Forward References: -// - -extern "C" void create__15daTag_AllMato_cFv(); -extern "C" void __dt__4cXyzFv(); -extern "C" void __ct__4cXyzFv(); -extern "C" bool Delete__15daTag_AllMato_cFv(); -extern "C" void Execute__15daTag_AllMato_cFv(); -extern "C" bool Draw__15daTag_AllMato_cFv(); -extern "C" void srchBouMato__15daTag_AllMato_cFPvPv(); -extern "C" void srchItaMato__15daTag_AllMato_cFPvPv(); -extern "C" void srchTaro__15daTag_AllMato_cFPvPv(); -extern "C" void srchArrow__15daTag_AllMato_cFPvPv(); -extern "C" void isDelete__15daTag_AllMato_cFv(); -extern "C" void entryBouMatoActors__15daTag_AllMato_cFv(); -extern "C" void entryItaMatoActors__15daTag_AllMato_cFv(); -extern "C" void getTaroActorP__15daTag_AllMato_cFv(); -extern "C" void getArrowActorP__15daTag_AllMato_cFv(); -extern "C" void checkCrsMato__15daTag_AllMato_cFv(); -extern "C" void checkCrsMato2__15daTag_AllMato_cFv(); -extern "C" void checkBrkMato__15daTag_AllMato_cFv(); -extern "C" void evtChange__15daTag_AllMato_cFUs(); -extern "C" static void daTag_AllMato_Create__FPv(); -extern "C" static void daTag_AllMato_Delete__FPv(); -extern "C" static void daTag_AllMato_Execute__FPv(); -extern "C" static void daTag_AllMato_Draw__FPv(); -extern "C" static bool daTag_AllMato_IsDelete__FPv(); -extern "C" void __dt__18daNpcT_ActorMngr_cFv(); -extern "C" void __ct__18daNpcT_ActorMngr_cFv(); -extern "C" void checkCrs__15daObj_ItaMato_cFP10fopAc_ac_c4cXyz4cXyzf(); -extern "C" void __dt__8cM3dGSphFv(); -extern "C" void checkCrs__15daObj_BouMato_cFP10fopAc_ac_c4cXyz4cXyzf(); -extern "C" void getStartPos__9daArrow_cFv(); -extern "C" void __dt__15daTag_AllMato_cFv(); -extern "C" extern char const* const d_a_tag_allmato__stringBase0; - -// -// External References: -// - -extern "C" void __ct__10fopAc_ac_cFv(); -extern "C" void __dt__10fopAc_ac_cFv(); -extern "C" void fopAcM_delete__FP10fopAc_ac_c(); -extern "C" void fopAcM_orderChangeEventId__FP10fopAc_ac_csUsUs(); -extern "C" void fopAcM_orderOtherEventId__FP10fopAc_ac_csUcUsUsUs(); -extern "C" void fpcEx_Search__FPFPvPv_PvPv(); -extern "C" void fpcEx_IsExist__FUi(); -extern "C" void dComIfGs_wolfeye_effect_check__Fv(); -extern "C" void isSwitch__10dSv_info_cCFii(); -extern "C" void reset__14dEvt_control_cFv(); -extern "C" void reset__14dEvt_control_cFPv(); -extern "C" void setPt2__14dEvt_control_cFPv(); -extern "C" void setObjectArchive__16dEvent_manager_cFPc(); -extern "C" void getEventIdx__16dEvent_manager_cFP10fopAc_ac_cPCcUc(); -extern "C" void endCheck__16dEvent_manager_cFs(); -extern "C" void getMyStaffId__16dEvent_manager_cFPCcP10fopAc_ac_ci(); -extern "C" void getIsAddvance__16dEvent_manager_cFi(); -extern "C" void getMyActIdx__16dEvent_manager_cFiPCPCciii(); -extern "C" void cutEnd__16dEvent_manager_cFi(); -extern "C" void initialize__18daNpcT_ActorMngr_cFv(); -extern "C" void entry__18daNpcT_ActorMngr_cFP10fopAc_ac_c(); -extern "C" void remove__18daNpcT_ActorMngr_cFv(); -extern "C" void getActorP__18daNpcT_ActorMngr_cFv(); -extern "C" void daNpcT_chkEvtBit__FUl(); -extern "C" void daNpcT_onTmpBit__FUl(); -extern "C" void daNpcT_offTmpBit__FUl(); -extern "C" void daNpcF_chkEvtBit__FUl(); -extern "C" void SaveZoomRatio__9dCamera_cFv(); -extern "C" void dCam_getBody__Fv(); -extern "C" void __pl__4cXyzCFRC3Vec(); -extern "C" void __mi__4cXyzCFRC3Vec(); -extern "C" void __ml__4cXyzCFf(); -extern "C" void cM3d_Cross_LinSph__FPC8cM3dGLinPC8cM3dGSphP3Vec(); -extern "C" void cM3d_Cross_CylLin__FPC8cM3dGCylPC8cM3dGLinP3VecP3Vec(); -extern "C" void Set__8cM3dGCylFRC4cXyzff(); -extern "C" void SetStartEnd__8cM3dGLinFRC4cXyzRC4cXyz(); -extern "C" void Set__8cM3dGSphFRC4cXyzf(); -extern "C" void __dl__FPv(); -extern "C" void PSVECAdd(); -extern "C" void PSVECSquareMag(); -extern "C" void PSVECSquareDistance(); -extern "C" void __destroy_arr(); -extern "C" void __construct_array(); -extern "C" void _savegpr_18(); -extern "C" void _savegpr_22(); -extern "C" void _savegpr_26(); -extern "C" void _savegpr_27(); -extern "C" void _savegpr_28(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_18(); -extern "C" void _restgpr_22(); -extern "C" void _restgpr_26(); -extern "C" void _restgpr_27(); -extern "C" void _restgpr_28(); -extern "C" void _restgpr_29(); -extern "C" void strlen(); -extern "C" extern void* g_fopAc_Method[8]; -extern "C" extern void* g_fpcLf_Method[5 + 1 /* padding */]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; -extern "C" extern u32 __float_nan; -extern "C" extern u8 mStayNo__20dStage_roomControl_c[4]; -extern "C" extern f32 G_CM3D_F_ABS_MIN[1 + 1 /* padding */]; - -// -// Declarations: -// - -/* ############################################################################################## */ -/* 804896E4-804896E8 000000 0004+00 5/6 0/0 0/0 .rodata @4025 */ -SECTION_RODATA static f32 const lit_4025 = 100.0f; -COMPILER_STRIP_GATE(0x804896E4, &lit_4025); - -/* 8048973C-8048973C 000058 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_8048973C = ""; -SECTION_DEAD static char const* const stringBase_8048973D = "FOCUS_BOUMATO"; -SECTION_DEAD static char const* const stringBase_8048974B = "FOCUS_ITAMATO"; -SECTION_DEAD static char const* const stringBase_80489759 = "FOCUS_ITAMATO_ON_ROOF"; -SECTION_DEAD static char const* const stringBase_8048976F = "HIT_BOUMATO1"; -SECTION_DEAD static char const* const stringBase_8048977C = "HIT_BOUMATO2"; -SECTION_DEAD static char const* const stringBase_80489789 = "HIT_BOUMATO3"; -SECTION_DEAD static char const* const stringBase_80489796 = "NEARPIN_BOUMATO"; -SECTION_DEAD static char const* const stringBase_804897A6 = "Taro1"; -SECTION_DEAD static char const* const stringBase_804897AC = "Taro2"; -#pragma pop +#include "d/actor/d_a_obj_itamato.h" +#include "d/actor/d_a_obj_boumato.h" +#include "d/actor/d_a_arrow.h" /* 804897BC-804897FC -00001 0040+00 2/2 0/0 0/0 .data l_evtList */ -SECTION_DATA static void* l_evtList[16] = { - (void*)&d_a_tag_allmato__stringBase0, - (void*)NULL, - (void*)(((char*)&d_a_tag_allmato__stringBase0) + 0x1), - (void*)0x00000002, - (void*)(((char*)&d_a_tag_allmato__stringBase0) + 0xF), - (void*)0x00000002, - (void*)(((char*)&d_a_tag_allmato__stringBase0) + 0x1D), - (void*)0x00000002, - (void*)(((char*)&d_a_tag_allmato__stringBase0) + 0x33), - (void*)0x00000002, - (void*)(((char*)&d_a_tag_allmato__stringBase0) + 0x40), - (void*)0x00000002, - (void*)(((char*)&d_a_tag_allmato__stringBase0) + 0x4D), - (void*)0x00000002, - (void*)(((char*)&d_a_tag_allmato__stringBase0) + 0x5A), - (void*)0x00000002, +static daNpcT_evtData_c l_evtList[8] = { + {"", 0}, + {"FOCUS_BOUMATO", 2}, + {"FOCUS_ITAMATO", 2}, + {"FOCUS_ITAMATO_ON_ROOF", 2}, + {"HIT_BOUMATO1", 2}, + {"HIT_BOUMATO2", 2}, + {"HIT_BOUMATO3", 2}, + {"NEARPIN_BOUMATO", 2}, }; +#define EVT_NONE 0 +#define EVT_FOCUS_BOUMATO 1 +#define EVT_FOCUS_ITAMATO 2 +#define EVT_FOCUS_ITAMATO_ON_ROOF 3 +#define EVT_HIT_BOUMATO1 4 +#define EVT_HIT_BOUMATO2 5 +#define EVT_HIT_BOUMATO3 6 +#define EVT_NEARPIN_BOUMATO 7 + /* 804897FC-80489808 -00001 000C+00 2/2 0/0 0/0 .data l_resNameList */ -SECTION_DATA static void* l_resNameList[3] = { - (void*)&d_a_tag_allmato__stringBase0, - (void*)(((char*)&d_a_tag_allmato__stringBase0) + 0x6A), - (void*)(((char*)&d_a_tag_allmato__stringBase0) + 0x70), -}; - -/* 80489808-80489828 -00001 0020+00 1/0 0/0 0/0 .data daTag_AllMato_MethodTable */ -SECTION_DATA static void* daTag_AllMato_MethodTable[8] = { - (void*)daTag_AllMato_Create__FPv, - (void*)daTag_AllMato_Delete__FPv, - (void*)daTag_AllMato_Execute__FPv, - (void*)daTag_AllMato_IsDelete__FPv, - (void*)daTag_AllMato_Draw__FPv, - (void*)NULL, - (void*)NULL, - (void*)NULL, -}; - -/* 80489828-80489858 -00001 0030+00 0/0 0/0 1/0 .data g_profile_TAG_ALLMATO */ -SECTION_DATA extern void* g_profile_TAG_ALLMATO[12] = { - (void*)0xFFFFFFFD, (void*)0x000AFFFD, - (void*)0x030A0000, (void*)&g_fpcLf_Method, - (void*)0x00001D18, (void*)NULL, - (void*)NULL, (void*)&g_fopAc_Method, - (void*)0x01200000, (void*)&daTag_AllMato_MethodTable, - (void*)0x00044000, (void*)0x000E0000, -}; - -/* 80489858-80489864 00009C 000C+00 2/2 0/0 0/0 .data __vt__8cM3dGSph */ -SECTION_DATA extern void* __vt__8cM3dGSph[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__8cM3dGSphFv, -}; - -/* 80489864-80489870 0000A8 000C+00 4/4 0/0 0/0 .data __vt__18daNpcT_ActorMngr_c */ -SECTION_DATA extern void* __vt__18daNpcT_ActorMngr_c[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__18daNpcT_ActorMngr_cFv, -}; - -/* 80489870-8048987C 0000B4 000C+00 2/2 0/0 0/0 .data __vt__15daTag_AllMato_c */ -SECTION_DATA extern void* __vt__15daTag_AllMato_c[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__15daTag_AllMato_cFv, +static char* l_resNameList[3] = { + "", + "Taro1", + "Taro2", }; /* 80487538-80487670 000078 0138+00 1/1 0/0 0/0 .text create__15daTag_AllMato_cFv */ -void daTag_AllMato_c::create() { - // NONMATCHING -} +int daTag_AllMato_c::create() { + int var_r29 = 0; + fopAcM_SetupActor(this, daTag_AllMato_c); -/* 80487670-804876AC 0001B0 003C+00 2/2 0/0 0/0 .text __dt__4cXyzFv */ -cXyz::~cXyz() { - // NONMATCHING -} + scale.x *= 100.0f; + scale.y *= 100.0f; + scale.z = scale.x; -/* 804876AC-804876B0 0001EC 0004+00 1/1 0/0 0/0 .text __ct__4cXyzFv */ -cXyz::cXyz() { - /* empty function */ + mEventIdx = -1; + + OS_REPORT("\t(%s:%d) onEvt:%d, offEvt:%d, onSWBit:%02x, offSWBit:%02x<%08x>\n", + fopAcM_getProcNameString(this), + getType(), + getOnEvtBit(), + getOffEvtBit(), + getOnSwBit(), + getOffSwBit(), + fopAcM_GetParam(this)); + + if (isDelete()) { + return cPhs_ERROR_e; + } + + return cPhs_COMPLEATE_e; } /* 804876B0-804876B8 0001F0 0008+00 1/1 0/0 0/0 .text Delete__15daTag_AllMato_cFv */ -bool daTag_AllMato_c::Delete() { - return true; +int daTag_AllMato_c::Delete() { + return 1; } -/* ############################################################################################## */ -/* 8048973D-8048974B 000059 000E+00 2/0 0/0 0/0 .rodata None */ -extern "C" char const* const stringBase_8048973D; - -/* 8048974B-80489759 000067 000E+00 2/0 0/0 0/0 .rodata None */ -extern "C" char const* const stringBase_8048974B; - -/* 80489759-8048976F 000075 0016+00 2/0 0/0 0/0 .rodata None */ -extern "C" char const* const stringBase_80489759; - -/* 8048976F-8048977C 00008B 000D+00 2/0 0/0 0/0 .rodata None */ -extern "C" char const* const stringBase_8048976F; - -/* 8048977C-80489789 000098 000D+00 2/0 0/0 0/0 .rodata None */ -extern "C" char const* const stringBase_8048977C; - -/* 80489789-80489796 0000A5 000D+00 2/0 0/0 0/0 .rodata None */ -extern "C" char const* const stringBase_80489789; - -/* 80489796-804897A6 0000B2 0010+00 2/0 0/0 0/0 .rodata None */ -extern "C" char const* const stringBase_80489796; - -/* 804896E8-80489704 -00001 001C+00 1/1 0/0 0/0 .rodata @4071 */ -SECTION_RODATA static void* const lit_4071[7] = { - (void*)(((char*)&d_a_tag_allmato__stringBase0) + 0x1), - (void*)(((char*)&d_a_tag_allmato__stringBase0) + 0xF), - (void*)(((char*)&d_a_tag_allmato__stringBase0) + 0x1D), - (void*)(((char*)&d_a_tag_allmato__stringBase0) + 0x33), - (void*)(((char*)&d_a_tag_allmato__stringBase0) + 0x40), - (void*)(((char*)&d_a_tag_allmato__stringBase0) + 0x4D), - (void*)(((char*)&d_a_tag_allmato__stringBase0) + 0x5A), -}; -COMPILER_STRIP_GATE(0x804896E8, &lit_4071); - -/* 8048973C-8048973C 000058 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_804897B2 = "AllMato"; -#pragma pop - /* 804876B8-80487C5C 0001F8 05A4+00 1/1 0/0 0/0 .text Execute__15daTag_AllMato_cFv */ -void daTag_AllMato_c::Execute() { - // NONMATCHING +// NONMATCHING - issues with dComIfGp_getEventManager +int daTag_AllMato_c::Execute() { + camera_class* camera_p = NULL; + + if (home.roomNo == dComIfGp_roomControl_getStayNo()) { + fopAc_ac_c* actor_p = NULL; + + if (isDelete()) { + fopAcM_delete(this); + return 1; + } + + if (dComIfGp_event_runCheck()) { + if (!eventInfo.checkCommandTalk()) { + if (eventInfo.i_checkCommandDemoAccrpt() && dComIfGp_getEventManager().endCheck(mEventIdx)) { + u16 evt_action = EVT_NONE; + + switch (field_0x1d08) { + case 1: + case 2: + actor_p = mBrkMatoActorMngr.getActorP(); + JUT_ASSERT(164, 0 != actor_p); + + if (((daObj_BouMato_c*)actor_p)->getTgHitAcId() != fpcM_ERROR_PROCESS_ID_e) { + if (daNpcT_chkEvtBit(76)) { + if (daNpcT_chkEvtBit(75)) { + evt_action = EVT_HIT_BOUMATO3; + } else { + evt_action = EVT_HIT_BOUMATO2; + } + } else { + evt_action = EVT_HIT_BOUMATO1; + } + + if (field_0x1d0e != 0) { + daNpcT_onTmpBit(9); + } + } else { + evt_action = EVT_NEARPIN_BOUMATO; + daNpcT_onTmpBit(63); + } + + evtChange(evt_action); + ((daObj_BouMato_c*)actor_p)->clrTgHitAcId(); + field_0x1d08 = 0; + break; + default: + if (field_0x1d0e != 0) { + dComIfGp_setPlayerStatus0(0, 0x200000); + } + + dCam_getBody()->CorrectCenter(); + dComIfGp_event_reset(); + mEventIdx = -1; + } + } else { + int camera_id; + int staff_id = dComIfGp_getEventManager().getMyStaffId("AllMato", this, -1); + if (staff_id != -1) { + const char* act_list[7] = { + "FOCUS_BOUMATO", + "FOCUS_ITAMATO", + "FOCUS_ITAMATO_ON_ROOF", + "HIT_BOUMATO1", + "HIT_BOUMATO2", + "HIT_BOUMATO3", + "NEARPIN_BOUMATO", + }; + + if (dComIfGp_getEventManager().getIsAddvance(staff_id)) { + actor_p = mBrkMatoActorMngr.getActorP(); + JUT_ASSERT(218, 0 != actor_p); + + dComIfGp_getEvent().setPt2(mBrkMatoActorMngr.getActorP()); + + if (field_0x1d08 != 0) { + switch (field_0x1d08) { + case 1: + case 2: + camera_id = dComIfGp_getPlayerCameraID(0); + camera_p = dComIfGp_getCamera(camera_id); + JUT_ASSERT(228, 0 != camera_p); + + dComIfGp_saveCameraPosition(0, + fopCamM_GetCenter_p(camera_p), + fopCamM_GetEye_p(camera_p), + fopCamM_GetFovy(camera_p), + fopCamM_GetBank(camera_p)); + case 3: + case 4: + break; + } + } + } + + int act_idx = dComIfGp_getEventManager().getMyActIdx(staff_id, act_list, 7, 0, 0); + switch (act_idx) { + case 0: + if (!checkCrsMato2()) { + dComIfGp_getEventManager().cutEnd(staff_id); + } + break; + default: + dComIfGp_getEventManager().cutEnd(staff_id); + break; + } + } + } + } + } else { + if (field_0x1d0f == 0) { + entryBouMatoActors(); + entryItaMatoActors(); + field_0x1d0f = 1; + } + + field_0x1d08 = checkCrsMato(); + u16 evt_action = EVT_NONE; + + if (field_0x1d08 != 0) { + switch (field_0x1d08) { + case 1: + case 2: + if (field_0x1d10 == 0) { + dCam_getBody()->SaveZoomRatio(); + evt_action = EVT_FOCUS_BOUMATO; + } + break; + case 3: + actor_p = mBrkMatoActorMngr.getActorP(); + JUT_ASSERT(292, 0 != actor_p); + + if (field_0x1d10 == 0) { + switch (((daObj_ItaMato_c*)actor_p)->getNo()) { + case 1: + evt_action = EVT_FOCUS_ITAMATO; + daNpcT_onTmpBit(65); + break; + case 2: + evt_action = EVT_FOCUS_ITAMATO_ON_ROOF; + break; + } + } + + ((daObj_ItaMato_c*)actor_p)->onFake(); + } + } else { + field_0x1d08 = checkBrkMato(); + if (field_0x1d08 != 0) { + switch (field_0x1d08) { + case 4: + actor_p = mBrkMatoActorMngr.getActorP(); + JUT_ASSERT(320, 0 != actor_p) + + switch (((daObj_ItaMato_c*)actor_p)->getNo()) { + case 1: + evt_action = EVT_FOCUS_ITAMATO; + break; + case 2: + evt_action = EVT_FOCUS_ITAMATO_ON_ROOF; + break; + } + } + } + } + + mEventIdx = -1; + + if (getTaroActorP() != NULL && strlen(l_evtList[evt_action].eventName) != 0 && (!daNpcT_chkEvtBit(76) || !daNpcT_chkEvtBit(75) || evt_action == EVT_FOCUS_BOUMATO)) { + field_0x1d0e = dComIfGp_checkPlayerStatus0(0, 0x200000) != 0; + daNpcT_offTmpBit(64); + + if (strlen(l_resNameList[l_evtList[evt_action].num]) != 0) { + eventInfo.setArchiveName(l_resNameList[l_evtList[evt_action].num]); + dComIfGp_getEventManager().setObjectArchive(eventInfo.getArchiveName()); + } + + mEventIdx = dComIfGp_getEventManager().getEventIdx(this, l_evtList[evt_action].eventName, 0xFF); + fopAcM_orderOtherEventId(this, mEventIdx, 0xFF, 0xFFFF, 40, 1); + } + } + + attention_info.position = current.pos; + eyePos = current.pos; + + if (mEventIdx < 0) { + daNpcT_offTmpBit(9); + daNpcT_offTmpBit(63); + daNpcT_offTmpBit(65); + } + + return 1; + } + + return 0; } /* 80487C5C-80487C64 00079C 0008+00 1/1 0/0 0/0 .text Draw__15daTag_AllMato_cFv */ -bool daTag_AllMato_c::Draw() { - return true; +int daTag_AllMato_c::Draw() { + return 1; } -/* ############################################################################################## */ /* 80489880-80489A10 000000 0190+00 9/9 0/0 0/0 .bss l_findActorPtrs */ -static u8 l_findActorPtrs[400]; +static fopAc_ac_c* l_findActorPtrs[100]; /* 80489A10-80489A14 000190 0004+00 9/9 0/0 0/0 .bss l_findCount */ -static u8 l_findCount[4]; +static u32 l_findCount; /* 80487C64-80487D00 0007A4 009C+00 1/1 0/0 0/0 .text srchBouMato__15daTag_AllMato_cFPvPv */ -void daTag_AllMato_c::srchBouMato(void* param_0, void* param_1) { - // NONMATCHING +void* daTag_AllMato_c::srchBouMato(void* i_actor, void* i_data) { + if (l_findCount < 100 && i_actor != NULL && i_actor != i_data) { + if (fopAcM_IsExecuting(fopAcM_GetID(i_actor)) && fopAcM_GetName(i_actor) == PROC_OBJ_BOUMATO) { + l_findActorPtrs[l_findCount] = (fopAc_ac_c*)i_actor; + l_findCount++; + } + } + + return NULL; } /* 80487D00-80487D9C 000840 009C+00 1/1 0/0 0/0 .text srchItaMato__15daTag_AllMato_cFPvPv */ -void daTag_AllMato_c::srchItaMato(void* param_0, void* param_1) { - // NONMATCHING +void* daTag_AllMato_c::srchItaMato(void* i_actor, void* i_data) { + if (l_findCount < 100 && i_actor != NULL && i_actor != i_data) { + if (fopAcM_IsExecuting(fopAcM_GetID(i_actor)) && fopAcM_GetName(i_actor) == PROC_OBJ_ITAMATO) { + l_findActorPtrs[l_findCount] = (fopAc_ac_c*)i_actor; + l_findCount++; + } + } + + return NULL; } /* 80487D9C-80487E38 0008DC 009C+00 1/1 0/0 0/0 .text srchTaro__15daTag_AllMato_cFPvPv */ -void daTag_AllMato_c::srchTaro(void* param_0, void* param_1) { - // NONMATCHING +void* daTag_AllMato_c::srchTaro(void* i_actor, void* i_data) { + if (l_findCount < 100 && i_actor != NULL && i_actor != i_data) { + if (fopAcM_IsExecuting(fopAcM_GetID(i_actor)) && fopAcM_GetName(i_actor) == PROC_NPC_TARO) { + l_findActorPtrs[l_findCount] = (fopAc_ac_c*)i_actor; + l_findCount++; + } + } + + return NULL; } /* 80487E38-80487ED4 000978 009C+00 1/1 0/0 0/0 .text srchArrow__15daTag_AllMato_cFPvPv */ -void daTag_AllMato_c::srchArrow(void* param_0, void* param_1) { - // NONMATCHING +void* daTag_AllMato_c::srchArrow(void* i_actor, void* i_data) { + if (l_findCount < 100 && i_actor != NULL && i_actor != i_data) { + if (fopAcM_IsExecuting(fopAcM_GetID(i_actor)) && fopAcM_GetName(i_actor) == PROC_ARROW) { + l_findActorPtrs[l_findCount] = (fopAc_ac_c*)i_actor; + l_findCount++; + } + } + + return NULL; } /* 80487ED4-80487F80 000A14 00AC+00 2/2 0/0 0/0 .text isDelete__15daTag_AllMato_cFv */ -void daTag_AllMato_c::isDelete() { - // NONMATCHING +int daTag_AllMato_c::isDelete() { + BOOL rt = FALSE; + + if (getOffEvtBit() != 0xFFFFFFFF) { + if (daNpcF_chkEvtBit(getOffEvtBit())) { + rt = TRUE; + } + } + + if (getOffSwBit() != 0xFF) { + if (dComIfGs_isSwitch(getOffSwBit(), fopAcM_GetRoomNo(this))) { + rt = TRUE; + } + } + + return rt; } /* 80487F80-80488034 000AC0 00B4+00 1/1 0/0 0/0 .text entryBouMatoActors__15daTag_AllMato_cFv */ void daTag_AllMato_c::entryBouMatoActors() { - // NONMATCHING + for (int i = 0; i < 1; i++) { + mItaMatoActorMngr[i].remove(); + } + + mBouMatoActorNum = 0; + + l_findCount = 0; + fpcM_Search(srchBouMato, this); + + for (int i = 0; i < (int)l_findCount && i < 1; i++) { + mBouMatoActorMngr[i].entry(l_findActorPtrs[i]); + mBouMatoActorNum++; + } } /* 80488034-80488104 000B74 00D0+00 1/1 0/0 0/0 .text entryItaMatoActors__15daTag_AllMato_cFv */ void daTag_AllMato_c::entryItaMatoActors() { - // NONMATCHING + for (int i = 0; i < 2; i++) { + mItaMatoActorMngr[i].remove(); + } + + mItaMatoActorNum = 0; + + l_findCount = 0; + fpcM_Search(srchItaMato, this); + + for (int i = 0; i < (int)l_findCount && i < 2; i++) { + mItaMatoActorMngr[i].entry(l_findActorPtrs[i]); + mItaMatoActorNum++; + } } /* 80488104-804881C0 000C44 00BC+00 1/1 0/0 0/0 .text getTaroActorP__15daTag_AllMato_cFv */ -void daTag_AllMato_c::getTaroActorP() { - // NONMATCHING +fopAc_ac_c* daTag_AllMato_c::getTaroActorP() { + int var_r28 = 0; + l_findCount = 0; + fpcM_Search(srchTaro, this); + + for (int i = 0; i < (int)l_findCount; i++) { + daNpcT_c* actor_p = (daNpcT_c*)l_findActorPtrs[i]; + if (!actor_p->checkHide()) { + return l_findActorPtrs[i]; + } + } + + return NULL; } /* 804881C0-80488238 000D00 0078+00 2/2 0/0 0/0 .text getArrowActorP__15daTag_AllMato_cFv */ -void daTag_AllMato_c::getArrowActorP() { - // NONMATCHING + fopAc_ac_c* daTag_AllMato_c::getArrowActorP() { + int var_r28 = 0; + l_findCount = 0; + fpcM_Search(srchArrow, this); + + for (int i = 0; i < (int)l_findCount; i++) { + daArrow_c* actor_p = (daArrow_c*)l_findActorPtrs[i]; + if (actor_p->checkWait()) { + return l_findActorPtrs[i]; + } + } + + return NULL; } -/* ############################################################################################## */ -/* 80489704-8048970C 000020 0004+04 0/4 0/0 0/0 .rodata @4606 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_4606[4 + 4 /* padding */] = { - 0x00, - 0x00, - 0x00, - 0x00, - /* padding */ - 0x00, - 0x00, - 0x00, - 0x00, -}; -COMPILER_STRIP_GATE(0x80489704, &lit_4606); -#pragma pop - -/* 8048970C-80489714 000028 0008+00 0/4 0/0 0/0 .rodata @4607 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_4607[8] = { - 0x3F, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x8048970C, &lit_4607); -#pragma pop - -/* 80489714-8048971C 000030 0008+00 0/4 0/0 0/0 .rodata @4608 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_4608[8] = { - 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x80489714, &lit_4608); -#pragma pop - -/* 8048971C-80489724 000038 0008+00 0/4 0/0 0/0 .rodata @4609 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_4609[8] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x8048971C, &lit_4609); -#pragma pop - -/* 80489724-80489728 000040 0004+00 0/2 0/0 0/0 .rodata @4610 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4610 = -2.0f; -COMPILER_STRIP_GATE(0x80489724, &lit_4610); -#pragma pop - -/* 80489728-8048972C 000044 0004+00 0/2 0/0 0/0 .rodata @4611 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4611 = -100.0f; -COMPILER_STRIP_GATE(0x80489728, &lit_4611); -#pragma pop - -/* 8048972C-80489730 000048 0004+00 0/2 0/0 0/0 .rodata @4612 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4612 = 95.0f; -COMPILER_STRIP_GATE(0x8048972C, &lit_4612); -#pragma pop - /* 80488238-80488994 000D78 075C+00 1/1 0/0 0/0 .text checkCrsMato__15daTag_AllMato_cFv */ -void daTag_AllMato_c::checkCrsMato() { - // NONMATCHING + int daTag_AllMato_c::checkCrsMato() { + fopAc_ac_c* sp24 = NULL; + if (mArrowActorMngr.getActorP() == NULL) { + mArrowActorMngr.entry(getArrowActorP()); + } + + sp24 = mArrowActorMngr.getActorP(); + if (sp24 != NULL) { + mBrkMatoActorMngr.remove(); + if (cM3d_IsZero(sp24->speedF) == false) { + daArrow_c* arrow_p = (daArrow_c*)sp24; + + cXyz spA0(arrow_p->current.pos); + cXyz sp94(arrow_p->speed); + f32 var_f31 = arrow_p->getOutLengthRate(); + f32 var_f30 = arrow_p->gravity; + + mArrowActorMngr.remove(); + + field_0x1d10 = 0; + if (arrow_p->checkBombArrow()) { + field_0x1d10 = 1; + } + + field_0x590[0] = spA0; + field_0x590[1] = spA0 + (sp94 * var_f31); + + for (int i = 2; i < 500; i++) { + spA0 += sp94; + field_0x590[i] = spA0 + (sp94 * var_f31); + + if (arrow_p->getFlyMax() < spA0.abs(arrow_p->getStartPos()) || var_f30 < 0.0f) { + var_f30 = -2.0f; + sp94.y += var_f30; + if (sp94.y < -100.0f) { + sp94.y = -100.0f; + } + + var_f31 = arrow_p->getArrowOutLength() / sp94.abs(); + } + } + + fopAc_ac_c* boumato_actor_p = NULL; + fopAc_ac_c* itamato_actor_p = NULL; + + for (int i = 0; i < 499; i++) { + for (int j = 0; j < mBouMatoActorNum; j++) { + boumato_actor_p = mBouMatoActorMngr[j].getActorP(); + if (boumato_actor_p != NULL) { + int sp14 = ((daObj_BouMato_c*)boumato_actor_p)->checkCrs(arrow_p, field_0x590[i], field_0x590[i + 1], sp94.abs() + arrow_p->getArrowOutLength()); + if (sp14 != 0) { + mBrkMatoActorMngr.entry(mBouMatoActorMngr[j].getActorP()); + return sp14; + } + } + } + + for (int j = 0; j < mItaMatoActorNum; j++) { + itamato_actor_p = mItaMatoActorMngr[j].getActorP(); + if (itamato_actor_p != NULL) { + int sp14 = ((daObj_ItaMato_c*)itamato_actor_p)->checkCrs(arrow_p, field_0x590[i], field_0x590[i + 1], sp94.abs() + arrow_p->getArrowOutLength()); + if (sp14 != 0) { + mBrkMatoActorMngr.entry(mItaMatoActorMngr[j].getActorP()); + return sp14; + } + } + } + } + } + } + + return 0; } /* 80488994-80488F40 0014D4 05AC+00 1/1 0/0 0/0 .text checkCrsMato2__15daTag_AllMato_cFv */ -void daTag_AllMato_c::checkCrsMato2() { - // NONMATCHING +int daTag_AllMato_c::checkCrsMato2() { + fopAc_ac_c* sp28; + getArrowActorP(); + + for (int i = 0; i < (int)l_findCount; i++) { + sp28 = l_findActorPtrs[i]; + + if (cM3d_IsZero(sp28->speedF) == false) { + daArrow_c* arrow_p = (daArrow_c*)sp28; + + cXyz sp8C(arrow_p->current.pos); + cXyz sp80(arrow_p->speed); + f32 var_f31 = arrow_p->getOutLengthRate(); + f32 var_f30 = arrow_p->gravity; + + field_0x590[0] = sp8C; + field_0x590[1] = sp8C + (sp80 * var_f31); + + for (int i = 2; i < 500; i++) { + sp8C += sp80; + field_0x590[i] = sp8C + (sp80 * var_f31); + + if (arrow_p->getFlyMax() < sp8C.abs(arrow_p->getStartPos()) || var_f30 < 0.0f) { + var_f30 = -2.0f; + sp80.y += var_f30; + if (sp80.y < -100.0f) { + sp80.y = -100.0f; + } + + var_f31 = arrow_p->getArrowOutLength() / sp80.abs(); + } + } + + fopAc_ac_c* sp18 = NULL; + fopAc_ac_c* sp14 = NULL; + + for (int i = 0; i < 499; i++) { + for (int j = 0; j < mBouMatoActorNum; j++) { + sp18 = mBouMatoActorMngr[j].getActorP(); + if (sp18 != NULL) { + int sp14 = ((daObj_BouMato_c*)sp18)->checkCrs(arrow_p, field_0x590[i], field_0x590[i + 1], sp80.abs() + arrow_p->getArrowOutLength()); + if (sp14 != 0) { + mBrkMatoActorMngr.entry(mBouMatoActorMngr[j].getActorP()); + return sp14; + } + } + } + } + } + } + + return 0; } /* 80488F40-80488FD8 001A80 0098+00 1/1 0/0 0/0 .text checkBrkMato__15daTag_AllMato_cFv */ -void daTag_AllMato_c::checkBrkMato() { - // NONMATCHING +int daTag_AllMato_c::checkBrkMato() { + int rt = 0; + + for (int i = 0; i < mItaMatoActorNum; i++) { + daObj_ItaMato_c* actor_p = (daObj_ItaMato_c*)mItaMatoActorMngr[i].getActorP(); + rt = actor_p->checkBrk(); + if (rt != 0) { + mBrkMatoActorMngr.entry(mItaMatoActorMngr[i].getActorP()); + return rt; + } + } + + return 0; } /* 80488FD8-804890B0 001B18 00D8+00 1/1 0/0 0/0 .text evtChange__15daTag_AllMato_cFUs */ -void daTag_AllMato_c::evtChange(u16 param_0) { - // NONMATCHING +void daTag_AllMato_c::evtChange(u16 i_action) { + if (strlen(l_resNameList[l_evtList[i_action].num]) != 0) { + eventInfo.setArchiveName(l_resNameList[l_evtList[i_action].num]); + dComIfGp_getEventManager().setObjectArchive(eventInfo.getArchiveName()); + } + + mEventIdx = dComIfGp_getEventManager().getEventIdx(this, l_evtList[i_action].eventName, 0xFF); + dComIfGp_getEvent().reset(this); + fopAcM_orderChangeEventId(this, mEventIdx, 1, 0xFFFF); } /* 804890B0-804890D0 001BF0 0020+00 1/0 0/0 0/0 .text daTag_AllMato_Create__FPv */ -static void daTag_AllMato_Create(void* param_0) { - // NONMATCHING +static int daTag_AllMato_Create(void* i_this) { + return ((daTag_AllMato_c*)i_this)->create(); } /* 804890D0-804890F0 001C10 0020+00 1/0 0/0 0/0 .text daTag_AllMato_Delete__FPv */ -static void daTag_AllMato_Delete(void* param_0) { - // NONMATCHING +static int daTag_AllMato_Delete(void* i_this) { + return ((daTag_AllMato_c*)i_this)->Delete(); } /* 804890F0-80489110 001C30 0020+00 1/0 0/0 0/0 .text daTag_AllMato_Execute__FPv */ -static void daTag_AllMato_Execute(void* param_0) { - // NONMATCHING +static int daTag_AllMato_Execute(void* i_this) { + return ((daTag_AllMato_c*)i_this)->Execute(); } /* 80489110-80489130 001C50 0020+00 1/0 0/0 0/0 .text daTag_AllMato_Draw__FPv */ -static void daTag_AllMato_Draw(void* param_0) { - // NONMATCHING +static int daTag_AllMato_Draw(void* i_this) { + return ((daTag_AllMato_c*)i_this)->Draw(); } /* 80489130-80489138 001C70 0008+00 1/0 0/0 0/0 .text daTag_AllMato_IsDelete__FPv */ -static bool daTag_AllMato_IsDelete(void* param_0) { - return true; +static int daTag_AllMato_IsDelete(void* i_this) { + return 1; } -/* 80489138-80489180 001C78 0048+00 3/2 0/0 0/0 .text __dt__18daNpcT_ActorMngr_cFv */ -void __dt__18daNpcT_ActorMngr_cFv() { - // NONMATCHING -} +/* 80489808-80489828 -00001 0020+00 1/0 0/0 0/0 .data daTag_AllMato_MethodTable */ +static actor_method_class daTag_AllMato_MethodTable = { + (process_method_func)daTag_AllMato_Create, + (process_method_func)daTag_AllMato_Delete, + (process_method_func)daTag_AllMato_Execute, + (process_method_func)daTag_AllMato_IsDelete, + (process_method_func)daTag_AllMato_Draw +}; -/* 80489180-804891BC 001CC0 003C+00 1/1 0/0 0/0 .text __ct__18daNpcT_ActorMngr_cFv */ -daNpcT_ActorMngr_c::daNpcT_ActorMngr_c() { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 80489730-80489734 00004C 0004+00 0/1 0/0 0/0 .rodata @4688 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4688 = 10.0f; -COMPILER_STRIP_GATE(0x80489730, &lit_4688); -#pragma pop - -/* 804891BC-804893C4 001CFC 0208+00 1/1 0/0 0/0 .text - * checkCrs__15daObj_ItaMato_cFP10fopAc_ac_c4cXyz4cXyzf */ -void daObj_ItaMato_c::checkCrs(fopAc_ac_c* param_0, cXyz param_1, cXyz param_2, f32 param_3) { - // NONMATCHING -} - -/* 804893C4-8048940C 001F04 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGSphFv */ -cM3dGSph::~cM3dGSph() { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 80489734-80489738 000050 0004+00 0/1 0/0 0/0 .rodata @4752 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4752 = 120.0f; -COMPILER_STRIP_GATE(0x80489734, &lit_4752); -#pragma pop - -/* 80489738-8048973C 000054 0004+00 0/1 0/0 0/0 .rodata @4753 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4753 = 30.0f; -COMPILER_STRIP_GATE(0x80489738, &lit_4753); -#pragma pop - -/* 8048940C-804895EC 001F4C 01E0+00 2/2 0/0 0/0 .text - * checkCrs__15daObj_BouMato_cFP10fopAc_ac_c4cXyz4cXyzf */ -void daObj_BouMato_c::checkCrs(fopAc_ac_c* param_0, cXyz param_1, cXyz param_2, f32 param_3) { - // NONMATCHING -} - -/* 804895EC-80489608 00212C 001C+00 2/2 0/0 0/0 .text getStartPos__9daArrow_cFv */ -void daArrow_c::getStartPos() { - // NONMATCHING -} - -/* 80489608-804896DC 002148 00D4+00 1/0 0/0 0/0 .text __dt__15daTag_AllMato_cFv */ -daTag_AllMato_c::~daTag_AllMato_c() { - // NONMATCHING -} - -/* 8048973C-8048973C 000058 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ +/* 80489828-80489858 -00001 0030+00 0/0 0/0 1/0 .data g_profile_TAG_ALLMATO */ +extern actor_process_profile_definition g_profile_TAG_ALLMATO = { + fpcLy_CURRENT_e, // mLayerID + 10, // mListID + fpcPi_CURRENT_e, // mListPri + PROC_TAG_ALLMATO, // mProcName + &g_fpcLf_Method.base, // sub_method + sizeof(daTag_AllMato_c), // mSize + 0, // mSizeOther + 0, // mParameters + &g_fopAc_Method.base, // sub_method + 288, // mPriority + &daTag_AllMato_MethodTable, // sub_method + 0x44000, // mStatus + fopAc_ACTOR_e, // mActorType + fopAc_CULLBOX_CUSTOM_e, // cullType +}; diff --git a/src/d/actor/d_a_tag_wljump.cpp b/src/d/actor/d_a_tag_wljump.cpp index 4cc02f64ed..af57b01111 100644 --- a/src/d/actor/d_a_tag_wljump.cpp +++ b/src/d/actor/d_a_tag_wljump.cpp @@ -1,156 +1,112 @@ -// -// Generated By: dol2asm -// Translation Unit: d_a_tag_wljump -// - #include "d/actor/d_a_tag_wljump.h" -#include "dol2asm.h" #include "d/d_path.h" #include "d/d_procname.h" #include "d/actor/d_a_player.h" #include "d/actor/d_a_midna.h" -#include "JSystem/JKernel/JKRHeap.h" -// -// Types: -// - -// -// Forward References: -// - -extern "C" void create__13daTagWljump_cFv(); -extern "C" static void daTagWljump_Create__FP10fopAc_ac_c(); -extern "C" void __dt__13daTagWljump_cFv(); -extern "C" static void daTagWljump_Delete__FP13daTagWljump_c(); -extern "C" void execute__13daTagWljump_cFv(); -extern "C" static void daTagWljump_Execute__FP13daTagWljump_c(); -extern "C" bool draw__13daTagWljump_cFv(); -extern "C" static void daTagWljump_Draw__FP13daTagWljump_c(); - -// -// External References: -// - -extern "C" void __ct__10fopAc_ac_cFv(); -extern "C" void __dt__10fopAc_ac_cFv(); -extern "C" void isTransformLV__21dSv_player_status_b_cCFi(); -extern "C" void isEventBit__11dSv_event_cCFUs(); -extern "C" void onSwitch__10dSv_info_cFii(); -extern "C" void isSwitch__10dSv_info_cCFii(); -extern "C" void reset__14dEvt_control_cFv(); -extern "C" void dPath_GetRoomPath__Fii(); -extern "C" void request__10dAttHint_cFP10fopAc_ac_ci(); -extern "C" void __ct__10dMsgFlow_cFv(); -extern "C" void __dt__10dMsgFlow_cFv(); -extern "C" void init__10dMsgFlow_cFP10fopAc_ac_ciiPP10fopAc_ac_c(); -extern "C" void doFlow__10dMsgFlow_cFP10fopAc_ac_cPP10fopAc_ac_ci(); -extern "C" void seStart__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc(); -extern "C" void __dl__FPv(); -extern "C" void _savegpr_26(); -extern "C" void _restgpr_26(); -extern "C" u8 m_midnaActor__9daPy_py_c[4]; -extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */]; - -// -// Declarations: -// /* 80D64EB8-80D64FE4 000078 012C+00 1/1 0/0 0/0 .text create__13daTagWljump_cFv */ int daTagWljump_c::create() { fopAcM_SetupActor(this, daTagWljump_c); - u32 param = (fopAcM_GetParam(this) >> 8) & 0xff; - field_0x571 = (u8)param; - s32 uVar2 = fopAcM_GetParam(this); - if ((uVar2 & 0xff) == 0xff) { + + field_0x571 = (fopAcM_GetParam(this) >> 8) & 0xFF; + + int path_no = fopAcM_GetParam(this) & 0xFF; + if (path_no == 0xFF) { return 5; } - field_0x5c4 = dPath_GetRoomPath(uVar2 & 0xff, fopAcM_GetRoomNo(this)); + field_0x5c4 = dPath_GetRoomPath(path_no, fopAcM_GetRoomNo(this)); if (field_0x5c4 == NULL || field_0x5c4->m_num < 2) { - return 5; + return cPhs_ERROR_e; } - attention_info.distances[fopAc_attn_LOCK_e] = 0x32; - attention_info.distances[fopAc_attn_ETC_e] = 0x32; + attention_info.distances[fopAc_attn_LOCK_e] = 50; + attention_info.distances[fopAc_attn_ETC_e] = 50; + shape_angle.z = 0; field_0x568 = -1; - field_0x56c[0] = (fopAcM_GetParam(this) >> 16) & 0xf; - if (field_0x56c[0] != 1) { - field_0x56c[0] = 0; + + field_0x56c = (fopAcM_GetParam(this) >> 16) & 0xF; + if (field_0x56c != 1) { + field_0x56c = 0; } - if (field_0x56c[0] == 0 && field_0x571 != 0xff) { - if (dComIfGs_isSwitch(field_0x571, fopAcM_GetHomeRoomNo(this)) == 0) { + + if (field_0x56c == 0 && field_0x571 != 0xFF) { + if (!fopAcM_isSwitch(this, field_0x571)) { field_0x573 = 1; } } - return 4; + + return cPhs_COMPLEATE_e; } /* 80D64FE4-80D65004 0001A4 0020+00 1/0 0/0 0/0 .text daTagWljump_Create__FP10fopAc_ac_c */ -static int daTagWljump_Create(fopAc_ac_c* param_0) { - return ((daTagWljump_c*)param_0)->create(); +static int daTagWljump_Create(fopAc_ac_c* i_this) { + daTagWljump_c* a_this = (daTagWljump_c*)i_this; + fpc_ProcID id = fopAcM_GetID(i_this); + + return a_this->create(); } /* 80D65004-80D65068 0001C4 0064+00 1/1 0/0 0/0 .text __dt__13daTagWljump_cFv */ -daTagWljump_c::~daTagWljump_c() { -} +daTagWljump_c::~daTagWljump_c() {} /* 80D65068-80D65090 000228 0028+00 1/0 0/0 0/0 .text daTagWljump_Delete__FP13daTagWljump_c */ -static int daTagWljump_Delete(daTagWljump_c* param_0) { - param_0->~daTagWljump_c(); +static int daTagWljump_Delete(daTagWljump_c* i_this) { + fpc_ProcID id = fopAcM_GetID(i_this); + + i_this->~daTagWljump_c(); return 1; } -/* ############################################################################################## */ - /* 80D65090-80D6587C 000250 07EC+00 1/1 0/0 0/0 .text execute__13daTagWljump_cFv */ -// NONMATCHING - reg swap +// NONMATCHING - reg swap (regs match on debug, probably an inline issue) int daTagWljump_c::execute() { attention_info.flags = 0; - if (field_0x56c[1]) { - field_0x56c[1]--; + + if (field_0x56d) { + field_0x56d--; } - daPy_py_c* linkPlayer = daPy_getLinkPlayerActorClass(); - daMidna_c* midnaActor = daPy_py_c::getMidnaActor(); - - if (midnaActor == NULL) { + dStage_dPnt_c* point_p; + + daPy_py_c* player = daPy_getLinkPlayerActorClass(); + daMidna_c* midna = daPy_py_c::getMidnaActor(); + if (midna == NULL) { return 1; } if (eventInfo.checkCommandTalk()) { - s32 bVar2 = 1; - if (!midnaActor->checkShadowModeTalkWait()) { - if (shape_angle.x != 0 && - (field_0x571 == 0xff || - !fopAcM_isSwitch(this, field_0x571))) - { - if (field_0x56c[3] == 0) { - mMsgFlow.init(this, shape_angle.x & 0xffff, 0, NULL); - field_0x56c[3] = 1; - mDoAud_seStart(0x10, 0, 0, 0); + BOOL spC = TRUE; + if (!midna->checkShadowModeTalkWait()) { + if (shape_angle.x != 0 && (field_0x571 == 0xff || !fopAcM_isSwitch(this, field_0x571))) { + if (field_0x56f == 0) { + mMsgFlow.init(this, shape_angle.x & 0xFFFF, 0, NULL); + field_0x56f = 1; + mDoAud_seStart(Z2SE_NAVI_TALK_START, NULL, 0, 0); } else { - ; if (mMsgFlow.doFlow(this, NULL, 0)) { - mDoAud_seStart(0x11, 0, 0, 0); + mDoAud_seStart(Z2SE_NAVI_TALK_END, NULL, 0, 0); shape_angle.x = 0; } } } else { field_0x568 = field_0x570; - if (midnaActor->current.pos.abs(eyePos) < 5.0f) { - bVar2 = 0; + if (midna->current.pos.abs(eyePos) < 5.0f) { + spC = FALSE; } } } - if (bVar2) { + + if (spC) { return 1; } - field_0x56c[3] = 0; + + field_0x56f = 0; dComIfGp_event_reset(); - field_0x56c[0] = 0; + field_0x56c = 0; field_0x572 = 1; if (field_0x571 != 0xff) { fopAcM_onSwitch(this, field_0x571); @@ -158,7 +114,7 @@ int daTagWljump_c::execute() { } else if (!dComIfGp_getEvent().isOrderOK()) { field_0x572 = 0; } else { - if (!midnaActor->checkWolfNoPos()) { + if (!midna->checkWolfNoPos()) { field_0x574++; if (field_0x574 >= 5) { field_0x572 = 0; @@ -168,40 +124,40 @@ int daTagWljump_c::execute() { } } - if (!linkPlayer->i_checkNowWolf() || - !daPy_py_c::i_checkFirstMidnaDemo() || - midnaActor->i_checkMidnaTired()) { + if (!player->i_checkNowWolf() || !daPy_py_c::i_checkFirstMidnaDemo() || midna->i_checkMidnaTired()) { return 1; } + if (field_0x571 != 0xff && fopAcM_isSwitch(this, field_0x571)) { - field_0x56c[0] = 0; + field_0x56c = 0; if (field_0x573) { field_0x573 = 0; field_0x572 = 1; field_0x574 = 0; } } - if (field_0x56c[0] != 0 || field_0x572 != 0 || field_0x571 == 0xff || - fopAcM_isSwitch(this, field_0x571)) - { - s32 uVar6; - dStage_dPnt_c* pbVar7 = field_0x5c4->m_points; - if (linkPlayer->checkWolfTagLockJumpLand() == 0) { - if (linkPlayer->checkWolfTagLockJump() == 0) { - for (uVar6 = 0; uVar6 < field_0x5c4->m_num; uVar6++, pbVar7++) { - if (linkPlayer->current.pos.abs2(pbVar7->m_position) < pbVar7->field_0x0 * pbVar7->field_0x0 * 10.0f * 10.0f) { - field_0x56a = uVar6; - if (uVar6 == 0) { + + if (field_0x56c != 0 || field_0x572 != 0 || field_0x571 == 0xff || fopAcM_isSwitch(this, field_0x571)) { + int var_r28; + point_p = field_0x5c4->m_points; + + if (!player->checkWolfTagLockJumpLand()) { + if (!player->checkWolfTagLockJump()) { + for (var_r28 = 0; var_r28 < field_0x5c4->m_num; var_r28++, point_p++) { + if (player->current.pos.abs2(point_p->m_position) < point_p->field_0x0 * point_p->field_0x0 * 10.0f * 10.0f) { + field_0x56a = var_r28; + if (var_r28 == 0) { field_0x568 = 1; - } else if (uVar6 == field_0x5c4->m_num - 1) { - field_0x568 = uVar6 - 1; + } else if (var_r28 == field_0x5c4->m_num - 1) { + field_0x568 = var_r28 - 1; } else { - field_0x568 = uVar6 + 1; + field_0x568 = var_r28 + 1; } break; } } - if (uVar6 == field_0x5c4->m_num) { + + if (var_r28 == field_0x5c4->m_num) { field_0x568 = -1; } } else if (mNextCheckFlg) { @@ -216,32 +172,38 @@ int daTagWljump_c::execute() { } } } + if (field_0x568 >= 0) { - dStage_dPnt_c* pPoint = &field_0x5c4->m_points[field_0x568]; - eyePos.set(pPoint->m_position.x, pPoint->m_position.y, pPoint->m_position.z); + point_p = &field_0x5c4->m_points[field_0x568]; + + eyePos.set(point_p->m_position.x, point_p->m_position.y, point_p->m_position.z); attention_info.position = eyePos; attention_info.position.y += 220.0f; - mLandArea = pPoint->mArg0 * 10.0f; - if (pPoint->field_0x1 == 1) { + + mLandArea = point_p->mArg0 * 10.0f; + + if (point_p->field_0x1 == 1) { shape_angle.z = 1; } else { shape_angle.z = 0; } + if (field_0x572 == 0) { - if (!g_dComIfG_gameInfo.play.getEvent().runCheck()) { + if (!dComIfGp_event_runCheck()) { eventInfo.i_onCondition(dEvtCnd_CANTALK_e); - if (!linkPlayer->checkPlayerFly() && - linkPlayer->eventInfo.chkCondition(dEvtCnd_CANTALK_e)) { - dComIfGp_att_ZHintRequest(this, 0x1ff); - if (field_0x56c[2] == 0) { - field_0x56c[2] = 1; - if (field_0x56c[1] == 0) { - mDoAud_seStart(0xe, 0, 0, 0); + if (!player->checkPlayerFly() && player->eventInfo.chkCondition(dEvtCnd_CANTALK_e)) { + dComIfGp_att_ZHintRequest(this, 0x1FF); + + if (field_0x56e == 0) { + field_0x56e = 1; + if (field_0x56d == 0) { + mDoAud_seStart(Z2SE_NAVI_CALLVOICE, 0, 0, 0); } - field_0x56c[1] = 0x3c; + field_0x56d = 60; } } } + field_0x570 = field_0x568; field_0x568 = -1; } else { @@ -254,17 +216,19 @@ int daTagWljump_c::execute() { field_0x572 = 0; field_0x568 = -1; } + current.pos = attention_info.position; + if (!eventInfo.chkCondition(dEvtCnd_CANTALK_e)) { - field_0x56c[2] = 0; + field_0x56e = 0; } return 1; } /* 80D6587C-80D6589C 000A3C 0020+00 1/0 0/0 0/0 .text daTagWljump_Execute__FP13daTagWljump_c */ -static int daTagWljump_Execute(daTagWljump_c* param_0) { - return param_0->execute(); +static int daTagWljump_Execute(daTagWljump_c* i_this) { + return i_this->execute(); } /* 80D6589C-80D658A4 000A5C 0008+00 1/1 0/0 0/0 .text draw__13daTagWljump_cFv */ @@ -274,11 +238,10 @@ int daTagWljump_c::draw() { /* 80D658A4-80D658C4 000A64 0020+00 1/0 0/0 0/0 .text daTagWljump_Draw__FP13daTagWljump_c */ -static int daTagWljump_Draw(daTagWljump_c* param_0) { - return param_0->draw(); +static int daTagWljump_Draw(daTagWljump_c* i_this) { + return i_this->draw(); } -/* ############################################################################################## */ /* 80D65914-80D65934 -00001 0020+00 1/0 0/0 0/0 .data l_daTagWljump_Method */ static actor_method_class l_daTagWljump_Method = { (process_method_func)daTagWljump_Create, diff --git a/src/d/actor/d_a_title.cpp b/src/d/actor/d_a_title.cpp index 3f41bd59df..6be3f83e8f 100644 --- a/src/d/actor/d_a_title.cpp +++ b/src/d/actor/d_a_title.cpp @@ -1,12 +1,3 @@ -// -// Generated By: dol2asm -// Translation Unit: d_a_title -// - -// -// Issues with ~dDlst_daTitle_c appearing after create rather than end of TU -// - #include "d/actor/d_a_title.h" #include "d/d_demo.h" #include "d/d_pane_class_alpha.h" @@ -26,7 +17,6 @@ /* 80D67D8C-80D67DA8 000014 001C+00 4/4 0/0 0/0 .bss g_daTitHIO */ static daTit_HIO_c g_daTitHIO; -/* ############################################################################################## */ /* 80D67BD4-80D67BE0 000000 000C+00 2/2 0/0 0/0 .rodata @3772 */ static u8 const lit_3772[12] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -35,23 +25,7 @@ static u8 const lit_3772[12] = { /* 80D67BE0-80D67BE8 00000C 0006+02 3/3 0/0 0/0 .rodata l_arcName */ static char const l_arcName[6] = "Title"; -/* 80D67C40-80D67C4C 000000 000C+00 1/1 0/0 0/0 .data cNullVec__6Z2Calc */ -static u8 cNullVec__6Z2Calc[12] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -/* 80D67C4C-80D67C60 00000C 0004+10 0/0 0/0 0/0 .data @1787 */ -#pragma push -#pragma force_active on -static u32 lit_1787[1 + 4 /* padding */] = { - 0x02000201, - /* padding */ - 0x40080000, - 0x00000000, - 0x3FE00000, - 0x00000000, -}; -#pragma pop +UNK_REL_DATA; static procFunc daTitleProc[6] = { &daTitle_c::loadWait_proc, &daTitle_c::logoDispWait, &daTitle_c::logoDispAnm, @@ -300,7 +274,6 @@ void daTitle_c::fastLogoDisp() { /* 80D676F4-80D67768 000CD4 0074+00 1/1 0/0 0/0 .text getDemoPrm__9daTitle_cFv */ int daTitle_c::getDemoPrm() { - // NONMATCHING dDemo_actor_c* demoActor = dDemo_c::getActor(demoActorID); dDemo_prm_c* prm; if (demoActor != NULL && demoActor->checkEnable(1) &&