]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix stupid quake precision problem with PF_vectoangles (it rounded pitch to integer!)
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 17 Sep 2004 01:03:03 +0000 (01:03 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 17 Sep 2004 01:03:03 +0000 (01:03 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4510 d7cf8633-e32d-0410-b094-e92efae38249

pr_cmds.c

index 32fe4cf7b15177565993092ed1b698e7689617f4..354cf937c2bf82075db8f20558e7b5c88ae047bc 100644 (file)
--- a/pr_cmds.c
+++ b/pr_cmds.c
@@ -540,11 +540,9 @@ vector vectoangles(vector)
 */
 void PF_vectoangles (void)
 {
-       float   *value1;
-       float   forward;
-       float   yaw, pitch;
+       double value1[3], forward, yaw, pitch;
 
-       value1 = G_VECTOR(OFS_PARM0);
+       VectorCopy(G_VECTOR(OFS_PARM0), value1);
 
        if (value1[1] == 0 && value1[0] == 0)
        {
@@ -569,14 +567,12 @@ void PF_vectoangles (void)
                        yaw = 270;
 
                forward = sqrt(value1[0]*value1[0] + value1[1]*value1[1]);
-               pitch = (int) (atan2(value1[2], forward) * 180 / M_PI);
+               pitch = (atan2(value1[2], forward) * 180 / M_PI);
                if (pitch < 0)
                        pitch += 360;
        }
 
-       G_FLOAT(OFS_RETURN+0) = pitch;
-       G_FLOAT(OFS_RETURN+1) = yaw;
-       G_FLOAT(OFS_RETURN+2) = 0;
+       VectorSet(G_VECTOR(OFS_RETURN), pitch, yaw, 0);
 }
 
 /*