]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Fix broken recoil with r_stereo
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 30 Jun 2020 15:00:02 +0000 (15:00 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 30 Jun 2020 15:00:02 +0000 (15:00 +0000)
Patch by Gustaf Alhäll
https://gitlab.com/xonotic/darkplaces/-/merge_requests/50

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

cl_screen.c
view.c

index 7a8bf931e883cdfebae8177734db7005af935d5e..ac6b64307b41311c3786b0a6cd9f5e25bed906b7 100644 (file)
@@ -125,6 +125,8 @@ int                 scr_con_margin_bottom;
 
 extern int     con_vislines;
 
+extern int cl_punchangle_applied;
+
 static void SCR_ScreenShot_f(cmd_state_t *cmd);
 static void R_Envmap_f(cmd_state_t *cmd);
 
@@ -2718,6 +2720,9 @@ void CL_UpdateScreen(void)
        double drawscreendelta;
        r_viewport_t viewport;
 
+       // TODO: Move to a better place.
+       cl_punchangle_applied = 0;
+
        if(drawscreenstart)
        {
                drawscreendelta = Sys_DirtyTime() - drawscreenstart;
diff --git a/view.c b/view.c
index 8f9b9bf93cb2319a60a91796cbe2154f52f8e7c3..315738c2289b0b0c4599320a8b951f1b880edc0c 100644 (file)
--- a/view.c
+++ b/view.c
@@ -144,6 +144,7 @@ cvar_t v_yshearing = {CVAR_CLIENT, "v_yshearing", "0", "be all out of gum (set t
 
 float  v_dmg_time, v_dmg_roll, v_dmg_pitch;
 
+int cl_punchangle_applied;
 
 /*
 ===============
@@ -684,8 +685,15 @@ void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewa
                        // angles
                        if (cldead && v_deathtilt.integer)
                                viewangles[ROLL] = v_deathtiltangle.value;
-                       VectorAdd(viewangles, cl.punchangle, viewangles);
+
+                       // Hanicef: don't apply punchangle twice if the scene is rendered more than once.
+                       if (!cl_punchangle_applied)
+                       {
+                               VectorAdd(viewangles, cl.punchangle, viewangles);
+                               cl_punchangle_applied = 1;
+                       }
                        viewangles[ROLL] += V_CalcRoll(clviewangles, clvelocity);
+
                        if (v_dmg_time > 0)
                        {
                                viewangles[ROLL] += v_dmg_time/v_kicktime.value*v_dmg_roll;