]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Limits for part 2.
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 2 May 2010 14:05:27 +0000 (14:05 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 2 May 2010 14:05:27 +0000 (14:05 +0000)
From: MirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>

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

view.c

diff --git a/view.c b/view.c
index 4172d096314dafa30b5e8cc67a3bde70c9f05a1d..39c4be9c29009accc70ecbf5946081858ac9158b 100644 (file)
--- a/view.c
+++ b/view.c
@@ -655,19 +655,49 @@ void V_CalcRefdef (void)
                                // gun model following code
 
                                if(gunorg_follow[0] < vieworg[0])
-                                       gunorg_follow[0] += (vieworg[0] - gunorg_follow[0]) * 5 * ef_speed;
+                               {
+                                       if(vieworg[0] - gunorg_follow[0] > 5)
+                                               gunorg_follow[0] = vieworg[0] - 5;
+                                       else
+                                               gunorg_follow[0] += (vieworg[0] - gunorg_follow[0]) * 5 * ef_speed;
+                               }
                                if(gunorg_follow[0] > vieworg[0])
-                                       gunorg_follow[0] -= (gunorg_follow[0] - vieworg[0]) * 5 * ef_speed;
+                               {
+                                       if(gunorg_follow[0] - vieworg[0] > 5)
+                                               gunorg_follow[0] = vieworg[0] + 5;
+                                       else
+                                               gunorg_follow[0] -= (gunorg_follow[0] - vieworg[0]) * 5 * ef_speed;
+                               }
 
                                if(gunorg_follow[1] < vieworg[1])
-                                       gunorg_follow[1] += (vieworg[1] - gunorg_follow[1]) * 5 * ef_speed;
+                               {
+                                       if(vieworg[1] - gunorg_follow[1] > 5)
+                                               gunorg_follow[1] = vieworg[1] - 5;
+                                       else
+                                               gunorg_follow[1] += (vieworg[1] - gunorg_follow[1]) * 5 * ef_speed;
+                               }
                                if(gunorg_follow[1] > vieworg[1])
-                                       gunorg_follow[1] -= (gunorg_follow[1] - vieworg[1]) * 5 * ef_speed;
+                               {
+                                       if(gunorg_follow[1] - vieworg[1] > 5)
+                                               gunorg_follow[1] = vieworg[1] + 5;
+                                       else
+                                               gunorg_follow[1] -= (gunorg_follow[1] - vieworg[1]) * 5 * ef_speed;
+                               }
 
                                if(gunorg_follow[2] < vieworg[2])
-                                       gunorg_follow[2] += (vieworg[2] - gunorg_follow[2]) * 5 * ef_speed;
+                               {
+                                       if(vieworg[2] - gunorg_follow[2] > 5)
+                                               gunorg_follow[2] = vieworg[2] - 5;
+                                       else
+                                               gunorg_follow[2] += (vieworg[2] - gunorg_follow[2]) * 5 * ef_speed;
+                               }
                                if(gunorg_follow[2] > vieworg[2])
-                                       gunorg_follow[2] -= (gunorg_follow[2] - vieworg[2]) * 5 * ef_speed;
+                               {
+                                       if(gunorg_follow[2] - vieworg[2] > 5)
+                                               gunorg_follow[2] = vieworg[2] + 5;
+                                       else
+                                               gunorg_follow[2] -= (gunorg_follow[2] - vieworg[2]) * 5 * ef_speed;
+                               }
 
                                VectorCopy(gunorg_follow, gunorg);
                                }