]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_input.c
eliminated cl.csqc_entities array and related fields
[xonotic/darkplaces.git] / cl_input.c
index c4b05acc0ef6fcc0361b248c2b01b5486a8fcbc9..a6f447610c8ba75e47ae954f24bd41a25dc364da 100644 (file)
@@ -517,10 +517,9 @@ void CL_Move (void)
 
 #include "cl_collision.h"
 
-extern void V_CalcRefdef(void);
 void CL_UpdatePrydonCursor(void)
 {
-       vec3_t temp, scale;
+       vec3_t temp;
 
        if (!cl_prydoncursor.integer)
                VectorClear(cl.cmd.cursor_screen);
@@ -551,21 +550,13 @@ void CL_UpdatePrydonCursor(void)
        cl.cmd.cursor_screen[1] = bound(-1, cl.cmd.cursor_screen[1], 1);
        cl.cmd.cursor_screen[2] = 1;
 
-       scale[0] = -r_view.frustum_x;
-       scale[1] = -r_view.frustum_y;
-       scale[2] = 1;
-
-       // trace distance
-       VectorScale(scale, 1000000, scale);
-
        // calculate current view matrix
-       //V_CalcRefdef();
-       VectorClear(temp);
-       Matrix4x4_Transform(&r_view.matrix, 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_OriginFromMatrix(&r_view.matrix, cl.cmd.cursor_start);
+       // calculate direction vector of cursor in viewspace by using frustum slopes
+       VectorSet(temp, cl.cmd.cursor_screen[2] * 1000000, cl.cmd.cursor_screen[0] * -r_view.frustum_x * 1000000, cl.cmd.cursor_screen[1] * -r_view.frustum_y * 1000000);
        Matrix4x4_Transform(&r_view.matrix, 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, false);
+       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);
 }
 
 void CL_ClientMovement_InputQW(qw_usercmd_t *cmd)
@@ -1152,7 +1143,7 @@ void CL_ClientMovement_Replay(void)
                s.movevars_airaccel_sideways_friction = cl_movement_airaccel_sideways_friction.value;
        }
 
-       cl.movement_predicted = (cl_movement.integer && cls.signon == SIGNONS && cl.stats[STAT_HEALTH] > 0 && !cl.intermission) && ((cls.protocol != PROTOCOL_DARKPLACES6 && cls.protocol != PROTOCOL_DARKPLACES7) || cl.servermovesequence);
+       cl.movement_predicted = (cl_movement.integer && !cls.demoplayback && cls.signon == SIGNONS && cl.stats[STAT_HEALTH] > 0 && !cl.intermission) && ((cls.protocol != PROTOCOL_DARKPLACES6 && cls.protocol != PROTOCOL_DARKPLACES7) || cl.servermovesequence);
        if (cl.movement_predicted)
        {
                //Con_Printf("%f: ", cl.mtime[0]);
@@ -1556,6 +1547,19 @@ void CL_SendMove(void)
                // PROTOCOL_DARKPLACES7 = 71 bytes per packet
        }
 
+       if (cls.protocol != PROTOCOL_QUAKEWORLD)
+       {
+               // acknowledge any recently received data blocks
+               for (i = 0;i < CL_MAX_DOWNLOADACKS && (cls.dp_downloadack[i].start || cls.dp_downloadack[i].size);i++)
+               {
+                       MSG_WriteByte(&buf, clc_ackdownloaddata);
+                       MSG_WriteLong(&buf, cls.dp_downloadack[i].start);
+                       MSG_WriteShort(&buf, cls.dp_downloadack[i].size);
+                       cls.dp_downloadack[i].start = 0;
+                       cls.dp_downloadack[i].size = 0;
+               }
+       }
+
        // send the reliable message (forwarded commands) if there is one
        NetConn_SendUnreliableMessage(cls.netcon, &buf, cls.protocol);