]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - view.c
add a trivial quarter-res S3TC decoder to DDS loading
[xonotic/darkplaces.git] / view.c
diff --git a/view.c b/view.c
index 9e4a7f05a1641f9f2b3939162ff1e651354b24a1..48a5dd4ba8ae284cf625fae84dc3b083402de23f 100644 (file)
--- a/view.c
+++ b/view.c
@@ -478,9 +478,9 @@ void V_CalcRefdef (void)
                        else
                        {
                                if (cl.stairsmoothz < vieworg[2])
-                                       vieworg[2] = cl.stairsmoothz = bound(vieworg[2] - 16, cl.stairsmoothz + smoothtime * cl_stairsmoothspeed.value, vieworg[2]);
+                                       vieworg[2] = cl.stairsmoothz = bound(vieworg[2] - cl.movevars_stepheight, cl.stairsmoothz + smoothtime * cl_stairsmoothspeed.value, vieworg[2]);
                                else if (cl.stairsmoothz > vieworg[2])
-                                       vieworg[2] = cl.stairsmoothz = bound(vieworg[2], cl.stairsmoothz - smoothtime * cl_stairsmoothspeed.value, vieworg[2] + 16);
+                                       vieworg[2] = cl.stairsmoothz = bound(vieworg[2], cl.stairsmoothz - smoothtime * cl_stairsmoothspeed.value, vieworg[2] + cl.movevars_stepheight);
                        }
 
                        // apply qw weapon recoil effect (this did not work in QW)
@@ -680,9 +680,9 @@ void V_CalcRefdef (void)
                                                cycle = cl.time / cl_bob2cycle.value;
                                                cycle -= (int) cycle;
                                                if (cycle < 0.5)
-                                                       cycle = sin(M_PI * cycle / 0.5);
+                                                       cycle = cos(M_PI * cycle / 0.5); // cos looks better here with the other view bobbing using sin
                                                else
-                                                       cycle = sin(M_PI + M_PI * (cycle-0.5)/0.5);
+                                                       cycle = cos(M_PI + M_PI * (cycle-0.5)/0.5);
                                                bob = bound(0, cl_bob2.value, 0.05) * cycle;
 
                                                // this value slowly decreases from 1 to 0 when we stop touching the ground.
@@ -727,23 +727,19 @@ void V_CalcRefdef (void)
                                                        if (cl.velocity[2] < -cl_bobfallminspeed.value)
                                                                cl.bobfall_swing = 1;
                                                        else
-                                                               cl.bobfall_swing = 0;
+                                                               cl.bobfall_swing = 0; // TODO really?
                                                }
                                                else
                                                {
-                                                       if(cl.bobfall_swing > 0)
-                                                               cl.bobfall_swing -= bound(0, cl_bobfallcycle.value * frametime, 1);
-                                                       else
-                                                               cl.bobfall_swing = 0;
+                                                       cl.bobfall_swing = max(0, cl.bobfall_swing - cl_bobfallcycle.value * frametime);
 
-                                                       bobfall = sin(M_PI + M_PI * cl.bobfall_swing) * -cl.bobfall_speed;
+                                                       bobfall = sin(M_PI * cl.bobfall_swing) * cl.bobfall_speed;
                                                        vieworg[2] += bobfall;
                                                        gunorg[2] += bobfall;
                                                }
                                        }
 
                                        // gun model bobbing code
-                                       if (cl_bob.value || cl_bob2.value)
                                        if (cl_bobmodel.value)
                                        {
                                                // calculate for swinging gun model
@@ -790,7 +786,7 @@ void V_CalcRefdef (void)
                        if (v_idlescale.value)
                                Matrix4x4_CreateFromQuakeEntity(&r_refdef.view.matrix, vieworg[0], vieworg[1], vieworg[2], viewangles[0] + v_idlescale.value * sin(cl.time*v_ipitch_cycle.value) * v_ipitch_level.value, viewangles[1] + v_idlescale.value * sin(cl.time*v_iyaw_cycle.value) * v_iyaw_level.value, viewangles[2] + v_idlescale.value * sin(cl.time*v_iroll_cycle.value) * v_iroll_level.value, 1);
                        else
-                               Matrix4x4_CreateFromQuakeEntity(&r_refdef.view.matrix, vieworg[0], vieworg[1], vieworg[2], viewangles[0], viewangles[1], viewangles[2] + v_idlescale.value * sin(cl.time*v_iroll_cycle.value) * v_iroll_level.value, 1);
+                               Matrix4x4_CreateFromQuakeEntity(&r_refdef.view.matrix, vieworg[0], vieworg[1], vieworg[2], viewangles[0], viewangles[1], viewangles[2], 1);
                        // calculate a viewmodel matrix for use in view-attached entities
                        Matrix4x4_CreateFromQuakeEntity(&viewmodelmatrix, gunorg[0], gunorg[1], gunorg[2], gunangles[0], gunangles[1], gunangles[2], cl_viewmodel_scale.value);
                        VectorCopy(vieworg, cl.csqc_origin);