]> 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)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 16 Jul 2010 22:24:54 +0000 (22:24 +0000)
From: MirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10342 d7cf8633-e32d-0410-b094-e92efae38249

client.h
view.c

index 8b9298df64ce376d11987fdfd46fb21037321253..a50f22772a178a8fc7c4c8d3ee325103ad63ffc8 100644 (file)
--- a/client.h
+++ b/client.h
@@ -978,8 +978,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!!!