From fc81e8d7ccf8d155045e19de13a461a45a9b600e Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 12 Nov 2020 11:17:50 -0500 Subject: add math.h header, and fix one regswap in func_801DEA3C --- include/GSnull.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ include/MSL_C/math.h | 17 +++++++++++++++ include/SDK/mtx.h | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 133 insertions(+), 2 deletions(-) create mode 100644 include/GSnull.h create mode 100644 include/MSL_C/math.h (limited to 'include') diff --git a/include/GSnull.h b/include/GSnull.h new file mode 100644 index 0000000..21fc2b4 --- /dev/null +++ b/include/GSnull.h @@ -0,0 +1,57 @@ +#ifndef POKEREVO_GSNULL_H +#define POKEREVO_GSNULL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "GSblendObject.h" + +// TODO: namespace? +struct gUnkClass11 +{ + Vec unk0; + Vec unkC; + Vec unk18; +}; + +struct gUnkClass10 +{ + u8 unk0[0x20]; // pad + gUnkClass8* unk20; + + u8 unk24[0xC]; // pad + + u32 unk30; + float unk34; + float unk38; + Vec unk3C; + gUnkClass11* unk48; +}; + +class GSnull : public GSblendObject +{ +protected: + u16 unk10; + u8 unk12[0xBE]; + Mtx unkD0; +public: + // 801F1AE8 + GSnull(u8 p1); + // 801F1BC8 + GSnull(void* p1, gUnkClass10* p2); // TODO: p1 type + virtual ~GSnull(); // 801F1F24 + virtual void func1(float p1); // 801F3960 + virtual void func2(BOOL p1); // 801F39E8 + virtual void func3(); // 801F3790 +}; + +void func_801F3904(GSnull*, float); // TODO: member function +BOOL func_801F3C7C(GSnull* p1); // TODO: member function + + +#ifdef __cplusplus +} +#endif + +#endif //POKEREVO_GSNULL_H diff --git a/include/MSL_C/math.h b/include/MSL_C/math.h new file mode 100644 index 0000000..91dd3b4 --- /dev/null +++ b/include/MSL_C/math.h @@ -0,0 +1,17 @@ +#ifndef POKEREVO_MATH_H +#define POKEREVO_MATH_H + +#ifdef __cplusplus +extern "C" { +#endif + +double atan2(double y, double x); +double tan(double x); +double acos(double); +double sqrt(double); + +#ifdef __cplusplus +} +#endif + +#endif //POKEREVO_MATH_H diff --git a/include/SDK/mtx.h b/include/SDK/mtx.h index 07840fc..9bff30f 100644 --- a/include/SDK/mtx.h +++ b/include/SDK/mtx.h @@ -8,8 +8,65 @@ extern "C" { typedef float Mtx[3][4]; typedef float Mtx44[4][4]; -typedef float (*MtxPtr)[4]; -#define MTX_PTR_OFFSET 3 +typedef struct +{ + float x; + float y; + float z; +} Vec, Point3d; + +typedef struct Quaternion +{ + float x; + float y; + float z; + float w; +} Quaternion; + +void PSMTXTranspose(const Mtx src, Mtx xPose); +#define MTXTranspose PSMTXTranspose + +void PSMTXCopy(const Mtx src, Mtx dest); +#define MTXCopy PSMTXCopy + +void C_MTXLookAt(Mtx m, const Point3d* camPos, const Vec* camUp, const Point3d* target); +#define MTXLookAt C_MTXLookAt + +void PSVECAdd(const Vec* a, const Vec* b, Vec* ab); +#define VECAdd PSVECAdd + +void PSMTXMultVecSR(const Mtx m, const Vec* src, Vec* dest); +#define MTXMultVecSR PSMTXMultVecSR + +void PSMTXMultVec(const Mtx m, const Vec* src, Vec* dest); +#define MTXMultVec PSMTXMultVec + +u32 PSMTXInverse(const Mtx src, Mtx inv); +#define MTXInverse PSMTXInverse + +void PSVECCrossProduct(const Vec* a, const Vec* b, Vec* axb); +void PSVECNormalize(const Vec* src, Vec* unit); +void PSVECSubtract(const Vec* a, const Vec* b, Vec* a_b); + + + + +#define MTXConcat PSMTXConcat +void PSMTXConcat(const Mtx a, const Mtx b, Mtx ab); + +#define MTXQuat PSMTXQuat +void PSMTXQuat(Mtx m, const Quaternion* q); + +#define QUATRotAxisRad C_QUATRotAxisRad +void C_QUATRotAxisRad(Quaternion* r, const Vec* axis, float rad); + +void PSMTXScale(Mtx m, float xS, float yS, float zS); + + + +#define VECSubtract PSVECSubtract +#define VECCrossProduct PSVECCrossProduct +#define VECNormalize PSVECNormalize #define MTXIdentity PSMTXIdentity -- cgit v1.2.3