diff options
| author | TakaRikka <38417346+TakaRikka@users.noreply.github.com> | 2021-11-10 23:54:31 -0800 |
|---|---|---|
| committer | TakaRikka <38417346+TakaRikka@users.noreply.github.com> | 2021-11-10 23:54:31 -0800 |
| commit | 70eabb12bd5e9327ccd01b1f9367fca109d4fbfa (patch) | |
| tree | bc478c843622a25b54dd87479b6575be425b7488 /include/SSystem | |
| parent | 74ed2da8bc93804373cddf64c0c878603150b699 (diff) | |
wip
Diffstat (limited to 'include/SSystem')
| -rw-r--r-- | include/SSystem/SComponent/c_cc_d.h | 14 | ||||
| -rw-r--r-- | include/SSystem/SComponent/c_lib.h | 12 | ||||
| -rw-r--r-- | include/SSystem/SComponent/c_xyz.h | 5 |
3 files changed, 29 insertions, 2 deletions
diff --git a/include/SSystem/SComponent/c_cc_d.h b/include/SSystem/SComponent/c_cc_d.h index dff6740eed..1bc91d70f0 100644 --- a/include/SSystem/SComponent/c_cc_d.h +++ b/include/SSystem/SComponent/c_cc_d.h @@ -273,6 +273,7 @@ public: u8 GetWeightUc() const { return mWeight; } void SetWeight(u8 weight) { mWeight = weight; } fopAc_ac_c* GetAc() { return mActor; } + void SetActor(void* ac) { mActor = (fopAc_ac_c*)ac; } }; // Size = 0x1C STATIC_ASSERT(0x1C == sizeof(cCcD_Stts)); @@ -281,8 +282,8 @@ class cCcD_Obj; // placeholder class cCcD_ObjCommonBase { protected: - /* 0x00 */ int mSPrm; - /* 0x04 */ int mRPrm; + /* 0x00 */ u32 mSPrm; + /* 0x04 */ u32 mRPrm; /* 0x08 */ cCcD_Obj* mHitObj; /* 0x0C vtable */ public: @@ -295,6 +296,8 @@ public: s32 getRPrm() const { return mRPrm; } cCcD_Obj* getHitObj() { return mHitObj; } u32 MskSPrm(u32 mask) const { return mSPrm & mask; } + void OnSPrmBit(u32 flag) { mSPrm |= flag; } + void OffSPrmBit(u32 flag) { mSPrm &= ~flag; } }; STATIC_ASSERT(0x10 == sizeof(cCcD_ObjCommonBase)); @@ -311,6 +314,8 @@ public: bool ChkSet() const { return MskSPrm(1); } u8 GetAtp() const { return mAtp; } u32 MskType(u32 msk) const { return mType & msk; } + void SetType(u32 type) { mType = type; } + void SetAtp(int atp) { mAtp = atp; } protected: /* 0x10 */ int mType; @@ -388,6 +393,11 @@ public: bool ChkAtType(u32 type) const { return mObjAt.MskType(type); } u32 ChkCoNoCrr() const { return mObjCo.ChkNoCrr(); } u32 ChkCoSph3DCrr() const { return mObjCo.ChkSph3DCrr(); } + void OnAtSPrmBit(u32 flag) { mObjAt.OnSPrmBit(flag); } + void OffAtSPrmBit(u32 flag) { mObjAt.OffSPrmBit(flag); } + void SetAtType(u32 type) { mObjAt.SetType(type); } + void OnAtSetBit() { mObjAt.OnSPrmBit(1); } + void SetAtAtp(int atp) { mObjAt.SetAtp(atp); } }; // Size = 0x40 diff --git a/include/SSystem/SComponent/c_lib.h b/include/SSystem/SComponent/c_lib.h index 8ff0092bc1..ca3406b0e0 100644 --- a/include/SSystem/SComponent/c_lib.h +++ b/include/SSystem/SComponent/c_lib.h @@ -42,6 +42,18 @@ inline u8 cLib_checkBit(u8& pVar, u8 pBit) { return pVar & pBit; } +template<typename T> +inline T cLib_minMaxLimit(T param_0, T min, T max) { + if (param_0 < min) { + return max; + } + min = param_0; + if (min > max) { + min = max; + } + return min; +} + void MtxInit(void); void MtxTrans(float, float, float, unsigned char); void MtxScale(float, float, float, unsigned char); diff --git a/include/SSystem/SComponent/c_xyz.h b/include/SSystem/SComponent/c_xyz.h index 0f28e22048..f7a57a7b6a 100644 --- a/include/SSystem/SComponent/c_xyz.h +++ b/include/SSystem/SComponent/c_xyz.h @@ -2,6 +2,7 @@ #define C_XYZ_H #include "dolphin/mtx/vec.h" +#include "msl_c/math.h" #include "global.h" struct cXyz : Vec { @@ -116,6 +117,10 @@ struct cXyz : Vec { cXyz tmp2(other.x, 0, other.z); return tmp.abs2(tmp2); } + f32 absXZ(const Vec& other) const { + f32 abs = abs2XZ(other); + return sqrtf(abs); + } f32 getMagXZ() const { return cXyz(this->x, 0, this->z).getSquareMag(); } }; |
