From: cloudwalk Date: Tue, 30 Jun 2020 15:00:02 +0000 (+0000) Subject: Fix broken recoil with r_stereo X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2f1e6374fb8919e6e4844e8ff2b2eac2bb7b85f5;p=xonotic%2Fdarkplaces.git Fix broken recoil with r_stereo 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 --- diff --git a/cl_screen.c b/cl_screen.c index 7a8bf931..ac6b6430 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -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 8f9b9bf9..315738c2 100644 --- 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;