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

This commit is contained in:
zicodxx 2012-06-08 15:54:17 +02:00
parent 98bf17c08c
commit 2055192b67
2 changed files with 5 additions and 3 deletions

View file

@ -4,6 +4,7 @@ D2X-Rebirth Changelog
--------
main/multi.c, main/object.c: cleanly decide it to drop a hoard orb depending on wether we were killed by ourselves, en enemy or team-mate without any ugly and unreliable hacks
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
--------

View file

@ -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);