]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
moved cl.movesequence/cl.servermovesequence to cls. struct, this keeps the movesequen...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 19 Feb 2007 23:17:21 +0000 (23:17 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 19 Feb 2007 23:17:21 +0000 (23:17 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6872 d7cf8633-e32d-0410-b094-e92efae38249

cl_input.c
client.h
csprogs.c
netconn.c
protocol.c

index 0fc37a56b7ed77fa0e598d4119186c42e3cd319a..9cf08eadcd824d20762288f208276bbfb1b854f1 100644 (file)
@@ -607,11 +607,11 @@ void CL_ClientMovement_Input(qboolean buttonjump, qboolean buttoncrouch)
        // remove stale queue items
        n = cl.movement_numqueue;
        cl.movement_numqueue = 0;
-       if (cl.servermovesequence)
+       if (cls.servermovesequence)
        {
                for (i = 0;i < n;i++)
                {
-                       if (cl.movement_queue[i].sequence > cl.servermovesequence)
+                       if (cl.movement_queue[i].sequence > cls.servermovesequence)
                                cl.movement_queue[cl.movement_numqueue++] = cl.movement_queue[i];
                        else if (i == 0)
                                cl.movement_replay_canjump = !cl.movement_queue[i].jump; // FIXME: this logic is quite broken
@@ -631,7 +631,7 @@ void CL_ClientMovement_Input(qboolean buttonjump, qboolean buttoncrouch)
        if (cl.movement_numqueue < (int)(sizeof(cl.movement_queue)/sizeof(cl.movement_queue[0])))
        {
                // add to input queue
-               cl.movement_queue[cl.movement_numqueue].sequence = cl.movesequence;
+               cl.movement_queue[cl.movement_numqueue].sequence = cls.movesequence;
                cl.movement_queue[cl.movement_numqueue].time = cl.movecmd[0].time;
                cl.movement_queue[cl.movement_numqueue].frametime = bound(0, cl.movecmd[0].time - cl.movecmd[1].time, 0.1);
                VectorCopy(cl.viewangles, cl.movement_queue[cl.movement_numqueue].viewangles);
@@ -1147,7 +1147,7 @@ void CL_ClientMovement_Replay(void)
                s.movevars_airaccel_sideways_friction = cl_movement_airaccel_sideways_friction.value;
        }
 
-       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);
+       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) || cls.servermovesequence);
        if (cl.movement_predicted)
        {
                //Con_Printf("%f: ", cl.movecmd[0].time);
@@ -1374,9 +1374,9 @@ void CL_SendMove(void)
                        cl.cmd.msec = 100;
                oldmsectime = msectime;
 
-               cl.movesequence++;
+               cls.movesequence++;
                if (cl_movement.integer)
-                       cl.cmd.sequence = cl.movesequence;
+                       cl.cmd.sequence = cls.movesequence;
                else
                        cl.cmd.sequence = 0;
 
@@ -1384,7 +1384,7 @@ void CL_SendMove(void)
                CL_UpdatePrydonCursor();
 
                // always dump the first two messages, because they may contain leftover inputs from the last level
-               if (cl.movesequence > 2)
+               if (cls.movesequence > 2)
                {
                        // update the cl.movecmd array which holds the most recent moves
                        for (i = CL_MAX_USERCMDS - 1;i >= 1;i--)
@@ -1507,7 +1507,7 @@ void CL_SendMove(void)
                                for (j = 0, cmd = &cl.movecmd[maxusercmds-1];j < maxusercmds;j++, cmd--)
                                {
                                        // don't repeat any stale moves
-                                       if (cmd->sequence && cmd->sequence < cl.servermovesequence)
+                                       if (cmd->sequence && cmd->sequence < cls.servermovesequence)
                                                continue;
                                        // 5/9 bytes
                                        MSG_WriteByte (&buf, clc_move);
index f53943dcb6aa045e6fe0ba001a333549fb1e6892..60d605db0c0d1ba61a9a8fd66887c8bf345aa887 100644 (file)
--- a/client.h
+++ b/client.h
@@ -509,6 +509,10 @@ typedef struct client_static_s
        // (note: qw_download variables are also used)
        cl_downloadack_t dp_downloadack[CL_MAX_DOWNLOADACKS];
 
+       // input sequence numbers are not reset on level change, only connect
+       int movesequence;
+       int servermovesequence;
+
        // quakeworld stuff below
 
        // value of "qport" cvar at time of connection
@@ -709,8 +713,6 @@ typedef struct client_state_s
        // queue of proposed moves
        int movement_numqueue;
        client_movementqueue_t movement_queue[256];
-       int movesequence;
-       int servermovesequence;
        // whether the replay should allow a jump at the first sequence
        qboolean movement_replay_canjump;
 
index 1268888dd6eb7a248a4666602b0dc76a0b65587d..661f23830d6d3d2d88850d2b7763bfd7df004f2e 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -66,8 +66,8 @@ static void CSQC_SetGlobals (void)
                prog->globals.client->time = cl.time;
                prog->globals.client->frametime = cl.time - csqc_frametime;
                csqc_frametime = cl.time;
-               prog->globals.client->servercommandframe = cl.servermovesequence;
-               prog->globals.client->clientcommandframe = cl.movesequence;
+               prog->globals.client->servercommandframe = cls.servermovesequence;
+               prog->globals.client->clientcommandframe = cls.movesequence;
                VectorCopy(cl.viewangles, prog->globals.client->input_angles);
                VectorCopy(cl.viewangles, csqc_angles);
                prog->globals.client->input_buttons = cl.cmd.buttons;
index eec93bcc8ee109f50bef3c2b10daf1095bc21eb9..180c78e364351bfea8f859c55147e97c26fd4bf5 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -1092,6 +1092,9 @@ void NetConn_ConnectionEstablished(lhnetsocket_t *mysocket, lhnetaddress_t *peer
        cls.state = ca_connected;
        cls.signon = 0;                         // need all the signon messages before playing
        cls.protocol = initialprotocol;
+       // reset move sequence numbering on this new connection
+       cls.movesequence = 0;
+       cls.servermovesequence = 0;
        if (cls.protocol == PROTOCOL_QUAKEWORLD)
                Cmd_ForwardStringToServer("new");
        if (cls.protocol == PROTOCOL_QUAKE)
index cfa837bf51d4f6266b72217372c953e1933dad45..6e62bddb0c28f5117816ee4c392df07e83098a96 100644 (file)
@@ -2038,7 +2038,7 @@ void EntityFrame5_CL_ReadFrame(void)
        if (developer_networkentities.integer)
                Con_Printf("recv: svc_entities %i\n", cl.latestframenums[LATESTFRAMENUMS-1]);
        if (cls.protocol != PROTOCOL_QUAKE && cls.protocol != PROTOCOL_QUAKEDP && cls.protocol != PROTOCOL_NEHAHRAMOVIE && cls.protocol != PROTOCOL_DARKPLACES1 && cls.protocol != PROTOCOL_DARKPLACES2 && cls.protocol != PROTOCOL_DARKPLACES3 && cls.protocol != PROTOCOL_DARKPLACES4 && cls.protocol != PROTOCOL_DARKPLACES5 && cls.protocol != PROTOCOL_DARKPLACES6)
-               cl.servermovesequence = MSG_ReadLong();
+               cls.servermovesequence = MSG_ReadLong();
        // read entity numbers until we find a 0x8000
        // (which would be remove world entity, but is actually a terminator)
        while ((n = (unsigned short)MSG_ReadShort()) != 0x8000 && !msg_badread)