From: havoc Date: Sun, 5 Jun 2005 09:27:19 +0000 (+0000) Subject: fix lagged prydon cursor trace bug (it was using renderer variables, now uses V_CalcR... X-Git-Tag: xonotic-v0.1.0preview~4784 X-Git-Url: http://de.git.xonotic.org/?a=commitdiff_plain;h=c3a1653e58a354780cc920457b7b29482386cbb9;p=xonotic%2Fdarkplaces.git fix lagged prydon cursor trace bug (it was using renderer variables, now uses V_CalcRefdef to get an up to date view matrix before this frame is even rendered) fixed 'shooting at world origin' bug due to a misplaced CL_UpdatePrydonCursor call (now in CL_SendMove so it works properly) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5398 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_input.c b/cl_input.c index a96b2a46..a0672769 100644 --- a/cl_input.c +++ b/cl_input.c @@ -439,6 +439,7 @@ void CL_Move (void) #include "cl_collision.h" +extern void V_CalcRefdef(void); void CL_UpdatePrydonCursor(void) { vec3_t temp, scale; @@ -479,11 +480,13 @@ void CL_UpdatePrydonCursor(void) // trace distance VectorScale(scale, 1000000, scale); - // FIXME: use something other than renderer variables here - // (but they need to match) - VectorCopy(r_vieworigin, cl.cmd.cursor_start); + // calculate current view matrix + V_CalcRefdef(); + VectorClear(temp); + Matrix4x4_Transform(&r_refdef.viewentitymatrix, temp, cl.cmd.cursor_start); VectorSet(temp, cl.cmd.cursor_screen[2] * scale[2], cl.cmd.cursor_screen[0] * scale[0], cl.cmd.cursor_screen[1] * scale[1]); - Matrix4x4_Transform(&r_view_matrix, temp, cl.cmd.cursor_end); + Matrix4x4_Transform(&r_refdef.viewentitymatrix, temp, cl.cmd.cursor_end); + // trace from view origin to the cursor cl.cmd.cursor_fraction = CL_SelectTraceLine(cl.cmd.cursor_start, cl.cmd.cursor_end, cl.cmd.cursor_impact, cl.cmd.cursor_normal, &cl.cmd.cursor_entitynumber, (chase_active.integer || cl.intermission) ? &cl_entities[cl.playerentity].render : NULL); // makes sparks where cursor is //CL_SparkShower(cl.cmd.cursor_impact, cl.cmd.cursor_normal, 5, 0); @@ -795,6 +798,8 @@ void CL_SendMove(void) upmove = cl.cmd.upmove; #endif + CL_UpdatePrydonCursor(); + buf.maxsize = 128; buf.cursize = 0; buf.data = data; diff --git a/cl_main.c b/cl_main.c index 736fea16..268a05fa 100644 --- a/cl_main.c +++ b/cl_main.c @@ -1297,9 +1297,6 @@ CL_SendCmd void CL_UpdatePrydonCursor(void); void CL_SendCmd(void) { - if (cls.signon == SIGNONS) - CL_UpdatePrydonCursor(); - if (cls.demoplayback) { SZ_Clear(&cls.message);