]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
The code works as intended! Change some names and comments in the meantime.
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 16 Jul 2010 22:25:00 +0000 (22:25 +0000)
committerRudolf Polzer <divverent@alientrap.org>
Wed, 21 Jul 2010 04:57:09 +0000 (06:57 +0200)
From: MirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10343 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=920346b7aebcb8d4312987e3bb4185be13c53c91

client.h
view.c

index 55f0864276a9fd486967be3be31e1b742ded8387..32de8a492d2edf76b655ed83f8df12ebc427b7ee 100644 (file)
--- a/client.h
+++ b/client.h
@@ -973,9 +973,8 @@ typedef struct client_state_s
        double lastongroundtime;
        double hitgroundtime;
        float bob2_smooth;
-
-       float ground_hit_speed;
-       float ground_hit_counter;
+       float bobfall_speed;
+       float bobfall_swing;
 
        // don't change view angle, full screen, etc
        int intermission;
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)