]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Use averaging for calculating the leaning speed. Most of the credits go to FruitieX...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 2 May 2010 14:08:01 +0000 (14:08 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 2 May 2010 14:08:01 +0000 (14:08 +0000)
From: MirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>

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

darkplaces.txt
view.c

index a00d9f2a761938bbb78afa612a3527a3ec498880..dff513335c7fd86ced6267d182825526e1a5751a 100644 (file)
@@ -401,10 +401,10 @@ cl_bobmodel_side                                  0.05                gun bobbin
 cl_bobmodel_speed                                 7                   gun bobbing speed
 cl_bobmodel_up                                    0.02                gun bobbing upward movement amount
 cl_leanmodel_side                                 1                   enables gun leaning sideways
-cl_leanmodel_side_speed                           20                  gun leaning sideways speed
+cl_leanmodel_side_speed                           0.4                 gun leaning sideways speed
 cl_leanmodel_side_limit                           35                  gun leaning sideways limit
 cl_leanmodel_up                                   1                   enables gun leaning upward
-cl_leanmodel_up_speed                             15                  gun leaning upward speed
+cl_leanmodel_up_speed                             0.35                gun leaning upward speed
 cl_leanmodel_up_limit                             25                  gun leaning upward limit
 cl_followmodel_side                               1                   enables gun following sideways
 cl_followmodel_side_speed                         15                  gun following sideways speed
diff --git a/view.c b/view.c
index 5dd7266a395d438cadb0e0da72f8936d92f46330..e6bdf96677a8bfa6e4a93f39d890975d1ff8461f 100644 (file)
--- a/view.c
+++ b/view.c
@@ -46,10 +46,10 @@ cvar_t cl_bobmodel_up = {CVAR_SAVE, "cl_bobmodel_up", "0.06", "gun bobbing upwar
 cvar_t cl_bobmodel_speed = {CVAR_SAVE, "cl_bobmodel_speed", "7", "gun bobbing speed"};
 
 cvar_t cl_leanmodel_side = {CVAR_SAVE, "cl_leanmodel_side", "1", "enables gun leaning sideways"};
-cvar_t cl_leanmodel_side_speed = {CVAR_SAVE, "cl_leanmodel_side_speed", "20", "gun leaning sideways speed"};
+cvar_t cl_leanmodel_side_speed = {CVAR_SAVE, "cl_leanmodel_side_speed", "0.4", "gun leaning sideways speed"};
 cvar_t cl_leanmodel_side_limit = {CVAR_SAVE, "cl_leanmodel_side_limit", "35", "gun leaning sideways limit"};
 cvar_t cl_leanmodel_up = {CVAR_SAVE, "cl_leanmodel_up", "1", "enables gun leaning upward"};
-cvar_t cl_leanmodel_up_speed = {CVAR_SAVE, "cl_leanmodel_up_speed", "15", "gun leaning upward speed"};
+cvar_t cl_leanmodel_up_speed = {CVAR_SAVE, "cl_leanmodel_up_speed", "0.35", "gun leaning upward speed"};
 cvar_t cl_leanmodel_up_limit = {CVAR_SAVE, "cl_leanmodel_up_limit", "25", "gun leaning upward limit"};
 
 cvar_t cl_followmodel_side = {CVAR_SAVE, "cl_followmodel_side", "1", "enables gun following sideways"};
@@ -545,7 +545,8 @@ void V_CalcRefdef (void)
                                                        cl.viewmodel_push_x -= 360;
 
                                                d = cl.viewangles[PITCH] - cl.viewmodel_push_x;
-                                               cl.viewmodel_push_x = bound(cl.viewangles[PITCH] - cl_leanmodel_up_limit.value, cl.viewmodel_push_x + d * cl_leanmodel_up_speed.value * ef_speed, cl.viewangles[PITCH] + cl_leanmodel_up_limit.value);
+                                               cl_leanmodel_up_speed.value = bound(0, cl_leanmodel_up_speed.value, 1);
+                                               cl.viewmodel_push_x = bound(cl.viewangles[PITCH] - cl_leanmodel_up_limit.value, cl.viewmodel_push_x * (1 - cl_leanmodel_up_speed.value) + cl.viewangles[PITCH] * cl_leanmodel_up_speed.value, cl.viewangles[PITCH] + cl_leanmodel_up_limit.value);
                                        }
                                        else
                                                cl.viewmodel_push_x = cl.viewangles[PITCH];
@@ -559,7 +560,8 @@ void V_CalcRefdef (void)
                                                        cl.viewmodel_push_y -= 360;
 
                                                d = cl.viewangles[YAW] - cl.viewmodel_push_y;
-                                               cl.viewmodel_push_y = bound(cl.viewangles[YAW] - cl_leanmodel_side_limit.value, cl.viewmodel_push_y + d * cl_leanmodel_side_speed.value * ef_speed, cl.viewangles[YAW] + cl_leanmodel_side_limit.value);
+                                               cl_leanmodel_side_speed.value = bound(0, cl_leanmodel_side_speed.value, 1);
+                                               cl.viewmodel_push_y = bound(cl.viewangles[YAW] - cl_leanmodel_side_limit.value, cl.viewmodel_push_y * (1 - cl_leanmodel_side_speed.value) + cl.viewangles[YAW] * cl_leanmodel_side_speed.value, cl.viewangles[YAW] + cl_leanmodel_side_limit.value);
                                        }
                                        else
                                                cl.viewmodel_push_y = cl.viewangles[YAW];