From 632009429384340e4428bcde3d5ae5c2a727e578 Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Sun, 23 Mar 2025 17:41:32 +0000 Subject: [PATCH] Remove dotprod FossilOrigin-Name: da90479adfbf8157d7f203d06b68ddc6b9d5d2667e54e6ac8b6380d96ce05048 --- src/cube.h | 3 +-- src/weapon.m | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/cube.h b/src/cube.h index e6eab65..6702598 100644 --- a/src/cube.h +++ b/src/cube.h @@ -287,10 +287,9 @@ extern bool demoplayback; #define PI2 (2 * PI) // simplistic vector ops -#define dotprod(u, v) ((u).x * (v).x + (u).y * (v).y + (u).z * (v).z) #define vdist(d, v, e, s) \ OFVector3D v = OFSubtractVectors3D(s, e); \ - float d = (float)sqrt(dotprod(v, v)); + float d = sqrtf(OFDotProductOfVectors3D(v, v)); #define vreject(v, u, max) \ ((v).x > (u).x + (max) || (v).x < (u).x - (max) || \ (v).y > (u).y + (max) || (v).y < (u).y - (max)) diff --git a/src/weapon.m b/src/weapon.m index fb70cfa..d0ff131 100644 --- a/src/weapon.m +++ b/src/weapon.m @@ -90,12 +90,12 @@ intersect(DynamicEntity *d, const OFVector3D *from, const OFVector3D *to) const OFVector3D *p; v = OFSubtractVectors3D(v, *from); w = OFSubtractVectors3D(w, *from); - float c1 = dotprod(w, v); + float c1 = OFDotProductOfVectors3D(w, v); if (c1 <= 0) p = from; else { - float c2 = dotprod(v, v); + float c2 = OFDotProductOfVectors3D(v, v); if (c2 <= c1) p = to; else {