From 280552fa4750b5dac9243782f9c0a7e0b7eea6f8 Mon Sep 17 00:00:00 2001 From: quou Date: Fri, 5 May 2023 09:25:39 +1000 Subject: Add a basic enemy. --- standard.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'standard.c') diff --git a/standard.c b/standard.c index 5e464f6..9a87342 100644 --- a/standard.c +++ b/standard.c @@ -135,6 +135,20 @@ int flerp(int a, int b, int t) { return a + ((t * (b - a)) >> fbits); } +void vec_minise(int* x, int* y) { + if ( + absolute(*x) <= fscale_lower_limit || + absolute(*y) <= fscale_lower_limit) { + *x *= fscale_factor; + *y *= fscale_factor; + } else if ( + absolute(*x) > fscale_upper_limit || + absolute(*y) > fscale_upper_limit) { + *x /= fscale_factor; + *y /= fscale_factor; + } +} + void vec_nrmise(int* x, int* y) { int l; -- cgit v1.2.3-54-g00ecf