]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - view.c
Very close to getting the correct maths done. It now works as intended, just need...
[xonotic/darkplaces.git] / view.c
diff --git a/view.c b/view.c
index f35fb255410a0a664dccbd751952128afebb3477..279f445fa02be6793d9016d2d3c73bfe9364e13b 100644 (file)
--- a/view.c
+++ b/view.c
@@ -720,16 +720,17 @@ void V_CalcRefdef (void)
                                        if (!cl.onground)
                                        {
                                                cl.ground_hit_speed = cl.velocity[2] * 0.1; // replace 0.1 with cvar
+                                               cl.ground_hit_counter = 1;
                                        }
                                        else
                                        {
-                                               if(cl.ground_hit_speed < 0)
-                                                       cl.ground_hit_speed += 0.1; // replace 0.1 with cvar
+                                               if(cl.ground_hit_counter > 0)
+                                                       cl.ground_hit_counter -= 0.1; // replace 0.1 with cvar
                                                else
-                                                       cl.ground_hit_speed = 0;
+                                                       cl.ground_hit_counter = 0;
 
-                                               vieworg[2] += sin(M_PI + M_PI * cl.ground_hit_speed * 1);
-                                               gunorg[2] += sin(M_PI + M_PI * cl.ground_hit_speed * 1);
+                                               vieworg[2] += sin(M_PI + M_PI * cl.ground_hit_counter) * -cl.ground_hit_speed;
+                                               gunorg[2] += sin(M_PI + M_PI * cl.ground_hit_counter) * -cl.ground_hit_speed;
                                        }
 
                                        // End of TEST!!!