X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=mathlib.c;h=4c19dfe1d38e558af013e23da358031a563bf443;hp=8816dc5605cb9dbfaa0f782614c6316a05a4f606;hb=4d34e0a632cbc401712f46e10bb9864438b0881f;hpb=48669036b4be979d997c27227942ed9c430277d5 diff --git a/mathlib.c b/mathlib.c index 8816dc56..4c19dfe1 100644 --- a/mathlib.c +++ b/mathlib.c @@ -647,7 +647,7 @@ void AngleVectorsDuke3DFLU (const vec3_t angles, vec3_t forward, vec3_t left, ve } // LadyHavoc: calculates pitch/yaw/roll angles from forward and up vectors -void AnglesFromVectors (vec3_t angles, const vec3_t forward, const vec3_t up, qboolean flippitch) +void AnglesFromVectors (vec3_t angles, const vec3_t forward, const vec3_t up, qbool flippitch) { if (forward[0] == 0 && forward[1] == 0) { @@ -762,21 +762,14 @@ void AngleMatrix (const vec3_t angles, const vec3_t translate, vec_t matrix[][4] // LadyHavoc: renamed this to Length, and made the normal one a #define float VectorNormalizeLength (vec3_t v) { - float length, ilength; + float length; - length = v[0]*v[0] + v[1]*v[1] + v[2]*v[2]; - length = sqrt (length); + length = sqrt(DotProduct(v,v)); if (length) - { - ilength = 1/length; - v[0] *= ilength; - v[1] *= ilength; - v[2] *= ilength; - } + VectorScale(v, 1 / length, v); return length; - }