+ // ent has survived every check so far, check if it is visible
+ if (ent != clent && ((bits & U_VIEWMODEL) == 0))
+ {
+ // use the predicted origin
+ entmins[0] = ent->v.mins[0] + origin[0] - 1.0f;
+ entmins[1] = ent->v.mins[1] + origin[1] - 1.0f;
+ entmins[2] = ent->v.mins[2] + origin[2] - 1.0f;
+ entmaxs[0] = ent->v.maxs[0] + origin[0] + 1.0f;
+ entmaxs[1] = ent->v.maxs[1] + origin[1] + 1.0f;
+ entmaxs[2] = ent->v.maxs[2] + origin[2] + 1.0f;
+
+ // if not touching a visible leaf
+ if (sv_pvscheckentities.value && !SV_BoxTouchingPVS(pvs, entmins, entmaxs, sv.worldmodel->nodes))
+ continue;
+
+ // or not visible through the portals
+ if (sv_vischeckentities.value && !Portal_CheckBox(sv.worldmodel, org, entmins, entmaxs))
+ {
+ sv_vischeckentitycullcount++;
+ continue;
+ }
+ }
+
+ alpha = 255;
+ scale = 16;
+ glowcolor = 254;
+ colormod = 255;
+ effects = ent->v.effects;
+
+ if ((val = GETEDICTFIELDVALUE(ent, eval_alpha)))
+ if (val->_float != 0)
+ alpha = (int) (val->_float * 255.0);
+
+ // HalfLife support
+ if ((val = GETEDICTFIELDVALUE(ent, eval_renderamt)))
+ if (val->_float != 0)
+ alpha = (int) val->_float;
+
+ if (alpha == 0)
+ alpha = 255;
+ alpha = bound(0, alpha, 255);
+
+ if ((val = GETEDICTFIELDVALUE(ent, eval_scale)))
+ if ((scale = (int) (val->_float * 16.0)) == 0) scale = 16;
+ if (scale < 0) scale = 0;
+ if (scale > 255) scale = 255;
+
+ if ((val = GETEDICTFIELDVALUE(ent, eval_glow_color)))
+ if (val->_float != 0)
+ glowcolor = (int) val->_float;
+
+ if ((val = GETEDICTFIELDVALUE(ent, eval_fullbright)))
+ if (val->_float != 0)
+ effects |= EF_FULLBRIGHT;
+
+ if ((val = GETEDICTFIELDVALUE(ent, eval_colormod)))
+ if (val->vector[0] != 0 || val->vector[1] != 0 || val->vector[2] != 0)
+ colormod = (bound(0, (int) (val->vector[0] * 8.0), 7) << 5) | (bound(0, (int) (val->vector[1] * 8.0), 7) << 2) | bound(0, (int) (val->vector[2] * 4.0), 3);
+
+ if (ent != clent)
+ {
+// if (glowsize == 0 && (bits & U_GLOWTRAIL) == 0) // no effects
+// {
+// if (ent->v.modelindex && pr_strings[ent->v.model]) // model
+// {
+ // don't send if flagged for NODRAW and there are no effects
+ if (sv.models[(int)ent->v.modelindex]->flags == 0 && ((effects & EF_NODRAW) || scale <= 0 || alpha <= 0))
+ continue;
+// }
+// else // no model and no effects
+// continue;
+// }
+ }
+
+ if (msg->maxsize - msg->cursize < 32) // LordHavoc: increased check from 16 to 32
+ {
+ Con_Printf ("packet overflow\n");
+ // mark the rest of the entities so they can't be delta compressed against this frame
+ for (;e < sv.num_edicts;e++)
+ client->nextfullupdate[e] = -1;
+ return;
+ }
+
+ 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.value)
+ {
+ // 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;
+