diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2021-06-12 20:24:32 -0400 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2021-06-12 20:24:32 -0400 |
commit | 17055159a4118b09acdf3481fd4ecb19faa96f1a (patch) | |
tree | 3383c9608f54dd365584f59668c6f53d543c5d07 /arm9/lib/include/fx.h | |
parent | 5bf6a89e8ed480b72f901e3523b7ff7b4d695249 (diff) |
Decompile unk_0201E7D8, 1
Diffstat (limited to 'arm9/lib/include/fx.h')
-rw-r--r-- | arm9/lib/include/fx.h | 25 |
1 files changed, 25 insertions, 0 deletions
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 |