mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
multi statement macro fixes as pointed out by Grievre
This commit is contained in:
parent
e24cbd75e0
commit
ff5b215c13
2 changed files with 11 additions and 11 deletions
|
@ -45,27 +45,27 @@ extern const vec_t * const vec3_origin;
|
|||
#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask)
|
||||
|
||||
#define DotProduct(a,b) ((a)[0]*(b)[0]+(a)[1]*(b)[1]+(a)[2]*(b)[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 VectorNegate(a,b) {(b)[0]=-(a)[0];(b)[1]=-(a)[1];(b)[2]=-(a)[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 VectorMult(a,b,c) {(c)[0]=(a)[0]*(b)[0];(c)[1]=(a)[1]*(b)[1];(c)[2]=(a)[2]*(b)[2];}
|
||||
#define VectorMultAdd(a,s,b,c) {(c)[0]=(a)[0]+(s)*(b)[0];(c)[1]=(a)[1]+(s)*(b)[1];(c)[2]=(a)[2]+(s)*(b)[2];}
|
||||
#define VectorMultSub(a,s,b,c) {(c)[0]=(a)[0]-(s)*(b)[0];(c)[1]=(a)[1]-(s)*(b)[1];(c)[2]=(a)[2]-(s)*(b)[2];}
|
||||
#define VectorSubtract(a,b,c) do {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];} while (0)
|
||||
#define VectorNegate(a,b) do {(b)[0]=-(a)[0];(b)[1]=-(a)[1];(b)[2]=-(a)[2];} while (0)
|
||||
#define VectorAdd(a,b,c) do {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];} while (0)
|
||||
#define VectorCopy(a,b) do {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];} while (0)
|
||||
#define VectorMult(a,b,c) do {(c)[0]=(a)[0]*(b)[0];(c)[1]=(a)[1]*(b)[1];(c)[2]=(a)[2]*(b)[2];} while (0)
|
||||
#define VectorMultAdd(a,s,b,c) do {(c)[0]=(a)[0]+(s)*(b)[0];(c)[1]=(a)[1]+(s)*(b)[1];(c)[2]=(a)[2]+(s)*(b)[2];} while (0)
|
||||
#define VectorMultSub(a,s,b,c) do {(c)[0]=(a)[0]-(s)*(b)[0];(c)[1]=(a)[1]-(s)*(b)[1];(c)[2]=(a)[2]-(s)*(b)[2];} while (0)
|
||||
#define VectorLength(a) sqrt(DotProduct(a, a))
|
||||
|
||||
#define VectorScale(a,b,c) {(c)[0]=(a)[0]*(b);(c)[1]=(a)[1]*(b);(c)[2]=(a)[2]*(b);}
|
||||
#define VectorScale(a,b,c) do {(c)[0]=(a)[0]*(b);(c)[1]=(a)[1]*(b);(c)[2]=(a)[2]*(b);} while (0)
|
||||
#define VectorCompare(x, y) (((x)[0] == (y)[0]) && ((x)[1] == (y)[1]) && ((x)[2] == (y)[2]))
|
||||
|
||||
#define VectorIsZero(a) ((a)[0] == 0 && (a)[1] == 0 && (a)[2] == 0)
|
||||
#define VectorZero(a) ((a)[2] = (a)[1] = (a)[0] = 0);
|
||||
|
||||
#define VectorBlend(v1,v2,b,v) \
|
||||
{ \
|
||||
do { \
|
||||
(v)[0] = (v1)[0] * (1 - (b)) + (v2)[0] * (b); \
|
||||
(v)[1] = (v1)[1] * (1 - (b)) + (v2)[1] * (b); \
|
||||
(v)[2] = (v1)[2] * (1 - (b)) + (v2)[2] * (b); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* VectorDistance, the distance between two points.
|
||||
|
|
|
@ -163,7 +163,7 @@ qboolean PR_EdictValid (progs_t *pr, int e);
|
|||
#define RETURN_STRING(p, s) (R_STRING (p) = PR_SetReturnString((p), s))
|
||||
#define RETURN_EDICT(p, e) (R_STRING (p) = EDICT_TO_PROG(p, e))
|
||||
#define RETURN_POINTER(pr,p) (R_POINTER (pr) = POINTER_TO_PROG (pr, p))
|
||||
#define RETURN_VECTOR(p, v) (VectorCopy (v, R_VECTOR (p)))
|
||||
#define RETURN_VECTOR(p, v) VectorCopy (v, R_VECTOR (p))
|
||||
|
||||
#define E_var(e,o,t) ((e)->v[o].t##_var)
|
||||
|
||||
|
|
Loading…
Reference in a new issue