]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - view.c
The code works as intended! Change some names and comments in the meantime.
[xonotic/darkplaces.git] / view.c
diff --git a/view.c b/view.c
index 279f445fa02be6793d9016d2d3c73bfe9364e13b..fe3e81304686163d91ebcd9a8f9685700393b6f5 100644 (file)
--- a/view.c
+++ b/view.c
@@ -712,31 +712,25 @@ void V_CalcRefdef (void)
                                                gunorg[0] += bob2vel[0];
                                                gunorg[1] += bob2vel[1];
                                        }
-                                       
-                                       
-                                       // TEST!!!
 
-                                       // get the speed while in the air, apply it while we're not
+                                       // fall bobbing code
+                                       // causes the view to swing down and back up when touching the ground
                                        if (!cl.onground)
                                        {
-                                               cl.ground_hit_speed = cl.velocity[2] * 0.1; // replace 0.1 with cvar
-                                               cl.ground_hit_counter = 1;
+                                               cl.bobfall_speed = cl.velocity[2] * 0.1; // replace 0.1 with cvar
+                                               cl.bobfall_swing = 1;
                                        }
                                        else
                                        {
-                                               if(cl.ground_hit_counter > 0)
-                                                       cl.ground_hit_counter -= 0.1; // replace 0.1 with cvar
+                                               if(cl.bobfall_swing > 0)
+                                                       cl.bobfall_swing -= 0.01; // replace 0.1 with cvar
                                                else
-                                                       cl.ground_hit_counter = 0;
+                                                       cl.bobfall_swing = 0;
 
-                                               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;
+                                               vieworg[2] += sin(M_PI + M_PI * cl.bobfall_swing) * -cl.bobfall_speed;
+                                               gunorg[2] += sin(M_PI + M_PI * cl.bobfall_swing) * -cl.bobfall_speed;
                                        }
 
-                                       // End of TEST!!!
-                                       
-                                       
-
                                        // gun model bobbing code
                                        if (cl_bob.value || cl_bob2.value)
                                        if (cl_bobmodel.value)