From 17055159a4118b09acdf3481fd4ecb19faa96f1a Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 12 Jun 2021 20:24:32 -0400 Subject: Decompile unk_0201E7D8, 1 --- arm9/lib/include/fx.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'arm9/lib') diff --git a/arm9/lib/include/fx.h b/arm9/lib/include/fx.h index 38506194..18bb09f2 100644 --- a/arm9/lib/include/fx.h +++ b/arm9/lib/include/fx.h @@ -172,4 +172,29 @@ void MTX_ScaleApply22(struct Mtx22 *mtx, struct Mtx22 *dst, fx32 x, fx32 y); void MTX_Identity22_(struct Mtx22 *mtx); void MTX_Rot22_(struct Mtx22 *mtx, fx32 sinphi, fx32 cosphi); +// Trig +extern const fx16 FX_SinCosTable_[]; + +static inline fx16 FX_SinIdx(int idx) +{ + return FX_SinCosTable_[((idx >> 4) << 1)]; +} + +static inline fx16 FX_CosIdx(int idx) +{ + return FX_SinCosTable_[((idx >> 4) << 1) + 1]; +} + +static inline fx32 FX32_CAST(s64 res) +{ + return (fx32)res; +} + +static inline fx32 FX_MulInline(fx32 v1, fx32 v2) +{ + return FX32_CAST(((s64)v1 * v2 + 0x800LL) >> FX32_INT_SHIFT); +} + +#define FX_Mul(v1, v2) FX_MulInline(v1, v2) + #endif //GUARD_FX_H -- cgit v1.2.3