summaryrefslogtreecommitdiff
path: root/include/d/col/c
diff options
context:
space:
mode:
authorElijah Thomas <42302100+elijah-thomas774@users.noreply.github.com>2024-10-16 09:00:47 -0400
committerGitHub <noreply@github.com>2024-10-16 09:00:47 -0400
commitb5aa43ff3780ad11350c3c2efc7a705280818f6c (patch)
tree3a10d436d90a59fb4a4fc38cc4af0c5cbe29b923 /include/d/col/c
parentec4d28cd259fd1f452f716ca032d936a62f79393 (diff)
Misc Collision (#51)
* Initial Commit - Starting to translate from TP * Collision Updates * Actor Collision -> dBgW (DZB Collision) * bg .text splits complete * fix errors * file organization * missed files * progress * weee * most of cM3dG * Revert mAng change * Progress * Progress -> Need to update from main * Fixup Merge * d_bg_s symbols.... * TList Changes * oops * d_bg_s large progress * d_bg_s_acch majority done * d_bg_s_chk OK * d_bg_s_gnd_chk OK * d_bg_s_grp_pass_chk OK * d_bg_lin_chk OK * d_bg_s_poly_pass_chk OK * d_bg_s_roof_chk and d_bg_s_sph_chk OK * d_bg_s_spl_grp_chk OK * d_bg_s_wtr_chk OK * d_bg_w started * d_bg_w_base OK * name d_bg_w_kcol symbols * d_bg_w_sv split/started * most of d_bg_w_time * stopping d_bg_w_kcol for now * d_bg_w_sv OK * work on d_bg_w_time * revert TList to take offset arg * fixup some compiler warnings * set c_bg_w OK * Update rel_sieve.py * Remove TList Macros * Bomb Header started
Diffstat (limited to 'include/d/col/c')
-rw-r--r--include/d/col/c/c_bg_s_chk.h74
-rw-r--r--include/d/col/c/c_bg_s_gnd_chk.h41
-rw-r--r--include/d/col/c/c_bg_s_lin_chk.h65
-rw-r--r--include/d/col/c/c_bg_s_poly_info.h62
-rw-r--r--include/d/col/c/c_bg_s_shdw_draw.h33
-rw-r--r--include/d/col/c/c_bg_w.h62
-rw-r--r--include/d/col/c/c_cc_d.h4
-rw-r--r--include/d/col/c/c_cc_s.h60
-rw-r--r--include/d/col/c/c_m2d.h8
-rw-r--r--include/d/col/c/c_m3d.h106
-rw-r--r--include/d/col/c/c_m3d_g_aab.h87
-rw-r--r--include/d/col/c/c_m3d_g_cir.h35
-rw-r--r--include/d/col/c/c_m3d_g_cps.h38
-rw-r--r--include/d/col/c/c_m3d_g_cyl.h30
-rw-r--r--include/d/col/c/c_m3d_g_lin.h67
-rw-r--r--include/d/col/c/c_m3d_g_pla.h58
-rw-r--r--include/d/col/c/c_m3d_g_sph.h38
-rw-r--r--include/d/col/c/c_m3d_g_tri.h25
-rw-r--r--include/d/col/c/c_m3d_g_unk.h52
-rw-r--r--include/d/col/c/c_partition.h36
20 files changed, 981 insertions, 0 deletions
diff --git a/include/d/col/c/c_bg_s_chk.h b/include/d/col/c/c_bg_s_chk.h
new file mode 100644
index 00000000..c7acf88f
--- /dev/null
+++ b/include/d/col/c/c_bg_s_chk.h
@@ -0,0 +1,74 @@
+#ifndef C_BG_S_CHK_H
+#define C_BG_S_CHK_H
+
+#include "d/col/bg/d_bg_w_base.h"
+#include "d/col/c/c_partition.h"
+#include "f/f_base.h"
+#include "rvl/MTX.h"
+
+struct cBgD_Vtx_t : public nw4r::math::VEC3 {};
+
+class cBgS_GrpPassChk {
+public:
+ cBgS_GrpPassChk();
+ virtual ~cBgS_GrpPassChk();
+};
+
+class cBgS_PolyPassChk;
+
+class cBgS_Chk {
+public:
+ /* 0x00 */ cBgS_PolyPassChk *mPolyPassChk;
+ /* 0x04 */ cBgS_GrpPassChk *mGrpPassChk;
+ /* 0x08 */ u32 mActorId;
+ /* 0x0C */ u16 mField_0x0C;
+ /* 0x0E */ u16 mField_0x0E;
+ /* 0x10 */ u8 mField_0x10;
+ /* 0x14 */ cPartition mPartition;
+ /* 0x24 */ // __vtable__
+
+public:
+ cBgS_Chk();
+ virtual ~cBgS_Chk();
+ void SetActorID(u32 *);
+
+ void SetPolyPassChk(cBgS_PolyPassChk *p_chk) {
+ mPolyPassChk = p_chk;
+ }
+ void SetGrpPassChk(cBgS_GrpPassChk *p_chk) {
+ mGrpPassChk = p_chk;
+ }
+ cBgS_PolyPassChk *GetPolyPassChk() const {
+ return mPolyPassChk;
+ }
+ cBgS_GrpPassChk *GetGrpPassChk() const {
+ return mGrpPassChk;
+ }
+
+ int ChkSameActorPid(const fBase_c *pActor) const {
+ int id = pActor ? pActor->unique_ID : 0;
+ if (id == 0 || mActorId == 0 || mField_0x10 == 0) {
+ return false;
+ }
+ return mActorId == id ? 1 : 0;
+ }
+
+ bool ChkField_0xC(const dBgW_Base *pBg) const {
+ return mField_0x0C & pBg->GetField_0x20();
+ }
+
+ bool ChkField_0xE(const dBgW_Base *pBg) const {
+ return mField_0x0E & pBg->GetField_0x22();
+ }
+
+ void SetExtChk(const cBgS_Chk &other) {
+ mPolyPassChk = other.mPolyPassChk;
+ mGrpPassChk = other.mGrpPassChk;
+ mActorId = other.mActorId;
+ mField_0x10 = other.mField_0x10;
+ mField_0x0C = other.mField_0x0C;
+ mField_0x0E = other.mField_0x0E;
+ }
+};
+
+#endif
diff --git a/include/d/col/c/c_bg_s_gnd_chk.h b/include/d/col/c/c_bg_s_gnd_chk.h
new file mode 100644
index 00000000..05e8489f
--- /dev/null
+++ b/include/d/col/c/c_bg_s_gnd_chk.h
@@ -0,0 +1,41 @@
+#ifndef C_BG_S_GND_CHK_H
+#define C_BG_S_GND_CHK_H
+
+#include "d/col/c/c_bg_s_chk.h"
+#include "d/col/c/c_bg_s_poly_info.h"
+#include "m/m_vec.h"
+
+class cBgS_GndChk : public cBgS_Chk, public cBgS_PolyInfo {
+public:
+ /* 0x54 */ mVec3_c mPos;
+ /* 0x60 */ f32 mNowY;
+ /* 0x64 */ u8 unk0x64[0x68 - 0x64];
+ /* 0x68 */ mVec3_c mField_0x68;
+ /* 0x74 */ u8 mField_0x74;
+
+ cBgS_GndChk();
+ virtual ~cBgS_GndChk();
+ void SetPos(mVec3_c const &);
+ void SetPos(mVec3_c const *);
+
+ f32 GetNowY() const {
+ return mNowY;
+ }
+ void SetNowY(f32 y) {
+ mNowY = y;
+ }
+ const mVec3_c &GetPointP() {
+ return mPos;
+ }
+ void SetField_0x68(const mVec3_c &other) {
+ mField_0x68 = other;
+ }
+ // u32 GetWallPrecheck() const {
+ // return mWallPrecheck;
+ // }
+ // void OffWall() {
+ // mFlags &= ~2;
+ // }
+};
+
+#endif
diff --git a/include/d/col/c/c_bg_s_lin_chk.h b/include/d/col/c/c_bg_s_lin_chk.h
new file mode 100644
index 00000000..4d5e8141
--- /dev/null
+++ b/include/d/col/c/c_bg_s_lin_chk.h
@@ -0,0 +1,65 @@
+#ifndef C_BG_S_LIN_CHK_H
+#define C_BG_S_LIN_CHK_H
+
+#include "d/col/c/c_bg_s_chk.h"
+#include "d/col/c/c_bg_s_poly_info.h"
+#include "d/col/c/c_m3d_g_lin.h"
+
+class cBgS_LinChk : public cBgS_Chk, public cBgS_PolyInfo {
+public:
+ /* 0x54 */ cM3dGLin mLin;
+ /* 0x6C */ mVec3_c mField_0x6C;
+ /* 0x78 */ bool mFrontFlag;
+ /* 0x79 */ bool mBackFlag;
+ /* 0x7A */ bool mHit;
+ /* 0x7B */ bool mPreRoofChk;
+ /* 0x7C */ bool mPreWallChk;
+ /* 0x7D */ bool mPreGroundChk;
+
+ cBgS_LinChk();
+ virtual ~cBgS_LinChk();
+ virtual void SetEnd(const mVec3_c *);
+
+ void Ct();
+ void Set2(const mVec3_c &, const mVec3_c &, u32);
+
+ bool ChkHit() const {
+ return mHit;
+ }
+ void ClrHit() {
+ mHit = false;
+ }
+ void SetHit() {
+ mHit = true;
+ }
+ bool ChkBackFlag() const {
+ return mBackFlag;
+ }
+ void OnBackFlag() {
+ mBackFlag = true;
+ }
+ bool ChkFrontFlag() const {
+ return mFrontFlag;
+ }
+ void OnFrontFlag() {
+ mFrontFlag = true;
+ }
+ bool GetPreWallChk() const {
+ return mPreWallChk;
+ }
+ bool GetPreGroundChk() const {
+ return mPreGroundChk;
+ }
+ bool GetPreRoofChk() const {
+ return mPreRoofChk;
+ }
+
+ const mVec3_c &GetLinStart() const {
+ return mLin.mStart;
+ }
+ const mVec3_c &GetLinEnd() const {
+ return mLin.mEnd;
+ }
+};
+
+#endif
diff --git a/include/d/col/c/c_bg_s_poly_info.h b/include/d/col/c/c_bg_s_poly_info.h
new file mode 100644
index 00000000..7ab2943f
--- /dev/null
+++ b/include/d/col/c/c_bg_s_poly_info.h
@@ -0,0 +1,62 @@
+#ifndef C_BG_S_POLY_INFO_H
+#define C_BG_S_POLY_INFO_H
+
+#include "common.h"
+#include "d/col/c/c_bg_w.h"
+#include "d/col/c/c_m3d_g_pla.h"
+#include "m/m_vec.h"
+
+class cBgS_PolyInfo {
+private:
+ /* 0x00 */ int mPolyIndex;
+ /* 0x04 */ int mBgIndex;
+ /* 0x08 */ void *unk_0x04; // Collision Pointer?
+ /* 0x0C */ int mActorPId; // Matched the Unique Actor Id
+ /* 0x10 */ cM3dGPla mPla;
+ /* 0x20 */ mVec3_c mField_0x20;
+
+public:
+ cBgS_PolyInfo() {
+ ClearPi();
+ }
+ bool ChkSetInfo() const;
+ void SetPolyInfo(const cBgS_PolyInfo &);
+ bool ChkSafe(const void *, s32) const;
+ void SetPolyIndex(int idx) {
+ mPolyIndex = idx;
+ }
+ bool ChkBgIndex() const;
+ mAng GetAngle(mAng) const;
+
+ void SetActorInfo(int bgIndex, void *pData, u32 actor_pid) {
+ mBgIndex = bgIndex;
+ unk_0x04 = pData;
+ mActorPId = actor_pid;
+ }
+
+ void ClearPi() {
+ mPolyIndex = 0xFFFF;
+ mBgIndex = BG_ID_MAX;
+ unk_0x04 = nullptr;
+ mActorPId = 0;
+ }
+
+ u32 GetPolyIndex() const {
+ return mPolyIndex;
+ }
+ u32 GetBgIndex() const {
+ return mBgIndex;
+ }
+ const cM3dGPla &GetPlane() const {
+ return mPla;
+ }
+ cM3dGPla *GetPlaneP() {
+ return &mPla;
+ }
+
+ const mVec3_c &GetField0x20() const {
+ return mField_0x20;
+ }
+};
+
+#endif
diff --git a/include/d/col/c/c_bg_s_shdw_draw.h b/include/d/col/c/c_bg_s_shdw_draw.h
new file mode 100644
index 00000000..2018d720
--- /dev/null
+++ b/include/d/col/c/c_bg_s_shdw_draw.h
@@ -0,0 +1,33 @@
+#ifndef C_BG_S_SHDW_DRAW_H
+#define C_BG_S_SHDW_DRAW_H
+
+#include "common.h"
+#include "d/col/c/c_bg_s_chk.h"
+#include "d/col/c/c_m3d_g_lin.h"
+#include "d/col/c/c_m3d_g_pla.h"
+#include "d/col/c/c_m3d_g_tri.h"
+#include "m/m_vec.h"
+
+class cBgS_ShdwDraw;
+typedef void (*cBgS_ShdwDraw_Callback)(cBgS_ShdwDraw *, const mVec3_c &, const mVec3_c &, const mVec3_c &, const cM3dGTri &);
+
+class cBgS_ShdwDraw : public cBgS_Chk {
+public:
+ /* 0x28 */ cM3dGAab mBnd;
+ /* 0x40 */ cM3dGPla *mpPla;
+ /* 0x44 */ cBgS_ShdwDraw_Callback mpCallback;
+
+ cBgS_ShdwDraw();
+ virtual ~cBgS_ShdwDraw();
+
+ void Set(const mVec3_c &, const mVec3_c &);
+ void SetCallback(cBgS_ShdwDraw_Callback);
+ void SetP(cM3dGPla *);
+ void Calc(cM3dGTri *, mVec3_c *, mVec3_c *, mVec3_c *);
+
+ cM3dGAab *GetBndP() {
+ return &mBnd;
+ }
+};
+
+#endif
diff --git a/include/d/col/c/c_bg_w.h b/include/d/col/c/c_bg_w.h
new file mode 100644
index 00000000..54898265
--- /dev/null
+++ b/include/d/col/c/c_bg_w.h
@@ -0,0 +1,62 @@
+#ifndef C_BG_W_H
+#define C_BG_W_H
+
+#include "common.h"
+
+enum {
+ BG_ID_MAX = 600
+};
+
+class cBgW_BgId {
+private:
+ /* 0x0 */ s16 m_id;
+ /* 0x4 vtable */
+
+public:
+ cBgW_BgId();
+ void Ct() {
+ m_id = BG_ID_MAX;
+ };
+
+ void Regist(int);
+ void Release();
+ bool ChkUsed() const;
+
+ virtual ~cBgW_BgId();
+
+ s16 GetId() const {
+ return m_id;
+ }
+};
+
+// Defines are required for these checks to not inline some float comp bool things
+#if 1
+
+#define cBgW_CheckBGround(f) (f > 0.5f)
+#define cBgW_CheckBRoof(f) (f < (-4.0f / 5.0f))
+
+inline bool cBgW_CheckBWall(f32 a1) {
+ if (!cBgW_CheckBGround(a1) && !cBgW_CheckBRoof(a1)) {
+ return true;
+ }
+
+ return false;
+}
+
+#else
+inline bool cBgW_CheckBGround(f32 f) {
+ return f > 0.5f;
+}
+inline bool cBgW_CheckBRoof(f32 a1) {
+ return a1 <= (-4.0f / 5.0f);
+}
+inline bool cBgW_CheckBWall(f32 a1) {
+ if (!cBgW_CheckBGround(a1) && !cBgW_CheckBRoof(a1)) {
+ return true;
+ }
+
+ return false;
+}
+#endif
+
+#endif
diff --git a/include/d/col/c/c_cc_d.h b/include/d/col/c/c_cc_d.h
new file mode 100644
index 00000000..be4685be
--- /dev/null
+++ b/include/d/col/c/c_cc_d.h
@@ -0,0 +1,4 @@
+#ifndef C_CC_D_H
+#define C_CC_D_H
+
+#endif
diff --git a/include/d/col/c/c_cc_s.h b/include/d/col/c/c_cc_s.h
new file mode 100644
index 00000000..9eccad82
--- /dev/null
+++ b/include/d/col/c/c_cc_s.h
@@ -0,0 +1,60 @@
+#ifndef C_CC_S_H
+#define C_CC_S_H
+
+#include "d/col/c/c_cc_d.h"
+
+enum WeightType {
+ WeightType_0 = 0,
+ WeightType_1 = 1,
+ WeightType_2 = 2,
+};
+
+// class cCcS {
+// public:
+// /* 0x0000 */ cCcD_Obj *mpObjAt[0x100];
+// /* 0x0400 */ cCcD_Obj *mpObjTg[0x300];
+// /* 0x1000 */ cCcD_Obj *mpObjCo[0x100];
+// /* 0x1400 */ cCcD_Obj *mpObj[0x500];
+// /* 0x2800 */ u16 mObjAtCount;
+// /* 0x2802 */ u16 mObjTgCount;
+// /* 0x2804 */ u16 mObjCoCount;
+// /* 0x2806 */ u16 mObjCount;
+// /* 0x2808 */ cCcD_DivideArea mDivideArea;
+// /* 0x2848 vtable */
+
+// /* 80264A6C */ cCcS();
+// /* 80264A94 */ void Ct();
+// /* 80264B60 */ void Dt();
+// /* 80264B80 */ WeightType GetWt(u8) const;
+// /* 80264BA8 */ void Set(cCcD_Obj *);
+// /* 80264C5C */ void ClrCoHitInf();
+// /* 80264CF0 */ void ClrTgHitInf();
+// /* 80264D90 */ void ClrAtHitInf();
+// /* 80264E2C */ bool ChkNoHitAtTg(cCcD_Obj *, cCcD_Obj *);
+// /* 80264F40 */ void ChkAtTg();
+// /* 8026515C */ bool ChkNoHitCo(cCcD_Obj *, cCcD_Obj *);
+// /* 80265230 */ void ChkCo();
+// /* 802653A0 vt[2] */ virtual void CalcTgPlusDmg(cCcD_Obj *, cCcD_Obj *, cCcD_Stts *, cCcD_Stts *);
+// /* 802653C8 */ void SetAtTgCommonHitInf(cCcD_Obj *, cCcD_Obj *, cXyz *);
+// /* 802655E4 */ void SetCoCommonHitInf(cCcD_Obj *, cXyz *, cCcD_Obj *, cXyz *, f32);
+// /* 80265750 vt[3]*/ virtual void SetPosCorrect(cCcD_Obj *, cXyz *, cCcD_Obj *, cXyz *, f32);
+// /* 80265BB4 */ void CalcArea();
+// /* 80265CCC */ void Move();
+// /* 80265D30 */ void DrawClear();
+// /* 80265DF8 vt[4] */ virtual void
+// SetCoGObjInf(bool, bool, cCcD_GObjInf *, cCcD_GObjInf *, cCcD_Stts *, cCcD_Stts *, cCcD_GStts *, cCcD_GStts *);
+// /* 80265DFC vt[5] */ virtual void
+// SetAtTgGObjInf(bool, bool, cCcD_Obj *, cCcD_Obj *, cCcD_GObjInf *, cCcD_GObjInf *, cCcD_Stts *, cCcD_Stts *,
+// cCcD_GStts *, cCcD_GStts *, cXyz *);
+// /* 80265E00 vt[6] */ virtual bool
+// ChkNoHitGAtTg(cCcD_GObjInf const *, cCcD_GObjInf const *, cCcD_GStts *, cCcD_GStts *);
+// /* 80265E08 vt[7] */ virtual bool
+// ChkAtTgHitAfterCross(bool, bool, cCcD_GObjInf const *, cCcD_GObjInf const *, cCcD_Stts *, cCcD_Stts *, cCcD_GStts *,
+// cCcD_GStts *);
+// /* 80265E10 vt[8] */ virtual bool ChkNoHitGCo(cCcD_Obj *, cCcD_Obj *);
+// /* 80030BDC vt[9] */ virtual ~cCcS() {}
+// /* 80265E18 vt[10] */ virtual void MoveAfterCheck();
+// /* 80265DF4 vt[11] */ virtual void SetCoGCorrectProc(cCcD_Obj *, cCcD_Obj *);
+// }; // Size = 0x284C
+
+#endif /* C_CC_S_H */
diff --git a/include/d/col/c/c_m2d.h b/include/d/col/c/c_m2d.h
new file mode 100644
index 00000000..559f565c
--- /dev/null
+++ b/include/d/col/c/c_m2d.h
@@ -0,0 +1,8 @@
+#ifndef C_M2D_H
+#define C_M2D_H
+
+struct cM2dGCir;
+
+void cM2d_CrossCirLin(cM2dGCir &, float, float, float, float, float *, float *);
+
+#endif
diff --git a/include/d/col/c/c_m3d.h b/include/d/col/c/c_m3d.h
new file mode 100644
index 00000000..65a1cbf0
--- /dev/null
+++ b/include/d/col/c/c_m3d.h
@@ -0,0 +1,106 @@
+#ifndef C_M3D_H
+#define C_M3D_H
+
+#include "nw4r/math.h"
+
+#include <common.h>
+#include <math.h>
+
+class cM3dGAab;
+class cM3dGCps;
+class cM3dGCyl;
+class cM3dGLin;
+class cM3dGPla;
+class cM3dGSph;
+class cM3dGTri;
+class cM3dGUnk;
+class mAng3_c;
+struct cM3d_Range;
+
+struct nw4r::math::VEC3;
+
+extern const f32 G_CM3D_F_ABS_MIN;
+
+bool cM3d_Len2dSqPntAndSegLine(f32, f32, f32, f32, f32, f32, f32 *, f32 *, f32 *);
+bool cM3d_Len3dSqPntAndSegLine(const cM3dGLin *, const nw4r::math::VEC3 *, nw4r::math::VEC3 *, f32 *, f32 *);
+f32 cM3d_SignedLenPlaAndPos(const cM3dGPla *, const nw4r::math::VEC3 *);
+void cM3d_CalcPla(const nw4r::math::VEC3 *, const nw4r::math::VEC3 *, const nw4r::math::VEC3 *, nw4r::math::VEC3 *, f32 *);
+int cM3d_Check_LinLin(const cM3dGLin *, const cM3dGLin *, f32 *, f32 *);
+bool cM3d_Cross_LinPla(const cM3dGLin *, const cM3dGPla *, nw4r::math::VEC3 *, bool, bool);
+bool cM3d_Cross_MinMaxBoxLine(const nw4r::math::VEC3 *, const nw4r::math::VEC3 *, const nw4r::math::VEC3 *, const nw4r::math::VEC3 *);
+bool cM3d_InclusionCheckPosIn3PosBox3d(
+ const nw4r::math::VEC3 *, const nw4r::math::VEC3 *, const nw4r::math::VEC3 *, const nw4r::math::VEC3 *, f32
+);
+bool cM3d_CrossX_Tri(const cM3dGTri *, const nw4r::math::VEC3 *, f32);
+bool cM3d_CrossX_Tri(const cM3dGTri *, const nw4r::math::VEC3 *);
+bool cM3d_CrossY_Tri(const cM3dGTri *, const nw4r::math::VEC3 *);
+bool cM3d_CrossY_Tri_Front(const nw4r::math::VEC3 &, const nw4r::math::VEC3 &, const nw4r::math::VEC3 &, const nw4r::math::VEC3 *);
+bool cM3d_CrossY_Tri(const cM3dGTri *, const nw4r::math::VEC3 *, f32 *);
+bool cM3d_CrossY_Tri(const cM3dGTri *, const nw4r::math::VEC3 *, f32);
+bool cM3d_CrossY_Tri(const cM3dGTri *, const nw4r::math::VEC3 *, const cM3d_Range *, f32 *);
+bool cM3d_CrossZ_Tri(const cM3dGTri *, const nw4r::math::VEC3 *, f32);
+bool cM3d_CrossZ_Tri(const cM3dGTri *, const nw4r::math::VEC3 *);
+bool cM3d_CrossZ_Tri(const cM3dGTri *, const nw4r::math::VEC3 *, f32 *);
+bool cM3d_Cross_LinTri(const cM3dGLin *, const cM3dGTri *, nw4r::math::VEC3 *, bool, bool);
+bool cM3d_Cross_LinTri(
+ const cM3dGLin *, const nw4r::math::VEC3 *, const nw4r::math::VEC3 *, const nw4r::math::VEC3 *, const cM3dGPla *,
+ nw4r::math::VEC3 *, bool, bool
+);
+bool cM3d_Cross_LinTri_Easy(const cM3dGTri *, const nw4r::math::VEC3 *);
+bool cM3d_Cross_SphPnt(const cM3dGSph *, const nw4r::math::VEC3 *);
+bool cM3d_Cross_LinSph(const cM3dGLin *, const cM3dGSph *, nw4r::math::VEC3 *);
+bool cM3d_Cross_LinSph_CrossPos(const cM3dGSph &, const cM3dGLin &, nw4r::math::VEC3 *, nw4r::math::VEC3 *);
+bool cM3d_Cross_CylSph(const cM3dGCyl *, const cM3dGSph *, f32 *);
+bool cM3d_Cross_CylSph(const cM3dGCyl *, const cM3dGSph *, nw4r::math::VEC3 *, f32 *);
+bool cM3d_Cross_SphSph(const cM3dGSph *, const cM3dGSph *, f32 *);
+bool cM3d_Cross_SphSph(const cM3dGSph *, const cM3dGSph *, f32 *, f32 *);
+bool cM3d_Cross_SphSph(const cM3dGSph *, const cM3dGSph *, nw4r::math::VEC3 *);
+void cM3d_CalcSphVsTriCrossPoint(const cM3dGSph *, const cM3dGTri *, nw4r::math::VEC3 *);
+bool cM3d_Cross_SphTri(const cM3dGSph *, const cM3dGTri *, nw4r::math::VEC3 *, f32 *, nw4r::math::VEC3 *);
+bool cM3d_Cross_CylCyl(const cM3dGCyl *, const cM3dGCyl *, f32 *);
+bool cM3d_Cross_CylCyl(const cM3dGCyl *, const cM3dGCyl *, nw4r::math::VEC3 *);
+bool cM3d_Cross_CylTri(const cM3dGCyl *, const cM3dGTri *, nw4r::math::VEC3 *);
+int cM3d_Cross_CylLin(const cM3dGCyl *, const cM3dGLin *, nw4r::math::VEC3 *, nw4r::math::VEC3 *);
+int cM3d_Cross_CylPntPnt(const cM3dGCyl *, const nw4r::math::VEC3 *, const nw4r::math::VEC3 *, nw4r::math::VEC3 *, nw4r::math::VEC3 *);
+bool cM3d_Cross_CylPnt(const cM3dGCyl *, const nw4r::math::VEC3 *);
+bool cM3d_Cross_CpsSph_CrossPos(const cM3dGCps &, const cM3dGSph &, const nw4r::math::VEC3 &, nw4r::math::VEC3 *);
+bool cM3d_Cross_CpsSph(const cM3dGCps &, const cM3dGSph &, nw4r::math::VEC3 *);
+bool cM3d_Cross_TriTri(const cM3dGTri &, const cM3dGTri &, nw4r::math::VEC3 *);
+bool cM3d_Cross_CpsTri(const cM3dGCps &, cM3dGTri, nw4r::math::VEC3 *);
+void cM3d_CalcVecZAngle(const nw4r::math::VEC3 &, mAng3_c *);
+void cM3d_PlaneCrossLineProcWork(f32, f32, f32, f32, f32, f32, f32, f32 *, f32 *);
+int cM3d_2PlaneCrossLine(const cM3dGPla &, const cM3dGPla &, cM3dGLin *);
+bool cM3d_3PlaneCrossPos(const cM3dGPla &, const cM3dGPla &, const cM3dGPla &, nw4r::math::VEC3 *);
+f32 cM3d_lineVsPosSuisenCross(const cM3dGLin *, const nw4r::math::VEC3 *, nw4r::math::VEC3 *);
+f32 cM3d_lineVsPosSuisenCross(const nw4r::math::VEC3 &, const nw4r::math::VEC3 &, const nw4r::math::VEC3 &, nw4r::math::VEC3 *);
+
+bool fn_803354e0(cM3dGUnk *, cM3dGUnk *, nw4r::math::VEC3 *);
+bool fn_80336110(cM3dGCyl *, cM3dGUnk *, nw4r::math::VEC3 *);
+bool fn_803364e0(cM3dGCyl *, cM3dGUnk *, f32 *);
+bool fn_80336d90(cM3dGCps *, cM3dGUnk *, nw4r::math::VEC3 *);
+bool fn_80337690(cM3dGUnk *, cM3dGSph *, nw4r::math::VEC3 *);
+bool fn_80337780(cM3dGUnk *, cM3dGSph *, f32 *);
+
+inline bool cM3d_IsZero(f32 f) {
+ return fabsf(f) < G_CM3D_F_ABS_MIN;
+}
+// this is the inline cM3d_IsZero but inverted. Sometimes this will get a match where the regular cM3d_IsZero inline
+// won't
+inline bool cM3d_IsZero_inverted(f32 param_0) {
+ return !(fabsf(param_0) < G_CM3D_F_ABS_MIN);
+}
+
+inline void
+cM3d_InDivPos1(const nw4r::math::VEC3 *pVecA, const nw4r::math::VEC3 *pVecB, f32 pF, nw4r::math::VEC3 *pOut) {
+ nw4r::math::VEC3 tmp;
+ VEC3Scale(&tmp, pVecB, pF);
+ VEC3Add(pOut, &tmp, pVecA);
+}
+inline void
+cM3d_InDivPos2(const nw4r::math::VEC3 *pVecA, const nw4r::math::VEC3 *pVecB, f32 pF, nw4r::math::VEC3 *pOut) {
+ nw4r::math::VEC3 tmp;
+ VEC3Sub(&tmp, pVecB, pVecA);
+ cM3d_InDivPos1(pVecA, &tmp, pF, pOut);
+}
+
+#endif
diff --git a/include/d/col/c/c_m3d_g_aab.h b/include/d/col/c/c_m3d_g_aab.h
new file mode 100644
index 00000000..b72425b9
--- /dev/null
+++ b/include/d/col/c/c_m3d_g_aab.h
@@ -0,0 +1,87 @@
+#ifndef C_M3D_G_AAB_H
+#define C_M3D_G_AAB_H
+
+#include "d/col/c/c_m3d.h"
+#include "d/col/c/c_m3d_g_lin.h"
+#include "d/col/c/c_m3d_g_sph.h"
+
+#include <common.h>
+
+// Axis aligned bounding box
+class cM3dGAab {
+private:
+public:
+ /* 0x00 */ mVec3_c mMin;
+ /* 0x0C */ mVec3_c mMax;
+
+ void SetBounds(const mVec3_c &, const mVec3_c &);
+
+ void Set(const mVec3_c &min, const mVec3_c &max) {
+ mMin = min;
+ mMax = max;
+ }
+ bool CrossY(const mVec3_c &) const;
+ bool UnderPlaneYUnder(f32) const;
+ bool TopPlaneYUnder(f32) const;
+ void SetMinMax(const cM3dGAab &);
+ void SetMin(const mVec3_c &min);
+ void SetMax(const mVec3_c &max);
+ void CalcCenter(mVec3_c &) const;
+ void PlusR(f32);
+ void Clamp(const mVec3_c &, mVec3_c &) const;
+ void Set(const cM3dGSph &);
+ bool Cross(const mVec3_c &) const;
+
+ void SetMinMax(const mVec3_c &minMax) {
+ SetMin(minMax);
+ SetMax(minMax);
+ }
+
+ void ClearForMinMax(void) {
+ mMin.z = 1000000000.0f;
+ mMin.y = 1000000000.0f;
+ mMin.x = 1000000000.0f;
+ mMax.z = -1000000000.0f;
+ mMax.y = -1000000000.0f;
+ mMax.x = -1000000000.0f;
+ }
+
+ const mVec3_c *GetMaxP(void) const {
+ return &mMax;
+ }
+ const mVec3_c *GetMinP(void) const {
+ 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;
+ }
+ const f32 GetMinX(void) const {
+ return mMin.x;
+ }
+ const f32 GetMinY(void) const {
+ return mMin.y;
+ }
+ const f32 GetMinZ(void) const {
+ return mMin.z;
+ }
+ bool Cross(const cM3dGLin *pLin) {
+ return cM3d_Cross_MinMaxBoxLine(mMin, mMax, pLin->mStart, pLin->mEnd);
+ }
+ // bool Cross(const cM3dGAab *param_1) {
+ // return cM3d_Cross_AabAab(this, param_1);
+ // }
+ // bool Cross(const cM3dGCyl *param_1) {
+ // return cM3d_Cross_AabCyl(this, param_1);
+ // }
+ // bool Cross(const cM3dGSph *param_1) {
+ // return cM3d_Cross_AabSph(this, param_1);
+ // }
+};
+
+#endif /* C_M3D_G_AAB_H */
diff --git a/include/d/col/c/c_m3d_g_cir.h b/include/d/col/c/c_m3d_g_cir.h
new file mode 100644
index 00000000..9804c8b5
--- /dev/null
+++ b/include/d/col/c/c_m3d_g_cir.h
@@ -0,0 +1,35 @@
+#ifndef C_M3D_G_CIR_H
+#define C_M3D_G_CIR_H
+
+#include "common.h"
+
+class cM2dGCir {
+public:
+ f32 mPosX;
+ f32 mPosY;
+ f32 mRadius;
+
+ f32 GetCx() const {
+ return mPosX;
+ }
+ f32 GetCy() const {
+ return mPosY;
+ }
+ f32 GetR() const {
+ return mRadius;
+ }
+
+ cM2dGCir() {}
+ virtual ~cM2dGCir() {}
+};
+
+class cM3dGCir : public cM2dGCir {
+ f32 mPosZ;
+
+public:
+ cM3dGCir() {}
+ virtual ~cM3dGCir(){};
+ void Set(f32, f32, f32, f32);
+};
+
+#endif
diff --git a/include/d/col/c/c_m3d_g_cps.h b/include/d/col/c/c_m3d_g_cps.h
new file mode 100644
index 00000000..d700e3bb
--- /dev/null
+++ b/include/d/col/c/c_m3d_g_cps.h
@@ -0,0 +1,38 @@
+#ifndef C_M3D_G_CPS_H
+#define C_M3D_G_CPS_H
+
+#include "d/col/c/c_m3d.h"
+#include "d/col/c/c_m3d_g_lin.h"
+#include "d/col/c/c_m3d_g_unk.h"
+#include "m/m_vec.h"
+
+class cM3dGCps : public cM3dGLin {
+public:
+ /* 0x18 */ f32 mRadius;
+ /* 0x1C */ f32 mField_0x1C;
+ /* 0x20 */ u8 mField_0x20;
+ /* 0x24 */ u32 mFlags;
+
+ cM3dGCps();
+
+ void Set(const mVec3_c &, const mVec3_c &, f32);
+ void SetR(f32 r);
+ void Set_0x1C(f32);
+ bool fn_80337f30(cM3dGUnk *, mVec3_c *);
+ bool fn_80337f40(const mVec3_c &) const;
+
+ f32 GetR() const {
+ return mRadius;
+ }
+ // bool Cross(cM3dGCps const *other, mVec3_c *xyz) const {
+ // return cM3d_Cross_CpsCps(*this, *other, xyz);
+ // }
+ // bool Cross(const cM3dGCyl *cyl, mVec3_c *xyz) const {
+ // return cM3d_Cross_CpsCyl(*this, *cyl, xyz);
+ // }
+ // bool Cross(const cM3dGSph *sph, mVec3_c *xyz) const {
+ // return cM3d_Cross_CpsSph(*this, *sph, xyz);
+ // }
+};
+
+#endif
diff --git a/include/d/col/c/c_m3d_g_cyl.h b/include/d/col/c/c_m3d_g_cyl.h
new file mode 100644
index 00000000..c0c0e067
--- /dev/null
+++ b/include/d/col/c/c_m3d_g_cyl.h
@@ -0,0 +1,30 @@
+#ifndef C_M3D_G_CYL_H
+#define C_M3D_G_CYL_H
+
+#include <d/col/c/c_m3d_g_unk.h>
+#include <m/m_vec.h>
+
+class cM3dGCyl {
+public:
+ /* 0x00 */ mVec3_c mCenter;
+ /* 0x0C */ f32 mRadius;
+ /* 0x10 */ f32 mHeight;
+ cM3dGCyl() {}
+
+ void Set(const mVec3_c &, f32, f32);
+ void SetC(const mVec3_c &, f32 radius, f32 height);
+ void SetC(const mVec3_c &);
+ void SetH(f32);
+ void SetR(f32);
+
+ bool fn_803380e0(cM3dGUnk *, mVec3_c *);
+ bool fn_803380f0(cM3dGUnk *, f32 *);
+ bool Cross(const mVec3_c &) const;
+ void Clamp(const mVec3_c &, mVec3_c &) const;
+
+ const mVec3_c &GetC() const {
+ return mCenter;
+ }
+};
+
+#endif
diff --git a/include/d/col/c/c_m3d_g_lin.h b/include/d/col/c/c_m3d_g_lin.h
new file mode 100644
index 00000000..a0f72aef
--- /dev/null
+++ b/include/d/col/c/c_m3d_g_lin.h
@@ -0,0 +1,67 @@
+#ifndef C_M3D_G_LIN_H
+#define C_M3D_G_LIN_H
+
+#include <common.h>
+#include <m/m_vec.h>
+
+class cM3dGLin {
+public:
+ typedef nw4r::math::VEC3 VEC3;
+ typedef EGG::Vector3f Vector3f;
+
+ /* 0x00 */ mVec3_c mStart;
+ /* 0x0C */ mVec3_c mEnd;
+
+ cM3dGLin() {}
+
+ void SetStartEnd(const VEC3 &, const VEC3 &);
+ void SetStartEnd(const mVec3_c *, const mVec3_c *);
+
+ void Set(const mVec3_c &start, const mVec3_c &end) {
+ mStart = start;
+ mEnd = end;
+ }
+ void CalcPos(mVec3_c *, f32) const;
+
+ void CalcVec(Vec *pOut) const {
+ PSVECSubtract(mEnd, mStart, pOut);
+ }
+
+ void SetStart(const mVec3_c &);
+ void SetEnd(const mVec3_c *pEnd) {
+ mEnd = *pEnd;
+ }
+
+ nw4r::math::VEC3 &GetStart() {
+ return mStart;
+ }
+
+ const nw4r::math::VEC3 &GetStart() const {
+ return mStart;
+ }
+
+ nw4r::math::VEC3 *GetStartP(void) {
+ return &mStart;
+ }
+ const nw4r::math::VEC3 *GetStartP(void) const {
+ return &mStart;
+ }
+
+ nw4r::math::VEC3 &GetEnd() {
+ return mEnd;
+ }
+
+ const nw4r::math::VEC3 &GetEnd() const {
+ return mEnd;
+ }
+
+ nw4r::math::VEC3 *GetEndP(void) {
+ return &mEnd;
+ }
+
+ const nw4r::math::VEC3 *GetEndP(void) const {
+ return &mEnd;
+ }
+};
+
+#endif /* C_M3D_G_LIN_H */
diff --git a/include/d/col/c/c_m3d_g_pla.h b/include/d/col/c/c_m3d_g_pla.h
new file mode 100644
index 00000000..cac47fbe
--- /dev/null
+++ b/include/d/col/c/c_m3d_g_pla.h
@@ -0,0 +1,58 @@
+#ifndef C_M3D_G_PLA_H
+#define C_M3D_G_PLA_H
+
+#include "c/c_math.h"
+#include "d/col/c/c_m3d.h"
+#include "m/m_vec.h"
+
+// Plane with a normal
+class cM3dGPla {
+public:
+ /* 0x00 */ mVec3_c mNormal;
+ /* 0x0C */ f32 mD;
+
+ cM3dGPla() {}
+ cM3dGPla(const mVec3_c *v, f32 f) {
+ mNormal = *v;
+ f = mD;
+ }
+ bool CrossInfLin(const mVec3_c &, const mVec3_c &, mVec3_c &) const;
+ bool getCrossYLessD(const mVec3_c &, f32 *) const;
+ mAng GetAngle(mAng) const;
+ mAng GetNegativeAngle(mAng) const;
+
+ // Unused
+ // void SetupNP0(const mVec3_c &, const mVec3_c &);
+ // void SetupNP(const mVec3_c &, const mVec3_c &);
+ // bool getCrossY(const mVec3_c &, f32 *) const;
+ // void Set(const cM3dGPla *);
+
+ f32 getPlaneFunc(const mVec3_c &pnt) const {
+ return mD + VEC3Dot(mNormal, pnt);
+ }
+ mVec3_c *GetNP() {
+ return &mNormal;
+ }
+ const mVec3_c *GetNP() const {
+ return &mNormal;
+ }
+ f32 GetD() const {
+ return mD;
+ }
+ void SetupFrom3Vtx(const nw4r::math::VEC3 *v1, const nw4r::math::VEC3 *v2, const nw4r::math::VEC3 *v3) {
+ cM3d_CalcPla(v1, v2, v3, &mNormal, &mD);
+ }
+ f32 getCrossY_NonIsZero(const mVec3_c *param_1) {
+ return ((-mNormal.x * param_1->x - mNormal.z * param_1->z) - mD) / mNormal.y;
+ }
+
+ s32 GetAngleY() const {
+ return cM::atan2s(mNormal.x, mNormal.z);
+ }
+
+ f32 GetXZDist() const {
+ return EGG::Math<f32>::sqrt(mNormal.x * mNormal.x + mNormal.z * mNormal.z);
+ }
+};
+
+#endif
diff --git a/include/d/col/c/c_m3d_g_sph.h b/include/d/col/c/c_m3d_g_sph.h
new file mode 100644
index 00000000..43480a97
--- /dev/null
+++ b/include/d/col/c/c_m3d_g_sph.h
@@ -0,0 +1,38 @@
+#ifndef C_M3D_G_SPH_H
+#define C_M3D_G_SPH_H
+
+#include "d/col/c/c_m3d_g_tri.h"
+#include "m/m_vec.h"
+
+class cM3dGSph {
+public:
+ /* 0x00 */ mVec3_c mCenter;
+ /* 0x0C */ f32 mRadius;
+ /* 0x10 */ f32 mRatio;
+ cM3dGSph();
+
+ void SetC(const mVec3_c *);
+ void Set(const mVec3_c *, f32);
+ void SetR(f32);
+ void SetC(f32, f32, f32);
+
+ f32 GetYDist(f32) const;
+ bool Cross(const cM3dGTri *, f32 *, mVec3_c *);
+ void Clamp(const mVec3_c &, mVec3_c &) const;
+
+ bool fn_80338750(cM3dGUnk *, mVec3_c *);
+ bool fn_80338760(cM3dGUnk *, f32 *);
+
+ void SetRatio(f32);
+
+ const mVec3_c &GetC() const {
+ return mCenter;
+ }
+
+ const f32 &GetR() const {
+ return mRadius;
+ }
+
+}; // Size = 0x14
+
+#endif
diff --git a/include/d/col/c/c_m3d_g_tri.h b/include/d/col/c/c_m3d_g_tri.h
new file mode 100644
index 00000000..a6402cdc
--- /dev/null
+++ b/include/d/col/c/c_m3d_g_tri.h
@@ -0,0 +1,25 @@
+#ifndef C_M3D_G_TRI_H
+#define C_M3D_G_TRI_H
+
+#include "common.h"
+#include "d/col/c/c_m3d_g_pla.h"
+
+class cM3dGTri : public cM3dGPla {
+ typedef nw4r::math::VEC3 VecType;
+
+public:
+ /* 0x10 */ VecType mA;
+ /* 0x1C */ VecType mB;
+ /* 0x28 */ VecType mC;
+
+ cM3dGTri() {}
+ void SetPos(const VecType *, const VecType *, const VecType *);
+
+ void SetBg(const VecType *, const VecType *, const VecType *, const cM3dGPla *pla);
+
+ bool cross(const cM3dGLin *lin, VecType *xyz, bool param_2, bool param_3) const {
+ return cM3d_Cross_LinTri(lin, this, xyz, param_2, param_3);
+ }
+};
+
+#endif
diff --git a/include/d/col/c/c_m3d_g_unk.h b/include/d/col/c/c_m3d_g_unk.h
new file mode 100644
index 00000000..6d36035d
--- /dev/null
+++ b/include/d/col/c/c_m3d_g_unk.h
@@ -0,0 +1,52 @@
+#ifndef C_M3D_G_UNK_H
+#define C_M3D_G_UNK_H
+
+#include "d/col/c/c_m3d_g_cps.h"
+#include "d/col/c/c_m3d_g_cyl.h"
+#include "d/col/c/c_m3d_g_pla.h"
+#include "d/col/c/c_m3d_g_sph.h"
+#include "m/m_mtx.h"
+#include "m/m_vec.h"
+
+#include <common.h>
+
+class cM3dGUnk {
+public:
+ /* 0x00 */ mMtx_c mMtx;
+ /* 0x30 */ mMtx_c mInvMtx;
+ /* 0x60 */ mVec3_c mMin;
+ /* 0x6C */ mVec3_c mMax;
+ /* 0x78 */ mVec3_c mField_0x78;
+ /* 0x84 */ mVec3_c mField_0x84;
+ /* 0x90 */ mVec3_c mField_0x90;
+ /* 0x9C */ mVec3_c mField_0x9C;
+ /* 0xA8 */ mVec3_c mField_0xA8;
+ /* 0xB4 */ u32 mField_0xB4;
+ /* 0xB8 */ mVec3_c mVirtCenter;
+ /* 0xC4 */ f32 mField_0xC4;
+
+ cM3dGUnk();
+
+ /* vt at 0xC8*/
+ virtual ~cM3dGUnk() {}
+
+ void Set(const mVec3_c &, const mVec3_c &);
+ void Update();
+ void GetStartEnd(mVec3_c &, mVec3_c &);
+
+ void fn_80338c30(cM3dGCps *, mVec3_c *);
+ bool fn_80338c40(cM3dGUnk *, mVec3_c *);
+ bool fn_80338ca0(/* TODO */);
+ bool fn_80338cb0(cM3dGCyl *, mVec3_c *);
+ bool fn_80338cc0(cM3dGCyl *, f32 *);
+ bool fn_80338cd0(cM3dGSph *, mVec3_c *);
+ bool fn_80338ce0(cM3dGSph *, f32 *);
+
+ void Set(const mMtx_c &);
+ void Set(const mVec3_c &, const mAng &);
+ bool Cross(const mVec3_c &);
+ void Clamp(const mVec3_c &, mVec3_c &);
+ void fn_80338f30(f32, f32);
+};
+
+#endif
diff --git a/include/d/col/c/c_partition.h b/include/d/col/c/c_partition.h
new file mode 100644
index 00000000..6f8d9e62
--- /dev/null
+++ b/include/d/col/c/c_partition.h
@@ -0,0 +1,36 @@
+#ifndef C_PARTITION_H
+#define C_PARTITION_H
+
+/**
+ * File Made Up.
+ * Some Mask/Quick index into the collision octree
+ */
+#include "common.h"
+#include "d/col/c/c_m3d_g_aab.h"
+
+class cPartition {
+public:
+ // static u32 sShift;
+ // static u32 sMask;
+
+ /* 0x0 */ u32 mX;
+ /* 0x4 */ u32 mY;
+ /* 0x8 */ u32 mZ;
+
+ cPartition();
+
+ // vt at 0xC
+ virtual ~cPartition();
+
+ void Calc(mVec3_c *pPos);
+
+ void fn_803391f0(const cM3dGAab *);
+
+ void fn_80339740(mVec3_c *, f32);
+ void fn_803399b0(mVec3_c *);
+ static void fn_80338fb0();
+
+ static bool fn_80339070(const cM3dGAab *);
+};
+
+#endif