aboutsummaryrefslogtreecommitdiff
path: root/standard.c
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2023-05-05 09:25:39 +1000
committerquou <quou@disroot.org>2023-05-05 09:25:39 +1000
commit280552fa4750b5dac9243782f9c0a7e0b7eea6f8 (patch)
tree6385dc740cc965dad7dc628e8b10738724ec0a42 /standard.c
parent0a083f5a9a747083bbc3a1f0689e76ac5fc3a3b9 (diff)
Add a basic enemy.
Diffstat (limited to 'standard.c')
-rw-r--r--standard.c14
1 files changed, 14 insertions, 0 deletions
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;