Whitespace, and fixes for SV_EmitNailUpdate.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2002-06-28 02:11:13 +00:00
parent 536937b2e6
commit 1555324e0d
1 changed files with 38 additions and 42 deletions

View File

@ -114,7 +114,8 @@ qboolean
SV_AddNailUpdate (edict_t *ent) SV_AddNailUpdate (edict_t *ent)
{ {
if (SVfloat (ent, modelindex) != sv_nailmodel if (SVfloat (ent, modelindex) != sv_nailmodel
&& SVfloat (ent, modelindex) != sv_supernailmodel) return false; && SVfloat (ent, modelindex) != sv_supernailmodel)
return false;
if (numnails == MAX_NAILS) if (numnails == MAX_NAILS)
return true; return true;
nails[numnails] = ent; nails[numnails] = ent;
@ -137,11 +138,11 @@ SV_EmitNailUpdate (sizebuf_t *msg)
for (n = 0; n < numnails; n++) { for (n = 0; n < numnails; n++) {
ent = nails[n]; ent = nails[n];
x = (int) (SVvector (ent, origin)[0] + 4096) >> 1; x = ((int) (SVvector (ent, origin)[0] + 4096 + 1) >> 1) & 4095;
y = (int) (SVvector (ent, origin)[1] + 4096) >> 1; y = ((int) (SVvector (ent, origin)[1] + 4096 + 1) >> 1) & 4095;
z = (int) (SVvector (ent, origin)[2] + 4096) >> 1; z = ((int) (SVvector (ent, origin)[2] + 4096 + 1) >> 1) & 4095;
p = (int) (16 * SVvector (ent, angles)[0] / 360) & 15; p = (int) (SVvector (ent, angles)[0] * (16.0 / 360.0)) & 15;
yaw = (int) (256 * SVvector (ent, angles)[1] / 360) & 255; yaw = (int) (SVvector (ent, angles)[1] * (256.0 / 360.0)) & 255;
bits[0] = x; bits[0] = x;
bits[1] = (x >> 8) | (y << 4); bits[1] = (x >> 8) | (y << 4);
@ -338,8 +339,7 @@ SV_EmitPacketEntities (client_t *client, packet_entities_t *to, sizebuf_t *msg)
// SV_Printf ("---%i to %i ----\n", client->delta_sequence & UPDATE_MASK, // SV_Printf ("---%i to %i ----\n", client->delta_sequence & UPDATE_MASK,
// client->netchan.outgoing_sequence & UPDATE_MASK); // client->netchan.outgoing_sequence & UPDATE_MASK);
while (newindex < to->num_entities || oldindex < oldmax) { while (newindex < to->num_entities || oldindex < oldmax) {
newnum = newnum = newindex >= to->num_entities ? 9999 :
newindex >= to->num_entities ? 9999 :
to->entities[newindex].number; to->entities[newindex].number;
oldnum = oldindex >= oldmax ? 9999 : from->entities[oldindex].number; oldnum = oldindex >= oldmax ? 9999 : from->entities[oldindex].number;
@ -573,8 +573,7 @@ SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
num_edicts = min (sv.num_edicts, 512); //FIXME stupid protocol limit num_edicts = min (sv.num_edicts, 512); //FIXME stupid protocol limit
for (e = MAX_CLIENTS + 1, ent = EDICT_NUM (&sv_pr_state, e); for (e = MAX_CLIENTS + 1, ent = EDICT_NUM (&sv_pr_state, e);
e < num_edicts; e < num_edicts; e++, ent = NEXT_EDICT (&sv_pr_state, ent)) {
e++, ent = NEXT_EDICT (&sv_pr_state, ent)) {
if (ent->free) if (ent->free)
continue; continue;
@ -628,16 +627,14 @@ SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
state->scale = bound (0, SVfloat (ent, scale), 15.9375) * 16.0; state->scale = bound (0, SVfloat (ent, scale), 15.9375) * 16.0;
if (sv_fields.glow_size != -1 && SVfloat (ent, glow_size)) if (sv_fields.glow_size != -1 && SVfloat (ent, glow_size))
state->glow_size = bound (-1024, (int) SVfloat state->glow_size =
(ent, glow_size), 1016) >> 3; bound (-1024, (int) SVfloat (ent, glow_size), 1016) >> 3;
if (sv_fields.glow_color != -1 && SVfloat (ent, glow_color)) if (sv_fields.glow_color != -1 && SVfloat (ent, glow_color))
state->glow_color = (int) SVfloat (ent, glow_color); state->glow_color = (int) SVfloat (ent, glow_color);
if (sv_fields.colormod != -1 if (sv_fields.colormod != -1 && SVvector (ent, colormod)[0]
&& SVvector (ent, colormod)[0] && SVvector (ent, colormod)[1] && SVvector (ent, colormod)[2])
&& SVvector (ent, colormod)[1]
&& SVvector (ent, colormod)[2])
state->colormod = state->colormod =
((int) (bound (0, SVvector (ent, colormod)[0], 1) * 7.0) ((int) (bound (0, SVvector (ent, colormod)[0], 1) * 7.0)
<< 5) | << 5) |
@ -650,7 +647,6 @@ SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
// encode the packet entities as a delta from the // encode the packet entities as a delta from the
// last packetentities acknowledged by the client // last packetentities acknowledged by the client
SV_EmitPacketEntities (client, pack, msg); SV_EmitPacketEntities (client, pack, msg);
// now add the specialized nail update // now add the specialized nail update