]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix most of the guneffect issues with warpzones
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 2 May 2010 14:10:12 +0000 (14:10 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 2 May 2010 14:10:12 +0000 (14:10 +0000)
From: Rudolf Polzer <divverent@alientrap.org>

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

client.h
view.c

index 5b2e1f9dd5c88539006ae16551dcf0cd78872e7f..3dd9a76f999214d1e9e1f9f1de6907014d2168fa 100644 (file)
--- a/client.h
+++ b/client.h
@@ -938,10 +938,12 @@ typedef struct client_state_s
        qboolean movement_replay_canjump;
 
        // previous gun angles (for leaning effects)
+       vec3_t gunangles_prev;
        vec3_t gunangles_highpass;
        vec3_t gunangles_adjustment_lowpass;
        vec3_t gunangles_adjustment_highpass;
        // previous gun angles (for leaning effects)
+       vec3_t gunorg_prev;
        vec3_t gunorg_highpass;
        vec3_t gunorg_adjustment_lowpass;
        vec3_t gunorg_adjustment_highpass;
diff --git a/view.c b/view.c
index 7daca6bfbc93056598e6ee60b673b27cb394d256..580851e4ad0a9241c6d90e074ea451dbf0e936c0 100644 (file)
--- a/view.c
+++ b/view.c
@@ -596,20 +596,24 @@ void V_CalcRefdef (void)
                                        {
                                                // try to fix the first highpass; result is NOT
                                                // perfect! TODO find a better fix
-                                               VectorCopy(cl.viewangles, cl.gunangles_highpass);
-                                               VectorCopy(cl.movement_origin, cl.gunorg_highpass);
-                                               // prevent further CHANGES caused by the high/lowpasses
-                                               // - a highpass will return the diff, a lowpass will
-                                               // return the saved value; note: the first diff will be 0!
-                                               frametime = 0;
+                                               VectorCopy(cl.viewangles, cl.gunangles_prev);
+                                               VectorCopy(cl.movement_origin, cl.gunorg_prev);
                                        }
 
                                        // 2. for the gun origin, only keep the high frequency (non-DC) parts, which is "somewhat like velocity"
+                                       VectorAdd(cl.gunorg_highpass, cl.gunorg_prev, cl.gunorg_highpass);
                                        highpass3_limited(cl.movement_origin, frametime*cl_followmodel_side_highpass1.value, cl_followmodel_side_limit.value, frametime*cl_followmodel_side_highpass1.value, cl_followmodel_side_limit.value, frametime*cl_followmodel_up_highpass1.value, cl_followmodel_up_limit.value, cl.gunorg_highpass, gunorg);
+                                       VectorCopy(cl.movement_origin, cl.gunorg_prev);
+                                       VectorSubtract(cl.gunorg_highpass, cl.gunorg_prev, cl.gunorg_highpass);
+
+                                       // in the highpass, we _store_ the DIFFERENCE to the actual view angles...
+                                       VectorAdd(cl.gunangles_highpass, cl.gunangles_prev, cl.gunangles_highpass);
                                        cl.gunangles_highpass[PITCH] += 360 * floor((cl.viewangles[PITCH] - cl.gunangles_highpass[PITCH]) / 360 + 0.5);
                                        cl.gunangles_highpass[YAW] += 360 * floor((cl.viewangles[YAW] - cl.gunangles_highpass[YAW]) / 360 + 0.5);
                                        cl.gunangles_highpass[ROLL] += 360 * floor((cl.viewangles[ROLL] - cl.gunangles_highpass[ROLL]) / 360 + 0.5);
                                        highpass3_limited(cl.viewangles, frametime*cl_leanmodel_up_highpass1.value, cl_leanmodel_up_limit.value, frametime*cl_leanmodel_side_highpass1.value, cl_leanmodel_side_limit.value, 0, 0, cl.gunangles_highpass, gunangles);
+                                       VectorCopy(cl.viewangles, cl.gunangles_prev);
+                                       VectorSubtract(cl.gunangles_highpass, cl.gunangles_prev, cl.gunangles_highpass);
 
                                        // 3. calculate the RAW adjustment vectors
                                        gunorg[0] *= (cl_followmodel.value ? -cl_followmodel_side_speed.value : 0);