]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Very close to getting the correct maths done. It now works as intended, just need...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 16 Jul 2010 22:24:54 +0000 (22:24 +0000)
committerRudolf Polzer <divverent@alientrap.org>
Wed, 21 Jul 2010 04:57:08 +0000 (06:57 +0200)
From: MirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10342 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=32b18b93983c83da15df794ae4e21323159cc2a5

client.h
view.c

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