- if ((val = GETEDICTFIELDVALUE(ent, eval_exteriormodeltoclient)) && val->edict == clentnum)
- bits = bits | U_EXTERIORMODEL;
-
-// send an update
- baseline = &ent->baseline;
-
- if (((int)ent->v.effects & EF_DELTA) && sv_deltacompress.integer)
- {
- // every half second a full update is forced
- if (realtime < client->nextfullupdate[e])
- {
- bits |= U_DELTA;
- baseline = &ent->deltabaseline;
- }
- else
- nextfullupdate = realtime + 0.5f;
- }
- else
- nextfullupdate = realtime + 0.5f;
-
- // restore nextfullupdate since this is being sent for real
- client->nextfullupdate[e] = nextfullupdate;
-
- if (e >= 256)
- bits |= U_LONGENTITY;
-
- if (ent->v.movetype == MOVETYPE_STEP)
- bits |= U_STEP;
-
- // LordHavoc: old stuff, but rewritten to have more exact tolerances
- if (origin[0] != baseline->origin[0]) bits |= U_ORIGIN1;
- if (origin[1] != baseline->origin[1]) bits |= U_ORIGIN2;
- if (origin[2] != baseline->origin[2]) bits |= U_ORIGIN3;
- if (((int)(angles[0]*(256.0/360.0)) & 255) != ((int)(baseline->angles[0]*(256.0/360.0)) & 255)) bits |= U_ANGLE1;
- if (((int)(angles[1]*(256.0/360.0)) & 255) != ((int)(baseline->angles[1]*(256.0/360.0)) & 255)) bits |= U_ANGLE2;
- if (((int)(angles[2]*(256.0/360.0)) & 255) != ((int)(baseline->angles[2]*(256.0/360.0)) & 255)) bits |= U_ANGLE3;
- if (baseline->colormap != (qbyte) ent->v.colormap) bits |= U_COLORMAP;
- if (baseline->skin != (qbyte) ent->v.skin) bits |= U_SKIN;
- if ((baseline->frame & 0x00FF) != ((int) ent->v.frame & 0x00FF)) bits |= U_FRAME;
- if ((baseline->effects & 0x00FF) != ((int) ent->v.effects & 0x00FF)) bits |= U_EFFECTS;
- if ((baseline->modelindex & 0x00FF) != ((int) ent->v.modelindex & 0x00FF)) bits |= U_MODEL;
-
- // LordHavoc: new stuff
- if (baseline->alpha != alpha) bits |= U_ALPHA;
- if (baseline->scale != scale) bits |= U_SCALE;
- if (((int) baseline->effects & 0xFF00) != ((int) ent->v.effects & 0xFF00)) bits |= U_EFFECTS2;
- if (baseline->glowsize != glowsize) bits |= U_GLOWSIZE;
- if (baseline->glowcolor != glowcolor) bits |= U_GLOWCOLOR;
- if (((int) baseline->frame & 0xFF00) != ((int) ent->v.frame & 0xFF00)) bits |= U_FRAME2;
- if (((int) baseline->frame & 0xFF00) != ((int) ent->v.modelindex & 0xFF00)) bits |= U_MODEL2;
-
- // update delta baseline
- VectorCopy(ent->v.origin, ent->deltabaseline.origin);
- VectorCopy(ent->v.angles, ent->deltabaseline.angles);
- ent->deltabaseline.colormap = ent->v.colormap;
- ent->deltabaseline.skin = ent->v.skin;
- ent->deltabaseline.frame = ent->v.frame;
- ent->deltabaseline.effects = ent->v.effects;
- ent->deltabaseline.modelindex = ent->v.modelindex;
- ent->deltabaseline.alpha = alpha;
- ent->deltabaseline.scale = scale;
- ent->deltabaseline.glowsize = glowsize;
- ent->deltabaseline.glowcolor = glowcolor;
-
- // write the message
- if (bits >= 16777216)
- bits |= U_EXTEND2;
- if (bits >= 65536)
- bits |= U_EXTEND1;
- if (bits >= 256)
- bits |= U_MOREBITS;
- bits |= U_SIGNAL;
-
- MSG_WriteByte (msg, bits);
- if (bits & U_MOREBITS)
- MSG_WriteByte (msg, bits>>8);
- // LordHavoc: extend bytes have to be written here due to delta compression
- if (bits & U_EXTEND1)
- MSG_WriteByte (msg, bits>>16);
- if (bits & U_EXTEND2)
- MSG_WriteByte (msg, bits>>24);
-
- // LordHavoc: old stuff
- if (bits & U_LONGENTITY)
- MSG_WriteShort (msg,e);
- else
- MSG_WriteByte (msg,e);
- if (bits & U_MODEL) MSG_WriteByte (msg, ent->v.modelindex);
- if (bits & U_FRAME) MSG_WriteByte (msg, ent->v.frame);
- if (bits & U_COLORMAP) MSG_WriteByte (msg, ent->v.colormap);
- if (bits & U_SKIN) MSG_WriteByte (msg, ent->v.skin);
- if (bits & U_EFFECTS) MSG_WriteByte (msg, ent->v.effects);
- if (bits & U_ORIGIN1) MSG_WriteDPCoord (msg, origin[0]);
- if (bits & U_ANGLE1) MSG_WriteAngle(msg, angles[0]);
- if (bits & U_ORIGIN2) MSG_WriteDPCoord (msg, origin[1]);
- if (bits & U_ANGLE2) MSG_WriteAngle(msg, angles[1]);
- if (bits & U_ORIGIN3) MSG_WriteDPCoord (msg, origin[2]);
- if (bits & U_ANGLE3) MSG_WriteAngle(msg, angles[2]);
-
- // LordHavoc: new stuff
- if (bits & U_ALPHA) MSG_WriteByte(msg, alpha);
- if (bits & U_SCALE) MSG_WriteByte(msg, scale);
- if (bits & U_EFFECTS2) MSG_WriteByte(msg, (int)ent->v.effects >> 8);
- if (bits & U_GLOWSIZE) MSG_WriteByte(msg, glowsize);
- if (bits & U_GLOWCOLOR) MSG_WriteByte(msg, glowcolor);
- if (bits & U_FRAME2) MSG_WriteByte(msg, (int)ent->v.frame >> 8);
- if (bits & U_MODEL2) MSG_WriteByte(msg, (int)ent->v.modelindex >> 8);