Starship/include/sf64math.h

114 lines
3.1 KiB
C
Raw Normal View History

2023-10-19 01:54:19 +03:00
#ifndef SF64_MATH_H
#define SF64_MATH_H
fox_hud & fox_me Decompiled (#95) * func_80092D48 * func_800927A0 * TempComp.bin.mio0 git ignored * func_800924E0 * func_80094D20 * func_80096A74 * func_80095604 * all functions done * symbols for segmented addresses * move symbols to c file for now * failed attempt to import data * fix * Import data * move data below * ready for BSS attempt * fix warnings * ordering * symbols for some segmented addresses * rename to fox_hud * clear mess * . * . * space * . * func_i2_80187530 * func_i2_8018756C * func_i2_80187650 * func_i2_801877C4 * func_i2_8018795C * func_i2_80187B08 * func_i2_80187C68 * bss again (#98) * func_i2_80187D08 * func_i2_80187D98 * func_i2_80187FF8 * func_i2_801881A8 * func_i2_80188228 * func_i2_80188298 * ARRAY_COUNT * func_i2_80188344 * func_i2_80188B84 * func_i2_80188C2C * func_i2_80188E8C * func_i2_80188F2C * func_i2_80188CAC * func_i2_80189114 * func_i2_8018B7C4 * func_i2_8018C77C * func_i2_8018C8F4 * func_i2_8018CA10 * func_i2_8018CB50 * func_i2_8018BACC co-authored-by: @inspectredc * func_i2_8018CCF8 * func_i2_8018CB50 * func_i2_8018CD8C co-authored-by: @inspectredc & @petrie911 * func_i2_8018D9EC * func_i2_8018DA6C * func_i2_8018DAEC * func_i2_8018DB6C * func_i2_8018DBEC * func_i2_8018DCE4 * func_i2_8018DE14 * func_i2_8018DF08 co-authored-by @inspectredc & @petrie911 * func_i2_8018E084 * func_i2_8018ED9C * func_i2_80188088 * func_i2_801892F0 * func_i2_8018978C co-authored-by @KiritoDv & inspectredc * fox_me DATA IMPORTED * resolve conflicts * func_i6_80197B30 * func_i6_80197CC4 * func_i6_80197F84 * func_i6_80198244 * merge and solve bss * func_i6_801983E4 * PR review --------- Co-authored-by: petrie911 <69443847+petrie911@users.noreply.github.com>
2024-01-21 19:27:47 +03:00
#include "libultra/ultra64.h"
2023-10-19 01:54:19 +03:00
typedef struct {
/* 0x0 */ f32 x;
/* 0x4 */ f32 y;
/* 0x8 */ f32 z;
} Vec3f; // size = 0xC
typedef struct {
/* 0x0 */ s16 x;
/* 0x2 */ s16 y;
/* 0x4 */ s16 z;
} Vec3s; // size = 0x6;
typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ Vec3f rot;
} PosRot; // size = 0x18
typedef struct {
/* 0x0 */ s16 vtx[3];
} Triangle; // size = 0x6
typedef struct {
/* 0x0 */ Vec3f normal;
/* 0xC */ f32 dist;
} PlaneF; // size = 0x10
typedef struct {
/* 0x0 */ Vec3s normal;
/* 0x8 */ s32 dist;
} PlaneI; // size = 0xC
typedef union {
float m[4][4];
struct {
float xx, yx, zx, wx,
xy, yy, zy, wy,
xz, yz, zz, wz,
xw, yw, zw, ww;
};
// u64 force_struct_alignment;
} Matrix; // size = 0x40
extern Mtx gIdentityMtx; // 800C4620
extern Matrix gIdentityMatrix; //800C4660
extern Matrix* gGfxMatrix;
extern Matrix sGfxMatrixStack[0x20];
extern Matrix* gCalcMatrix;
extern Matrix sCalcMatrixStack[0x20];
f32 Math_ModF(f32 value, f32 mod);
void Rand_Init(void);
f32 Rand_ZeroOne(void);
void Rand_SetSeed(s32 seed1, s32 seed2, s32 seed3);
f32 Rand_ZeroOneSeeded(void);
f32 Math_Atan2F(f32 y, f32 x);
f32 Math_Atan2F_XY(f32 x, f32 y);
f32 Math_Atan2F_XYAlt(f32 x, f32 y);
f32 Math_PowF(f32 base, s32 exp);
void Math_MinMax(s32* min, s32* max, s32 val1, s32 val2, s32 val3);
f32 Math_SmoothStepToF(f32 *value, f32 target, f32 scale, f32 maxStep, f32 minStep);
f32 Math_SmoothStepToAngle(f32 *angle, f32 target, f32 scale, f32 maxStep, f32 minStep);
void Math_SmoothStepToVec3fArray(Vec3f *src, Vec3f *dst, s32 mode, s32 count, f32 scale, f32 maxStep, f32 minStep);
s32 Math_PursueVec3f(Vec3f *pos, Vec3f *target, Vec3f *rot, f32 stepSize, f32 scaleTurn, f32 maxTurn, f32 dist);
void Math_Vec3fFromAngles(Vec3f *step, f32 xRot, f32 yRot, f32 stepsize);
f32 Math_RadToDeg(f32 rAngle);
void Matrix_Copy(Matrix*, Matrix*);
void Matrix_Push(Matrix** mtxStack);
void Matrix_Pop(Matrix** mtxStack);
void Matrix_Mult(Matrix*, Matrix*, u8);
void Matrix_Translate(Matrix*, f32, f32, f32, u8);
void Matrix_Scale(Matrix* mtx, f32 xScale, f32 yScale, f32 zScale, u8 mode);
void Matrix_RotateX(Matrix*, f32, u8);
void Matrix_RotateY(Matrix*, f32, u8);
void Matrix_RotateZ(Matrix*, f32, u8);
void Matrix_RotateAxis(Matrix*, f32, f32, f32, f32, u8);
void Matrix_ToMtx(Mtx *dest);
void Matrix_FromMtx(Mtx *src, Matrix *dest);
void Matrix_MultVec3f(Matrix* mtx, Vec3f* src, Vec3f* dest);
void Matrix_MultVec3fNoTranslate(Matrix* mtx, Vec3f* src, Vec3f* dest);
void Matrix_GetYRPAngles(Matrix*, Vec3f*);
void Matrix_GetXYZAngles(Matrix*, Vec3f*);
void Matrix_LookAt(Matrix*, f32, f32, f32, f32, f32, f32, f32, f32, f32, u8);
void Matrix_SetGfxMtx(Gfx**);
f32 Math_FAtanF(f32);
f32 Math_FAtan2F(f32, f32);
f32 Math_FAsinF(f32);
f32 Math_FAcosF(f32);
f32 __sinf(f32);
f32 __cosf(f32);
s64 __ull_div(s64, s64);
s64 __ll_mul(s64, s64);
s64 __ll_rshift(s64, s64);
f32 Math_FloorF(f32);
f32 Math_CeilF(f32);
f64 Math_Fabs(f64);
f32 Math_FabsF(f32);
f32 Math_NearbyIntF(f32);
f32 Math_TruncF(f32);
f32 Math_RoundF(f32);
#endif