More nail speedups for qw.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2002-06-29 18:28:32 +00:00
parent 2a3c31edbe
commit d2dd6db51f
3 changed files with 22 additions and 26 deletions

View file

@ -164,7 +164,7 @@ SV_StartSound (edict_t *entity, int channel, const char *sample, int volume,
MSG_WriteByte (&sv.datagram, attenuation * 64);
MSG_WriteShort (&sv.datagram, channel);
MSG_WriteByte (&sv.datagram, sound_num);
for (i=0; i < 3; i++)
for (i=0; i < 3; i++) // FIXME: replace with MSG_WriteCoordV?
MSG_WriteCoord (&sv.datagram, SVvector (entity, origin)[i] + 0.5 *
(SVvector (entity, mins)[i] +
SVvector (entity, maxs)[i]));
@ -519,7 +519,7 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
MSG_WriteByte (msg, svc_damage);
MSG_WriteByte (msg, SVfloat (ent, dmg_save));
MSG_WriteByte (msg, SVfloat (ent, dmg_take));
for (i=0; i < 3; i++)
for (i=0; i < 3; i++) // FIXME: replace with MSG_WriteCoordV
MSG_WriteCoord (msg, SVvector (other, origin)[i] + 0.5 *
(SVvector (other, mins)[i] +
SVvector (other, maxs)[i]));

View file

@ -957,12 +957,13 @@ NET_SVC_Nails_Emit (net_svc_nails_t *block, sizebuf_t *buf)
{
int i, j;
int x, y, z, p, yaw;
byte bits[6]; // [48 bits] xyzpy 12 12 12 4 8
byte *msg; // [48 bits] xyzpy 12 12 12 4 8
if (block->numnails > MAX_PROJECTILES)
return NET_ERROR;
MSG_WriteByte (buf, block->numnails);
msg = SZ_GetSpace (buf, block->numnails * 6 + 1);
*msg++ = block->numnails;
for (i = 0; i < block->numnails; i++) {
x = ((int) (block->nails[i].origin[0] + 4096 + 1) >> 1) & 4095;
@ -971,15 +972,12 @@ NET_SVC_Nails_Emit (net_svc_nails_t *block, sizebuf_t *buf)
p = (int) (block->nails[i].angles[0] * (16.0 / 360.0)) & 15;
yaw = (int) (block->nails[i].angles[1] * (256.0 / 360.0)) & 255;
bits[0] = x;
bits[1] = (x >> 8) | (y << 4);
bits[2] = (y >> 4);
bits[3] = z;
bits[4] = (z >> 8) | (p << 4);
bits[5] = yaw;
for (j = 0; j < 6; j++)
MSG_WriteByte (buf, bits[j]);
*msg++ = x;
*msg++= (x >> 8) | (y << 4);
*msg++ = (y >> 4);
*msg++ = z;
*msg++ = (z >> 8) | (p << 4);
*msg++ = yaw;
}
return buf->overflowed;

View file

@ -126,15 +126,16 @@ SV_AddNailUpdate (edict_t *ent)
void
SV_EmitNailUpdate (sizebuf_t *msg)
{
byte bits[6]; // [48 bits] xyzpy 12 12 12 4 8
int i, n, p, x, y, z, yaw;
byte *buf; // [48 bits] xyzpy 12 12 12 4 8
int n, p, x, y, z, yaw;
edict_t *ent;
if (!numnails)
return;
MSG_WriteByte (msg, svc_nails);
MSG_WriteByte (msg, numnails);
buf = SZ_GetSpace (msg, numnails * 6 + 2);
*buf++ = svc_nails;
*buf++ = numnails;
for (n = 0; n < numnails; n++) {
ent = nails[n];
@ -144,15 +145,12 @@ SV_EmitNailUpdate (sizebuf_t *msg)
p = (int) (SVvector (ent, angles)[0] * (16.0 / 360.0)) & 15;
yaw = (int) (SVvector (ent, angles)[1] * (256.0 / 360.0)) & 255;
bits[0] = x;
bits[1] = (x >> 8) | (y << 4);
bits[2] = (y >> 4);
bits[3] = z;
bits[4] = (z >> 8) | (p << 4);
bits[5] = yaw;
for (i = 0; i < 6; i++)
MSG_WriteByte (msg, bits[i]);
*buf++ = x;
*buf++ = (x >> 8) | (y << 4);
*buf++ = (y >> 4);
*buf++ = z;
*buf++ = (z >> 8) | (p << 4);
*buf++ = yaw;
}
}