move SV_WriteClientToDemo (going step by step now)

This commit is contained in:
Bill Currie 2005-04-30 04:37:01 +00:00
parent d308d324cc
commit e500935f1f
3 changed files with 60 additions and 61 deletions

View file

@ -124,7 +124,6 @@ extern struct cvar_s *sv_demotxt;
extern struct cvar_s *serverdemo;
void DemoWrite_Begin (byte type, int to, int size);
void SV_WriteClientToDemo (sizebuf_t *msg, int i, demo_client_t *cl);
void SV_DemoWritePackets (int num);
void SV_Stop (int reason);
void DemoSetMsgBuf (demobuf_t *prev, demobuf_t *cur);

View file

@ -211,66 +211,6 @@ SV_DemoWriteToDisk (int type, int to, float time)
}
}
void
SV_WriteClientToDemo (sizebuf_t *msg, int i, demo_client_t *cl)
{
float *origin, *angles;
int flags;
int j;
demoinfo_t *demoinfo = &demo.info[i];
origin = cl->info.origin;
angles = cl->info.angles;
// now write it to buf
flags = cl->flags;
for (j = 0; j < 3; j++)
if (origin[j] != demoinfo->origin[j])
flags |= DF_ORIGIN << j;
for (j = 0; j < 3; j++)
if (angles[j] != demoinfo->angles[j])
flags |= DF_ANGLES << j;
if (cl->info.model != demoinfo->model)
flags |= DF_MODEL;
if (cl->info.effects != demoinfo->effects)
flags |= DF_EFFECTS;
if (cl->info.skinnum != demoinfo->skinnum)
flags |= DF_SKINNUM;
if (cl->info.weaponframe != demoinfo->weaponframe)
flags |= DF_WEAPONFRAME;
MSG_WriteByte (msg, svc_playerinfo);
MSG_WriteByte (msg, i);
MSG_WriteShort (msg, flags);
MSG_WriteByte (msg, cl->frame);
for (j = 0; j < 3; j++)
if (flags & (DF_ORIGIN << j))
MSG_WriteCoord (msg, origin[j]);
for (j = 0; j < 3; j++)
if (flags & (DF_ANGLES << j))
MSG_WriteAngle16 (msg, angles[j]);
if (flags & DF_MODEL)
MSG_WriteByte (msg, cl->info.model);
if (flags & DF_SKINNUM)
MSG_WriteByte (msg, cl->info.skinnum);
if (flags & DF_EFFECTS)
MSG_WriteByte (msg, cl->info.effects);
if (flags & DF_WEAPONFRAME)
MSG_WriteByte (msg, cl->info.weaponframe);
*demoinfo = cl->info;
}
void
SV_DemoWritePackets (int num)
{

View file

@ -395,6 +395,66 @@ SV_EmitPacketEntities (client_t *client, packet_entities_t *to, sizebuf_t *msg)
MSG_WriteShort (msg, 0); // end of packetentities
}
static void
SV_WriteClientToDemo (sizebuf_t *msg, int i, demo_client_t *cl)
{
float *origin, *angles;
int flags;
int j;
demoinfo_t *demoinfo = &demo.info[i];
origin = cl->info.origin;
angles = cl->info.angles;
// now write it to buf
flags = cl->flags;
for (j = 0; j < 3; j++)
if (origin[j] != demoinfo->origin[j])
flags |= DF_ORIGIN << j;
for (j = 0; j < 3; j++)
if (angles[j] != demoinfo->angles[j])
flags |= DF_ANGLES << j;
if (cl->info.model != demoinfo->model)
flags |= DF_MODEL;
if (cl->info.effects != demoinfo->effects)
flags |= DF_EFFECTS;
if (cl->info.skinnum != demoinfo->skinnum)
flags |= DF_SKINNUM;
if (cl->info.weaponframe != demoinfo->weaponframe)
flags |= DF_WEAPONFRAME;
MSG_WriteByte (msg, svc_playerinfo);
MSG_WriteByte (msg, i);
MSG_WriteShort (msg, flags);
MSG_WriteByte (msg, cl->frame);
for (j = 0; j < 3; j++)
if (flags & (DF_ORIGIN << j))
MSG_WriteCoord (msg, origin[j]);
for (j = 0; j < 3; j++)
if (flags & (DF_ANGLES << j))
MSG_WriteAngle16 (msg, angles[j]);
if (flags & DF_MODEL)
MSG_WriteByte (msg, cl->info.model);
if (flags & DF_SKINNUM)
MSG_WriteByte (msg, cl->info.skinnum);
if (flags & DF_EFFECTS)
MSG_WriteByte (msg, cl->info.effects);
if (flags & DF_WEAPONFRAME)
MSG_WriteByte (msg, cl->info.weaponframe);
*demoinfo = cl->info;
}
static void
SV_WritePlayersToClient (client_t *client, edict_t *clent, byte *pvs,
sizebuf_t *msg)