// // Created by Wouter Groeneveld on 08/07/20. // #ifndef GBA_BITMAP_ENGINE_PROJECT_MATH_H #define GBA_BITMAP_ENGINE_PROJECT_MATH_H #include #ifdef CODE_COMPILED_AS_PART_OF_TEST #include #else #include #endif #include // fixed point math things that were missing from TONC extern FIXED HALF; extern FIXED ONE; #define FIX12_SHIFT 12 #define FIX12_SCALE ( 1<> 4; } INLINE FIXED fxsin(FIXED fxrad) { FIXED theta = fxrad2lut(fxrad); FIXED sin = lu_sin(theta); return fx12Tofx8(sin); } INLINE FIXED fxcos(FIXED fxrad) { FIXED theta = fxrad2lut(fxrad); FIXED cos = lu_cos(theta); return fx12Tofx8(cos); } INLINE FIXED fxtan(FIXED fxrad) { FIXED theta = fxrad2lut(fxrad); FIXED sin = lu_sin(theta); FIXED cos = lu_cos(theta); return fx12Tofx8(fx12div(sin, cos)); } #endif //GBA_BITMAP_ENGINE_PROJECT_MATH_H