- }
- if (bits & E5_MODEL)
- {
- if (bits & E5_MODEL16)
- MSG_WriteShort(msg, s->modelindex);
- else
- MSG_WriteByte(msg, s->modelindex);
- }
- if (bits & E5_FRAME)
- {
- if (bits & E5_FRAME16)
- MSG_WriteShort(msg, s->frame);
- else
- MSG_WriteByte(msg, s->frame);
- }
- if (bits & E5_SKIN)
- MSG_WriteByte(msg, s->skin);
- if (bits & E5_EFFECTS)
- {
- if (bits & E5_EFFECTS32)
- MSG_WriteLong(msg, s->effects);
- else if (bits & E5_EFFECTS16)
- MSG_WriteShort(msg, s->effects);
- else
- MSG_WriteByte(msg, s->effects);
- }
- if (bits & E5_ALPHA)
- MSG_WriteByte(msg, s->alpha);
- if (bits & E5_SCALE)
- MSG_WriteByte(msg, s->scale);
- if (bits & E5_COLORMAP)
- MSG_WriteByte(msg, s->colormap);
- if (bits & E5_ATTACHMENT)
- {
- MSG_WriteShort(msg, s->tagentity);
- MSG_WriteByte(msg, s->tagindex);
- }
- if (bits & E5_LIGHT)
- {
- MSG_WriteShort(msg, s->light[0]);
- MSG_WriteShort(msg, s->light[1]);
- MSG_WriteShort(msg, s->light[2]);
- MSG_WriteShort(msg, s->light[3]);
- MSG_WriteByte(msg, s->lightstyle);
- MSG_WriteByte(msg, s->lightpflags);
- }
- if (bits & E5_GLOW)
- {
- MSG_WriteByte(msg, s->glowsize);
- MSG_WriteByte(msg, s->glowcolor);
- }
- if (bits & E5_COLORMOD)
- {
- MSG_WriteByte(msg, s->colormod[0]);
- MSG_WriteByte(msg, s->colormod[1]);
- MSG_WriteByte(msg, s->colormod[2]);
+ if (bits & E5_ALPHA)
+ MSG_WriteByte(msg, s->alpha);
+ if (bits & E5_SCALE)
+ MSG_WriteByte(msg, s->scale);
+ if (bits & E5_COLORMAP)
+ MSG_WriteByte(msg, s->colormap);
+ if (bits & E5_ATTACHMENT)
+ {
+ MSG_WriteShort(msg, s->tagentity);
+ MSG_WriteByte(msg, s->tagindex);
+ }
+ if (bits & E5_LIGHT)
+ {
+ MSG_WriteShort(msg, s->light[0]);
+ MSG_WriteShort(msg, s->light[1]);
+ MSG_WriteShort(msg, s->light[2]);
+ MSG_WriteShort(msg, s->light[3]);
+ MSG_WriteByte(msg, s->lightstyle);
+ MSG_WriteByte(msg, s->lightpflags);
+ }
+ if (bits & E5_GLOW)
+ {
+ MSG_WriteByte(msg, s->glowsize);
+ MSG_WriteByte(msg, s->glowcolor);
+ }
+ if (bits & E5_COLORMOD)
+ {
+ MSG_WriteByte(msg, s->colormod[0]);
+ MSG_WriteByte(msg, s->colormod[1]);
+ MSG_WriteByte(msg, s->colormod[2]);
+ }
+ if (bits & E5_GLOWMOD)
+ {
+ MSG_WriteByte(msg, s->glowmod[0]);
+ MSG_WriteByte(msg, s->glowmod[1]);
+ MSG_WriteByte(msg, s->glowmod[2]);
+ }
+ if (bits & E5_COMPLEXANIMATION)
+ {
+ if (s->skeletonobject.model && s->skeletonobject.relativetransforms)
+ {
+ int numbones = s->skeletonobject.model->num_bones;
+ int bonenum;
+ short pose7s[7];
+ MSG_WriteByte(msg, 4);
+ MSG_WriteShort(msg, s->modelindex);
+ MSG_WriteByte(msg, numbones);
+ for (bonenum = 0;bonenum < numbones;bonenum++)
+ {
+ Matrix4x4_ToBonePose7s(s->skeletonobject.relativetransforms + bonenum, 64, pose7s);
+ MSG_WriteShort(msg, pose7s[0]);
+ MSG_WriteShort(msg, pose7s[1]);
+ MSG_WriteShort(msg, pose7s[2]);
+ MSG_WriteShort(msg, pose7s[3]);
+ MSG_WriteShort(msg, pose7s[4]);
+ MSG_WriteShort(msg, pose7s[5]);
+ MSG_WriteShort(msg, pose7s[6]);
+ }
+ }
+ else
+ {
+ dp_model_t *model = SV_GetModelByIndex(s->modelindex);
+ if (s->framegroupblend[3].lerp > 0)
+ {
+ MSG_WriteByte(msg, 3);
+ MSG_WriteShort(msg, s->framegroupblend[0].frame);
+ MSG_WriteShort(msg, s->framegroupblend[1].frame);
+ MSG_WriteShort(msg, s->framegroupblend[2].frame);
+ MSG_WriteShort(msg, s->framegroupblend[3].frame);
+ MSG_WriteShort(msg, (int)(anim_reducetime(sv.time - s->framegroupblend[0].start, anim_frameduration(model, s->framegroupblend[0].frame), 65.535) * 1000.0));
+ MSG_WriteShort(msg, (int)(anim_reducetime(sv.time - s->framegroupblend[1].start, anim_frameduration(model, s->framegroupblend[1].frame), 65.535) * 1000.0));
+ MSG_WriteShort(msg, (int)(anim_reducetime(sv.time - s->framegroupblend[2].start, anim_frameduration(model, s->framegroupblend[2].frame), 65.535) * 1000.0));
+ MSG_WriteShort(msg, (int)(anim_reducetime(sv.time - s->framegroupblend[3].start, anim_frameduration(model, s->framegroupblend[3].frame), 65.535) * 1000.0));
+ MSG_WriteByte(msg, s->framegroupblend[0].lerp * 255.0f);
+ MSG_WriteByte(msg, s->framegroupblend[1].lerp * 255.0f);
+ MSG_WriteByte(msg, s->framegroupblend[2].lerp * 255.0f);
+ MSG_WriteByte(msg, s->framegroupblend[3].lerp * 255.0f);
+ }
+ else if (s->framegroupblend[2].lerp > 0)
+ {
+ MSG_WriteByte(msg, 2);
+ MSG_WriteShort(msg, s->framegroupblend[0].frame);
+ MSG_WriteShort(msg, s->framegroupblend[1].frame);
+ MSG_WriteShort(msg, s->framegroupblend[2].frame);
+ MSG_WriteShort(msg, (int)(anim_reducetime(sv.time - s->framegroupblend[0].start, anim_frameduration(model, s->framegroupblend[0].frame), 65.535) * 1000.0));
+ MSG_WriteShort(msg, (int)(anim_reducetime(sv.time - s->framegroupblend[1].start, anim_frameduration(model, s->framegroupblend[1].frame), 65.535) * 1000.0));
+ MSG_WriteShort(msg, (int)(anim_reducetime(sv.time - s->framegroupblend[2].start, anim_frameduration(model, s->framegroupblend[2].frame), 65.535) * 1000.0));
+ MSG_WriteByte(msg, s->framegroupblend[0].lerp * 255.0f);
+ MSG_WriteByte(msg, s->framegroupblend[1].lerp * 255.0f);
+ MSG_WriteByte(msg, s->framegroupblend[2].lerp * 255.0f);
+ }
+ else if (s->framegroupblend[1].lerp > 0)
+ {
+ MSG_WriteByte(msg, 1);
+ MSG_WriteShort(msg, s->framegroupblend[0].frame);
+ MSG_WriteShort(msg, s->framegroupblend[1].frame);
+ MSG_WriteShort(msg, (int)(anim_reducetime(sv.time - s->framegroupblend[0].start, anim_frameduration(model, s->framegroupblend[0].frame), 65.535) * 1000.0));
+ MSG_WriteShort(msg, (int)(anim_reducetime(sv.time - s->framegroupblend[1].start, anim_frameduration(model, s->framegroupblend[1].frame), 65.535) * 1000.0));
+ MSG_WriteByte(msg, s->framegroupblend[0].lerp * 255.0f);
+ MSG_WriteByte(msg, s->framegroupblend[1].lerp * 255.0f);
+ }
+ else
+ {
+ MSG_WriteByte(msg, 0);
+ MSG_WriteShort(msg, s->framegroupblend[0].frame);
+ MSG_WriteShort(msg, (int)(anim_reducetime(sv.time - s->framegroupblend[0].start, anim_frameduration(model, s->framegroupblend[0].frame), 65.535) * 1000.0));
+ }
+ }
+ }
+ if (bits & E5_TRAILEFFECTNUM)
+ MSG_WriteShort(msg, s->traileffectnum);
+ ENTITYSIZEPROFILING_END(msg, s->number, bits);