Remove Q2 hacks from the usercmd_t type. Just translate them without trying to be clever.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6194 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
4b48a8b191
commit
01c498d136
4 changed files with 35 additions and 23 deletions
|
@ -231,13 +231,23 @@ 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;
|
||||
int step;
|
||||
int oldz;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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 ();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue