From d44af70b2847cb998f01f0120d72b4ed263504e3 Mon Sep 17 00:00:00 2001 From: zicodxx Date: Fri, 8 Jun 2012 15:54:11 +0200 Subject: [PATCH] in vms_matrix_from_quaternion put the definition of tmp1 and tmp2 variables at the beginning of the functions because i was a baaaad boy --- CHANGELOG.txt | 1 + maths/vecmat.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ca5998d9a..97bd71ab1 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ D1X-Rebirth Changelog 20120608 -------- main/kconfig.c: Switching keyboard sensitivity function from variable increase to variable offset, making the ship more responsive in higher settings +math/vecmat.c: in vms_matrix_from_quaternion put the definition of tmp1 and tmp2 variables at the beginning of the functions because i was a baaaad boy 20120601 -------- diff --git a/maths/vecmat.c b/maths/vecmat.c index 7c5061028..261678335 100644 --- a/maths/vecmat.c +++ b/maths/vecmat.c @@ -942,14 +942,15 @@ void vms_matrix_from_quaternion(vms_matrix * m, const vms_quaternion * q) fix sqx = fixmul(q->x * 2, q->x * 2); fix sqy = fixmul(q->y * 2, q->y * 2); fix sqz = fixmul(q->z * 2, q->z * 2); - fix invs = fixdiv(fl2f(1.0), (sqw + sqx + sqy + sqz)); + fix tmp1, tmp2; + m->rvec.x = fixmul(sqx - sqy - sqz + sqw, invs); m->uvec.y = fixmul(-sqx + sqy - sqz + sqw, invs); m->fvec.z = fixmul(-sqx - sqy + sqz + sqw, invs); - fix tmp1 = fixmul(q->x * 2, q->y * 2); - fix tmp2 = fixmul(q->z * 2, q->w * 2); + tmp1 = fixmul(q->x * 2, q->y * 2); + tmp2 = fixmul(q->z * 2, q->w * 2); m->uvec.x = fixmul(fixmul(fl2f(2.0), (tmp1 + tmp2)), invs); m->rvec.y = fixmul(fixmul(fl2f(2.0), (tmp1 - tmp2)), invs);