]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Even closer to a senseful code. We need to get just one swing using sin()
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 16 Jul 2010 22:24:42 +0000 (22:24 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 16 Jul 2010 22:24:42 +0000 (22:24 +0000)
From: MirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>

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

client.h
view.c

index 7769d5fa46a8515c2122eafe94efc58487179d0b..8b9298df64ce376d11987fdfd46fb21037321253 100644 (file)
--- a/client.h
+++ b/client.h
@@ -980,7 +980,6 @@ typedef struct client_state_s
        float bob2_smooth;
        
        float ground_hit_speed;
-       float ground_hit_target;
 
        // don't change view angle, full screen, etc
        int intermission;
diff --git a/view.c b/view.c
index ce439163ba32f6eea4f3cb278fe48559ef8b96f9..f35fb255410a0a664dccbd751952128afebb3477 100644 (file)
--- a/view.c
+++ b/view.c
@@ -719,18 +719,17 @@ void V_CalcRefdef (void)
                                        // get the speed while in the air, apply it while we're not
                                        if (!cl.onground)
                                        {
-                                               cl.ground_hit_speed = 0;
-                                               cl.ground_hit_target = cl.velocity[2] * 0.1; // replace 0.1 with cvar
+                                               cl.ground_hit_speed = cl.velocity[2] * 0.1; // replace 0.1 with cvar
                                        }
                                        else
                                        {
-                                               if(cl.ground_hit_speed > cl.ground_hit_target)
-                                                       cl.ground_hit_speed -= 0.1; // replace 0.1 with cvar
-                                               if(cl.ground_hit_speed < cl.ground_hit_target)
+                                               if(cl.ground_hit_speed < 0)
                                                        cl.ground_hit_speed += 0.1; // replace 0.1 with cvar
+                                               else
+                                                       cl.ground_hit_speed = 0;
 
-                                               vieworg[2] += sin(M_PI + M_PI * cl.ground_hit_speed * 0.2);
-                                               gunorg[2] += sin(M_PI + M_PI * cl.ground_hit_speed * 0.2);
+                                               vieworg[2] += sin(M_PI + M_PI * cl.ground_hit_speed * 1);
+                                               gunorg[2] += sin(M_PI + M_PI * cl.ground_hit_speed * 1);
                                        }
 
                                        // End of TEST!!!