mirror of
https://github.com/libretro/libretro-tyrquake.git
synced 2024-11-24 08:29:42 +00:00
mathlib: make vector math macros more robust
Wrap the vector macros that don't return a value in do {} while (0) and fix a couple of missing semicolons detected in the process. Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
parent
60d7c9af44
commit
e7839fa7db
@ -762,7 +762,7 @@ CL_AddFlagModels(entity_t *ent, int team)
|
||||
ent->origin[i] - f * v_forward[i] + 22 * v_right[i];
|
||||
newent->origin[2] -= 16;
|
||||
|
||||
VectorCopy(ent->angles, newent->angles)
|
||||
VectorCopy(ent->angles, newent->angles);
|
||||
newent->angles[2] -= 45;
|
||||
}
|
||||
|
||||
|
@ -764,7 +764,7 @@ SpectatorMove(void)
|
||||
// friction
|
||||
speed = Length(pmove.velocity);
|
||||
if (speed < 1) {
|
||||
VectorCopy(vec3_origin, pmove.velocity)
|
||||
VectorCopy(vec3_origin, pmove.velocity);
|
||||
} else {
|
||||
drop = 0;
|
||||
|
||||
|
@ -68,9 +68,9 @@ extern int 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) do {c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[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)
|
||||
|
||||
void VectorMA(const vec3_t veca, const float scale, const vec3_t vecb,
|
||||
vec3_t vecc);
|
||||
|
Loading…
Reference in New Issue
Block a user