diff --git a/engine/client/cl_pred.c b/engine/client/cl_pred.c index ef9a8b3d7..4e57aef62 100644 --- a/engine/client/cl_pred.c +++ b/engine/client/cl_pred.c @@ -231,14 +231,24 @@ CL_PredictMovement Sets cl.predicted_origin and cl.predicted_angles ================= */ +static void CLQ2_UserCmdToQ2(q2usercmd_t *out, const usercmd_t *cmd) +{ + out->msec = cmd->msec; + out->buttons = cmd->buttons; + VectorCopy(cmd->angles, out->angles); + out->forwardmove = cmd->forwardmove; + out->sidemove = cmd->sidemove; + out->upmove = cmd->upmove; + out->impulse = cmd->impulse; + out->lightlevel = cmd->lightlevel; +} static void CLQ2_PredictMovement (int seat) //q2 doesn't support split clients. { #ifdef Q2BSPS int ack, current; int frame; int oldframe; - q2usercmd_t *cmd; - q2pmove_t pm; + q2pmove_t pm; int step; int oldz; #endif @@ -293,10 +303,7 @@ static void CLQ2_PredictMovement (int seat) //q2 doesn't support split clients. while (++ack < current) { frame = ack & (UPDATE_MASK); - cmd = (q2usercmd_t*)&cl.outframes[frame].cmd[seat]; - cmd->msec = cl.outframes[frame].cmd[seat].msec; - - pm.cmd = *cmd; + CLQ2_UserCmdToQ2(&pm.cmd, &cl.outframes[frame].cmd[seat]); Q2_Pmove (&pm); // save for debug checking @@ -305,10 +312,7 @@ static void CLQ2_PredictMovement (int seat) //q2 doesn't support split clients. if (cl_pendingcmd[seat].msec) { - cmd = (q2usercmd_t*)&cl_pendingcmd[seat]; - cmd->msec = cl_pendingcmd[seat].msec; - - pm.cmd = *cmd; + CLQ2_UserCmdToQ2(&pm.cmd, &cl_pendingcmd[seat]); Q2_Pmove (&pm); } diff --git a/engine/common/common.c b/engine/common/common.c index 4ebed5e48..d1e86e81f 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -2412,13 +2412,12 @@ void MSGQ2_ReadDeltaUsercmd (const usercmd_t *from, usercmd_t *move) else move->buttons = MSG_ReadByte (); } - move->buttons_compat = move->buttons & 0xff; if (bits & Q2CM_IMPULSE) move->impulse = MSG_ReadByte (); // read time to run command - move->msec_compat = move->msec = MSG_ReadByte (); + move->msec = MSG_ReadByte (); move->lightlevel = MSG_ReadByte (); } diff --git a/engine/common/protocol.h b/engine/common/protocol.h index ec2e03b97..aa91b359b 100644 --- a/engine/common/protocol.h +++ b/engine/common/protocol.h @@ -1270,14 +1270,10 @@ struct vrdevinfo_s }; typedef struct usercmd_s { - //the first members of this structure MUST match the q2 version - qbyte msec_compat; - qbyte buttons_compat; short angles[3]; - short forwardmove, sidemove, upmove; - qbyte impulse; - qbyte lightlevel; - //end q2 compat + signed int forwardmove,sidemove,upmove; + unsigned int impulse; + unsigned int lightlevel; unsigned int sequence; // just for debugging prints float msec; //replace msec, but with more precision diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index 7cacbecb6..30d6cb0f5 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -8447,6 +8447,19 @@ void SV_ExecuteClientMessage (client_t *cl) sv_player = NULL; } #ifdef Q2SERVER +static void SVQ2_ClientThink(q2edict_t *ed, usercmd_t *cmd) +{ + q2usercmd_t q2; + q2.msec = cmd->msec; + q2.buttons = cmd->buttons; + VectorCopy(cmd->angles, q2.angles); + q2.forwardmove = cmd->forwardmove; + q2.sidemove = cmd->sidemove; + q2.upmove = cmd->upmove; + q2.impulse = cmd->impulse; + q2.lightlevel = cmd->lightlevel; + ge->ClientThink (ed, &q2); +} void SVQ2_ExecuteClientMessage (client_t *cl) { int c; @@ -8603,15 +8616,15 @@ void SVQ2_ExecuteClientMessage (client_t *cl) { while (net_drop > 2) { - ge->ClientThink (split->q2edict, (q2usercmd_t*)&split->lastcmd); + SVQ2_ClientThink (split->q2edict, &split->lastcmd); net_drop--; } if (net_drop > 1) - ge->ClientThink (split->q2edict, (q2usercmd_t*)&oldest); + SVQ2_ClientThink (split->q2edict, &oldest); if (net_drop > 0) - ge->ClientThink (split->q2edict, (q2usercmd_t*)&oldcmd); + SVQ2_ClientThink (split->q2edict, &oldcmd); } - ge->ClientThink (split->q2edict, (q2usercmd_t*)&newcmd); + SVQ2_ClientThink (split->q2edict, &newcmd); } split->lastcmd = newcmd;