mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
macro parameter usage must have () around them :P
This seems to fix the aim bug
This commit is contained in:
parent
51ca0b6a41
commit
26e2d545e4
1 changed files with 6 additions and 6 deletions
|
@ -44,18 +44,18 @@ extern int nanmask;
|
|||
#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask)
|
||||
|
||||
#define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2])
|
||||
#define VectorSubtract(a,b,c) {c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];}
|
||||
#define VectorAdd(a,b,c) {c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];}
|
||||
#define VectorCopy(a,b) {b[0]=a[0];b[1]=a[1];b[2]=a[2];}
|
||||
#define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];}
|
||||
#define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];}
|
||||
#define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];}
|
||||
|
||||
/*
|
||||
* VectorDistance, the distance between two points.
|
||||
* Yes, this is the same as sqrt(VectorSubtract then DotProduct),
|
||||
* however that way would involve more vars, this is cheaper.
|
||||
*/
|
||||
#define VectorDistance_fast(a, b) (((a[0] - b[0]) * (a[0] - b[0])) + \
|
||||
((a[1] - b[1]) * (a[1] - b[1])) + \
|
||||
((a[2] - b[2]) * (a[2] - b[2])))
|
||||
#define VectorDistance_fast(a, b) ((((a)[0] - (b)[0]) * ((a)[0] - (b)[0])) + \
|
||||
(((a)[1] - (b)[1]) * ((a)[1] - (b)[1])) + \
|
||||
(((a)[2] - (b)[2]) * ((a)[2] - (b)[2])))
|
||||
#define VectorDistance(a, b) sqrt(VectorDistance_fast(a, b))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue